codemasher 5 лет назад
Родитель
Сommit
51ca0964d4
3 измененных файлов с 24 добавлено и 5 удалено
  1. 6 1
      src/Common/EccLevel.php
  2. 4 4
      src/Common/Mode.php
  3. 14 0
      src/Common/Version.php

+ 6 - 1
src/Common/EccLevel.php

@@ -212,6 +212,9 @@ class EccLevel{
 		$this->eccLevel = $eccLevel;
 	}
 
+	/**
+	 * returns the ordinal value of the current ECC level
+	 */
 	public function getOrdinal():int{
 		return $this->eccLevel;
 	}
@@ -234,7 +237,6 @@ class EccLevel{
 	/**
 	 * returns the format pattern for the given $eccLevel and $maskPattern
 	 *
-	 * @return int
 	 * @throws \chillerlan\QRCode\QRCodeException
 	 */
 	public function getformatPattern(int $maskPattern):int{
@@ -246,6 +248,9 @@ class EccLevel{
 		return self::formatPattern[self::MODES[$this->eccLevel]][$maskPattern];
 	}
 
+	/**
+	 * returns an array wit the max bit lengths for version 1-40 and the current ECC level
+	 */
 	public function getMaxBits():array{
 		return array_combine(
 			array_keys(self::MAX_BITS),

+ 4 - 4
src/Common/Mode.php

@@ -59,10 +59,10 @@ class Mode{
 	 * @var string[]
 	 */
 	public const DATA_INTERFACES = [
-		Mode::DATA_NUMBER   => Number::class,
-		Mode::DATA_ALPHANUM => AlphaNum::class,
-		Mode::DATA_KANJI    => Kanji::class,
-		Mode::DATA_BYTE     => Byte::class,
+		self::DATA_NUMBER   => Number::class,
+		self::DATA_ALPHANUM => AlphaNum::class,
+		self::DATA_KANJI    => Kanji::class,
+		self::DATA_BYTE     => Byte::class,
 	];
 
 	/**

+ 14 - 0
src/Common/Version.php

@@ -132,18 +132,32 @@ class Version{
 		$this->version = $version;
 	}
 
+	/**
+	 * returns the current version number
+	 */
 	public function getVersionNumber():int{
 		return $this->version;
 	}
 
+	/**
+	 * the matrix size for the given version
+	 */
 	public function getDimension():int{
 		return $this->version * 4 + 17;
 	}
 
+	/**
+	 * the version pattern for the given version
+	 */
 	public function getVersionPattern():?int{
 		return self::VERSION_PATTERN[$this->version] ?? null;
 	}
 
+	/**
+	 * the alignment patterns for the current version
+	 *
+	 * @return int[]
+	 */
 	public function getAlignmentPattern():array{
 		return self::ALIGNMENT_PATTERN[$this->version];
 	}