mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-18 01:32:47 +00:00
:octocat: change visibility in final classes to private
This commit is contained in:
@@ -13,7 +13,10 @@ namespace chillerlan\QRCode\Common;
|
||||
use InvalidArgumentException;
|
||||
use function array_key_exists;
|
||||
|
||||
class ECICharset{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
final class ECICharset{
|
||||
|
||||
public const CP437 = 0; // Code page 437, DOS Latin US
|
||||
public const ISO_IEC_8859_1_GLI = 1; // GLI encoding with characters 0 to 127 identical to ISO/IEC 646 and characters 128 to 255 identical to ISO 8859-1
|
||||
|
||||
@@ -256,7 +256,7 @@ final class Version{
|
||||
/**
|
||||
* QR Code version number
|
||||
*/
|
||||
protected int $version;
|
||||
private int $version;
|
||||
|
||||
/**
|
||||
* Version constructor.
|
||||
|
||||
@@ -27,7 +27,7 @@ final class AlphaNum extends QRDataModeAbstract{
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
protected const CHAR_MAP_ALPHANUM = [
|
||||
private const CHAR_MAP_ALPHANUM = [
|
||||
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7,
|
||||
'8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15,
|
||||
'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23,
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ final class ECI extends QRDataModeAbstract{
|
||||
/**
|
||||
* The current ECI encoding id
|
||||
*/
|
||||
protected int $encoding;
|
||||
private int $encoding;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
||||
@@ -27,7 +27,7 @@ final class MaskPatternTester{
|
||||
/**
|
||||
* The data interface that contains the data matrix to test
|
||||
*/
|
||||
protected QRData $qrData;
|
||||
private QRData $qrData;
|
||||
|
||||
/**
|
||||
* Receives the QRData object
|
||||
@@ -74,7 +74,7 @@ final class MaskPatternTester{
|
||||
/**
|
||||
* Checks for each group of five or more same-colored modules in a row (or column)
|
||||
*/
|
||||
protected function testLevel1(array $m, int $size):int{
|
||||
private function testLevel1(array $m, int $size):int{
|
||||
$penalty = 0;
|
||||
|
||||
foreach($m as $y => $row){
|
||||
@@ -113,7 +113,7 @@ final class MaskPatternTester{
|
||||
/**
|
||||
* Checks for each 2x2 area of same-colored modules in the matrix
|
||||
*/
|
||||
protected function testLevel2(array $m, int $size):int{
|
||||
private function testLevel2(array $m, int $size):int{
|
||||
$penalty = 0;
|
||||
|
||||
foreach($m as $y => $row){
|
||||
@@ -144,7 +144,7 @@ final class MaskPatternTester{
|
||||
/**
|
||||
* Checks if there are patterns that look similar to the finder patterns (1:1:3:1:1 ratio)
|
||||
*/
|
||||
protected function testLevel3(array $m, int $size):int{
|
||||
private function testLevel3(array $m, int $size):int{
|
||||
$penalties = 0;
|
||||
|
||||
foreach($m as $y => $row){
|
||||
@@ -185,7 +185,7 @@ final class MaskPatternTester{
|
||||
/**
|
||||
* Checks if more than half of the modules are dark or light, with a larger penalty for a larger difference
|
||||
*/
|
||||
protected function testLevel4(array $m, int $size):float{
|
||||
private function testLevel4(array $m, int $size):float{
|
||||
$count = 0;
|
||||
|
||||
foreach($m as $y => $row){
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ final class Number extends QRDataModeAbstract{
|
||||
/**
|
||||
* @var int[]
|
||||
*/
|
||||
protected const CHAR_MAP_NUMBER = [
|
||||
private const CHAR_MAP_NUMBER = [
|
||||
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
|
||||
];
|
||||
|
||||
|
||||
+9
-9
@@ -26,34 +26,34 @@ final class QRData{
|
||||
*
|
||||
* @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\QRCode\QROptions
|
||||
*/
|
||||
protected SettingsContainerInterface $options;
|
||||
private SettingsContainerInterface $options;
|
||||
|
||||
/**
|
||||
* a BitBuffer instance
|
||||
*/
|
||||
protected BitBuffer $bitBuffer;
|
||||
private BitBuffer $bitBuffer;
|
||||
|
||||
/**
|
||||
* an EccLevel instance
|
||||
*/
|
||||
protected EccLevel $eccLevel;
|
||||
private EccLevel $eccLevel;
|
||||
|
||||
/**
|
||||
* current QR Code version
|
||||
*/
|
||||
protected Version $version;
|
||||
private Version $version;
|
||||
|
||||
/**
|
||||
* @var \chillerlan\QRCode\Data\QRDataModeInterface[]
|
||||
*/
|
||||
protected array $dataSegments = [];
|
||||
private array $dataSegments = [];
|
||||
|
||||
/**
|
||||
* Max bits for the current ECC mode
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
protected array $maxBitsForEcc;
|
||||
private array $maxBitsForEcc;
|
||||
|
||||
/**
|
||||
* QRData constructor.
|
||||
@@ -108,7 +108,7 @@ final class QRData{
|
||||
*
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
protected function estimateTotalBitLength():int{
|
||||
private function estimateTotalBitLength():int{
|
||||
$length = 0;
|
||||
$margin = 0;
|
||||
|
||||
@@ -142,7 +142,7 @@ final class QRData{
|
||||
*
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
protected function getMinimumVersion():int{
|
||||
private function getMinimumVersion():int{
|
||||
$total = $this->estimateTotalBitLength();
|
||||
|
||||
// guess the version number within the given range
|
||||
@@ -162,7 +162,7 @@ final class QRData{
|
||||
*
|
||||
* @throws \chillerlan\QRCode\QRCodeException on data overflow
|
||||
*/
|
||||
protected function writeBitBuffer():void{
|
||||
private function writeBitBuffer():void{
|
||||
$version = $this->version->getVersionNumber();
|
||||
$MAX_BITS = $this->maxBitsForEcc[$version];
|
||||
|
||||
|
||||
@@ -55,29 +55,29 @@ final class QRMatrix{
|
||||
/**
|
||||
* the used mask pattern, set via QRMatrix::mask()
|
||||
*/
|
||||
protected ?MaskPattern $maskPattern = null;
|
||||
private ?MaskPattern $maskPattern = null;
|
||||
|
||||
/**
|
||||
* the size (side length) of the matrix, including quiet zone (if created)
|
||||
*/
|
||||
protected int $moduleCount;
|
||||
private int $moduleCount;
|
||||
|
||||
/**
|
||||
* the actual matrix data array
|
||||
*
|
||||
* @var int[][]
|
||||
*/
|
||||
protected array $matrix;
|
||||
private array $matrix;
|
||||
|
||||
/**
|
||||
* the current ECC level
|
||||
*/
|
||||
protected EccLevel $eccLevel;
|
||||
private EccLevel $eccLevel;
|
||||
|
||||
/**
|
||||
* a Version instance
|
||||
*/
|
||||
protected Version $version;
|
||||
private Version $version;
|
||||
|
||||
/**
|
||||
* QRMatrix constructor.
|
||||
|
||||
@@ -30,7 +30,7 @@ final class QRCodeReader{
|
||||
*
|
||||
* @return \chillerlan\QRCode\Decoder\DecoderResult
|
||||
*/
|
||||
protected function decode($im):DecoderResult{
|
||||
private function decode($im):DecoderResult{
|
||||
|
||||
$source = $this->useImagickIfAvailable
|
||||
? new IMagickLuminanceSource($im)
|
||||
|
||||
Reference in New Issue
Block a user