codemasher 5 лет назад
Родитель
Сommit
66466432db

+ 1 - 4
src/Data/Kanji.php

@@ -39,10 +39,7 @@ class Kanji extends QRDataAbstract{
 	}
 
 	/**
-	 * @param string $data
-	 *
-	 * @return void
-	 * @throws \chillerlan\QRCode\Data\QRCodeDataException
+	 * @inheritdoc
 	 */
 	protected function write(string $data):void{
 		$len = strlen($data);

+ 7 - 18
src/Data/QRDataAbstract.php

@@ -86,7 +86,7 @@ abstract class QRDataAbstract implements QRDataInterface{
 	 * QRDataInterface constructor.
 	 *
 	 * @param \chillerlan\Settings\SettingsContainerInterface $options
-	 * @param string|null                           $data
+	 * @param string|null                                     $data
 	 */
 	public function __construct(SettingsContainerInterface $options, string $data = null){
 		$this->options = $options;
@@ -97,11 +97,7 @@ abstract class QRDataAbstract implements QRDataInterface{
 	}
 
 	/**
-	 * Sets the data string (internally called by the constructor)
-	 *
-	 * @param string $data
-	 *
-	 * @return \chillerlan\QRCode\Data\QRDataInterface
+	 * @inheritDoc
 	 */
 	public function setData(string $data):QRDataInterface{
 
@@ -123,17 +119,10 @@ abstract class QRDataAbstract implements QRDataInterface{
 	}
 
 	/**
-	 * returns a fresh matrix object with the data written for the given $maskPattern
-	 *
-	 * @param int       $maskPattern
-	 * @param bool|null $test
-	 *
-	 * @return \chillerlan\QRCode\Data\QRMatrix
+	 * @inheritDoc
 	 */
 	public function initMatrix(int $maskPattern, bool $test = null):QRMatrix{
-		$matrix = new QRMatrix($this->version, $this->options->eccLevel);
-
-		return $matrix
+		return (new QRMatrix($this->version, $this->options->eccLevel))
 			->setFinderPattern()
 			->setSeparators()
 			->setAlignmentPattern()
@@ -196,6 +185,8 @@ abstract class QRDataAbstract implements QRDataInterface{
 	}
 
 	/**
+	 * writes the actual data string to the BitBuffer
+	 *
 	 * @see \chillerlan\QRCode\Data\QRDataAbstract::writeBitBuffer()
 	 *
 	 * @param string $data
@@ -205,7 +196,7 @@ abstract class QRDataAbstract implements QRDataInterface{
 	abstract protected function write(string $data):void;
 
 	/**
-	 * writes the string data to the BitBuffer
+	 * creates a BitBuffer and writes the string data to it
 	 *
 	 * @param string $data
 	 *
@@ -262,8 +253,6 @@ abstract class QRDataAbstract implements QRDataInterface{
 	/**
 	 * ECC masking
 	 *
-	 * @see \chillerlan\QRCode\Data\QRDataAbstract::writeBitBuffer()
-	 *
 	 * @link http://www.thonky.com/qr-code-tutorial/error-correction-coding
 	 *
 	 * @return array

+ 6 - 2
src/Data/QRDataInterface.php

@@ -166,6 +166,8 @@ interface QRDataInterface{
 	];
 
 	/**
+	 * Sets the data string (internally called by the constructor)
+	 *
 	 * @param string $data
 	 *
 	 * @return \chillerlan\QRCode\Data\QRDataInterface
@@ -173,8 +175,10 @@ interface QRDataInterface{
 	public function setData(string $data):QRDataInterface;
 
 	/**
-	 * @param int  $maskPattern
-	 * @param bool $test
+	 * returns a fresh matrix object with the data written for the given $maskPattern
+	 *
+	 * @param int       $maskPattern
+	 * @param bool|null $test
 	 *
 	 * @return \chillerlan\QRCode\Data\QRMatrix
 	 */

+ 2 - 4
src/Output/QRImage.php

@@ -43,7 +43,7 @@ class QRImage extends QROutputAbstract{
 	protected $image;
 
 	/**
-	 * @return void
+	 * @inheritDoc
 	 */
 	protected function setModuleValues():void{
 
@@ -64,9 +64,7 @@ class QRImage extends QROutputAbstract{
 	}
 
 	/**
-	 * @param string|null $file
-	 *
-	 * @return string
+	 * @inheritDoc
 	 */
 	public function dump(string $file = null):string{
 		$this->image = imagecreatetruecolor($this->length, $this->length);

+ 2 - 4
src/Output/QRImagick.php

@@ -25,7 +25,7 @@ use function is_string;
 class QRImagick extends QROutputAbstract{
 
 	/**
-	 * @return void
+	 * @inheritDoc
 	 */
 	protected function setModuleValues():void{
 
@@ -44,9 +44,7 @@ class QRImagick extends QROutputAbstract{
 	}
 
 	/**
-	 * @param string|null $file
-	 *
-	 * @return string
+	 * @inheritDoc
 	 */
 	public function dump(string $file = null):string{
 		$file    = $file ?? $this->options->cachefile;

+ 1 - 1
src/Output/QRMarkup.php

@@ -34,7 +34,7 @@ class QRMarkup extends QROutputAbstract{
 	protected $svgHeader = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="qr-svg %1$s" style="width: 100%%; height: auto;" viewBox="0 0 %2$d %2$d">';
 
 	/**
-	 * @return void
+	 * @inheritDoc
 	 */
 	protected function setModuleValues():void{
 

+ 5 - 3
src/Output/QROutputAbstract.php

@@ -92,7 +92,10 @@ abstract class QROutputAbstract implements QROutputInterface{
 	abstract protected function setModuleValues():void;
 
 	/**
+	 * saves the qr data to a file
+	 *
 	 * @see file_put_contents()
+	 * @see \chillerlan\QRCode\QROptions::cachefile
 	 *
 	 * @param string $data
 	 * @param string $file
@@ -110,11 +113,10 @@ abstract class QROutputAbstract implements QROutputInterface{
 	}
 
 	/**
-	 * @param string|null $file
-	 *
-	 * @return string|mixed
+	 * @inheritDoc
 	 */
 	public function dump(string $file = null){
+		// call the built-in output method
 		$data = call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
 		$file = $file ?? $this->options->cachefile;
 

+ 2 - 0
src/Output/QROutputInterface.php

@@ -42,6 +42,8 @@ interface QROutputInterface{
 	];
 
 	/**
+	 * generates the output, optionally dumps it to a file, and returns it
+	 *
 	 * @param string|null $file
 	 *
 	 * @return mixed

+ 1 - 1
src/Output/QRString.php

@@ -27,7 +27,7 @@ class QRString extends QROutputAbstract{
 	protected $defaultMode = QRCode::OUTPUT_STRING_TEXT;
 
 	/**
-	 * @return void
+	 * @inheritDoc
 	 */
 	protected function setModuleValues():void{
 

+ 1 - 1
src/QRCode.php

@@ -91,7 +91,7 @@ class QRCode{
 	];
 
 	/**
-	 * @var \chillerlan\QRCode\QROptions
+	 * @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface
 	 */
 	protected $options;
 

+ 14 - 2
src/QROptionsTrait.php

@@ -55,7 +55,7 @@ trait QROptionsTrait{
 	/**
 	 * Mask Pattern to use
 	 *
-	 *  [0...7] or QRCode::MASK_PATTERN_AUTO
+	 *   [0...7] or QRCode::MASK_PATTERN_AUTO
 	 *
 	 * @var int
 	 */
@@ -69,7 +69,7 @@ trait QROptionsTrait{
 	protected $addQuietzone = true;
 
 	/**
-	 *  Size of the quiet zone
+	 * Size of the quiet zone
 	 *
 	 *   internally clamped to [0 ... $moduleCount / 2], defaults to 4 modules
 	 *
@@ -268,6 +268,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets the minimum version number
+	 *
 	 * @param int $version
 	 *
 	 * @return void
@@ -277,6 +279,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets the maximum version number
+	 *
 	 * @param int $version
 	 *
 	 * @return void
@@ -286,6 +290,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets the error correction level
+	 *
 	 * @param int $eccLevel
 	 *
 	 * @return void
@@ -301,6 +307,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets/clamps the mask pattern
+	 *
 	 * @param int $maskPattern
 	 *
 	 * @return void
@@ -314,6 +322,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets the transparency background color
+	 *
 	 * @param mixed $imageTransparencyBG
 	 *
 	 * @return void
@@ -343,6 +353,8 @@ trait QROptionsTrait{
 	}
 
 	/**
+	 * sets/clamps the version number
+	 *
 	 * @param int $version
 	 *
 	 * @return void