Explorar o código

:octocat: change visibility in final classes to private

codemasher %!s(int64=4) %!d(string=hai) anos
pai
achega
d1936de3ba

+ 4 - 1
src/Common/ECICharset.php

@@ -13,7 +13,10 @@ namespace chillerlan\QRCode\Common;
 use InvalidArgumentException;
 use InvalidArgumentException;
 use function array_key_exists;
 use function array_key_exists;
 
 
-class ECICharset{
+/**
+ *
+ */
+final class ECICharset{
 
 
 	public const CP437                 = 0;  // Code page 437, DOS Latin US
 	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
 	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

+ 1 - 1
src/Common/Version.php

@@ -256,7 +256,7 @@ final class Version{
 	/**
 	/**
 	 * QR Code version number
 	 * QR Code version number
 	 */
 	 */
-	protected int $version;
+	private int $version;
 
 
 	/**
 	/**
 	 * Version constructor.
 	 * Version constructor.

+ 1 - 1
src/Data/AlphaNum.php

@@ -27,7 +27,7 @@ final class AlphaNum extends QRDataModeAbstract{
 	 *
 	 *
 	 * @var int[]
 	 * @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,
 		'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,
 		'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,
 		'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23,

+ 1 - 1
src/Data/ECI.php

@@ -24,7 +24,7 @@ final class ECI extends QRDataModeAbstract{
 	/**
 	/**
 	 * The current ECI encoding id
 	 * The current ECI encoding id
 	 */
 	 */
-	protected int $encoding;
+	private int $encoding;
 
 
 	/**
 	/**
 	 * @inheritDoc
 	 * @inheritDoc

+ 5 - 5
src/Data/MaskPatternTester.php

@@ -27,7 +27,7 @@ final class MaskPatternTester{
 	/**
 	/**
 	 * The data interface that contains the data matrix to test
 	 * The data interface that contains the data matrix to test
 	 */
 	 */
-	protected QRData $qrData;
+	private QRData $qrData;
 
 
 	/**
 	/**
 	 * Receives the QRData object
 	 * 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)
 	 * 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;
 		$penalty = 0;
 
 
 		foreach($m as $y => $row){
 		foreach($m as $y => $row){
@@ -113,7 +113,7 @@ final class MaskPatternTester{
 	/**
 	/**
 	 * Checks for each 2x2 area of same-colored modules in the matrix
 	 * 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;
 		$penalty = 0;
 
 
 		foreach($m as $y => $row){
 		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)
 	 * 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;
 		$penalties = 0;
 
 
 		foreach($m as $y => $row){
 		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
 	 * 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;
 		$count = 0;
 
 
 		foreach($m as $y => $row){
 		foreach($m as $y => $row){

+ 1 - 1
src/Data/Number.php

@@ -25,7 +25,7 @@ final class Number extends QRDataModeAbstract{
 	/**
 	/**
 	 * @var int[]
 	 * @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,
 		'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
 	];
 	];
 
 

+ 9 - 9
src/Data/QRData.php

@@ -26,34 +26,34 @@ final class QRData{
 	 *
 	 *
 	 * @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\QRCode\QROptions
 	 * @var \chillerlan\Settings\SettingsContainerInterface|\chillerlan\QRCode\QROptions
 	 */
 	 */
-	protected SettingsContainerInterface $options;
+	private SettingsContainerInterface $options;
 
 
 	/**
 	/**
 	 * a BitBuffer instance
 	 * a BitBuffer instance
 	 */
 	 */
-	protected BitBuffer $bitBuffer;
+	private BitBuffer $bitBuffer;
 
 
 	/**
 	/**
 	 * an EccLevel instance
 	 * an EccLevel instance
 	 */
 	 */
-	protected EccLevel $eccLevel;
+	private EccLevel $eccLevel;
 
 
 	/**
 	/**
 	 * current QR Code version
 	 * current QR Code version
 	 */
 	 */
-	protected Version $version;
+	private Version $version;
 
 
 	/**
 	/**
 	 * @var \chillerlan\QRCode\Data\QRDataModeInterface[]
 	 * @var \chillerlan\QRCode\Data\QRDataModeInterface[]
 	 */
 	 */
-	protected array $dataSegments = [];
+	private array $dataSegments = [];
 
 
 	/**
 	/**
 	 * Max bits for the current ECC mode
 	 * Max bits for the current ECC mode
 	 *
 	 *
 	 * @var int[]
 	 * @var int[]
 	 */
 	 */
-	protected array $maxBitsForEcc;
+	private array $maxBitsForEcc;
 
 
 	/**
 	/**
 	 * QRData constructor.
 	 * QRData constructor.
@@ -108,7 +108,7 @@ final class QRData{
 	 *
 	 *
 	 * @throws \chillerlan\QRCode\Data\QRCodeDataException
 	 * @throws \chillerlan\QRCode\Data\QRCodeDataException
 	 */
 	 */
-	protected function estimateTotalBitLength():int{
+	private function estimateTotalBitLength():int{
 		$length = 0;
 		$length = 0;
 		$margin = 0;
 		$margin = 0;
 
 
@@ -142,7 +142,7 @@ final class QRData{
 	 *
 	 *
 	 * @throws \chillerlan\QRCode\Data\QRCodeDataException
 	 * @throws \chillerlan\QRCode\Data\QRCodeDataException
 	 */
 	 */
-	protected function getMinimumVersion():int{
+	private function getMinimumVersion():int{
 		$total = $this->estimateTotalBitLength();
 		$total = $this->estimateTotalBitLength();
 
 
 		// guess the version number within the given range
 		// guess the version number within the given range
@@ -162,7 +162,7 @@ final class QRData{
 	 *
 	 *
 	 * @throws \chillerlan\QRCode\QRCodeException on data overflow
 	 * @throws \chillerlan\QRCode\QRCodeException on data overflow
 	 */
 	 */
-	protected function writeBitBuffer():void{
+	private function writeBitBuffer():void{
 		$version  = $this->version->getVersionNumber();
 		$version  = $this->version->getVersionNumber();
 		$MAX_BITS = $this->maxBitsForEcc[$version];
 		$MAX_BITS = $this->maxBitsForEcc[$version];
 
 

+ 5 - 5
src/Data/QRMatrix.php

@@ -55,29 +55,29 @@ final class QRMatrix{
 	/**
 	/**
 	 * the used mask pattern, set via QRMatrix::mask()
 	 * 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)
 	 * the size (side length) of the matrix, including quiet zone (if created)
 	 */
 	 */
-	protected int $moduleCount;
+	private int $moduleCount;
 
 
 	/**
 	/**
 	 * the actual matrix data array
 	 * the actual matrix data array
 	 *
 	 *
 	 * @var int[][]
 	 * @var int[][]
 	 */
 	 */
-	protected array $matrix;
+	private array $matrix;
 
 
 	/**
 	/**
 	 * the current ECC level
 	 * the current ECC level
 	 */
 	 */
-	protected EccLevel $eccLevel;
+	private EccLevel $eccLevel;
 
 
 	/**
 	/**
 	 * a Version instance
 	 * a Version instance
 	 */
 	 */
-	protected Version $version;
+	private Version $version;
 
 
 	/**
 	/**
 	 * QRMatrix constructor.
 	 * QRMatrix constructor.

+ 1 - 1
src/QRCodeReader.php

@@ -30,7 +30,7 @@ final class QRCodeReader{
 	 *
 	 *
 	 * @return \chillerlan\QRCode\Decoder\DecoderResult
 	 * @return \chillerlan\QRCode\Decoder\DecoderResult
 	 */
 	 */
-	protected function decode($im):DecoderResult{
+	private function decode($im):DecoderResult{
 
 
 		$source = $this->useImagickIfAvailable
 		$source = $this->useImagickIfAvailable
 			? new IMagickLuminanceSource($im)
 			? new IMagickLuminanceSource($im)