Skip to content

Commit 6646643

Browse files
committed
🚿 some docblocks/fixes
1 parent 622f302 commit 6646643

11 files changed

+42
-40
lines changed

src/Data/Kanji.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ protected function getLength(string $data):int{
3939
}
4040

4141
/**
42-
* @param string $data
43-
*
44-
* @return void
45-
* @throws \chillerlan\QRCode\Data\QRCodeDataException
42+
* @inheritdoc
4643
*/
4744
protected function write(string $data):void{
4845
$len = strlen($data);

src/Data/QRDataAbstract.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ abstract class QRDataAbstract implements QRDataInterface{
8686
* QRDataInterface constructor.
8787
*
8888
* @param \chillerlan\Settings\SettingsContainerInterface $options
89-
* @param string|null $data
89+
* @param string|null $data
9090
*/
9191
public function __construct(SettingsContainerInterface $options, string $data = null){
9292
$this->options = $options;
@@ -97,11 +97,7 @@ public function __construct(SettingsContainerInterface $options, string $data =
9797
}
9898

9999
/**
100-
* Sets the data string (internally called by the constructor)
101-
*
102-
* @param string $data
103-
*
104-
* @return \chillerlan\QRCode\Data\QRDataInterface
100+
* @inheritDoc
105101
*/
106102
public function setData(string $data):QRDataInterface{
107103

@@ -123,17 +119,10 @@ public function setData(string $data):QRDataInterface{
123119
}
124120

125121
/**
126-
* returns a fresh matrix object with the data written for the given $maskPattern
127-
*
128-
* @param int $maskPattern
129-
* @param bool|null $test
130-
*
131-
* @return \chillerlan\QRCode\Data\QRMatrix
122+
* @inheritDoc
132123
*/
133124
public function initMatrix(int $maskPattern, bool $test = null):QRMatrix{
134-
$matrix = new QRMatrix($this->version, $this->options->eccLevel);
135-
136-
return $matrix
125+
return (new QRMatrix($this->version, $this->options->eccLevel))
137126
->setFinderPattern()
138127
->setSeparators()
139128
->setAlignmentPattern()
@@ -196,6 +185,8 @@ protected function getMinimumVersion():int{
196185
}
197186

198187
/**
188+
* writes the actual data string to the BitBuffer
189+
*
199190
* @see \chillerlan\QRCode\Data\QRDataAbstract::writeBitBuffer()
200191
*
201192
* @param string $data
@@ -205,7 +196,7 @@ protected function getMinimumVersion():int{
205196
abstract protected function write(string $data):void;
206197

207198
/**
208-
* writes the string data to the BitBuffer
199+
* creates a BitBuffer and writes the string data to it
209200
*
210201
* @param string $data
211202
*
@@ -262,8 +253,6 @@ protected function writeBitBuffer(string $data):QRDataInterface{
262253
/**
263254
* ECC masking
264255
*
265-
* @see \chillerlan\QRCode\Data\QRDataAbstract::writeBitBuffer()
266-
*
267256
* @link http://www.thonky.com/qr-code-tutorial/error-correction-coding
268257
*
269258
* @return array

src/Data/QRDataInterface.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,19 @@ interface QRDataInterface{
166166
];
167167

168168
/**
169+
* Sets the data string (internally called by the constructor)
170+
*
169171
* @param string $data
170172
*
171173
* @return \chillerlan\QRCode\Data\QRDataInterface
172174
*/
173175
public function setData(string $data):QRDataInterface;
174176

175177
/**
176-
* @param int $maskPattern
177-
* @param bool $test
178+
* returns a fresh matrix object with the data written for the given $maskPattern
179+
*
180+
* @param int $maskPattern
181+
* @param bool|null $test
178182
*
179183
* @return \chillerlan\QRCode\Data\QRMatrix
180184
*/

src/Output/QRImage.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class QRImage extends QROutputAbstract{
4343
protected $image;
4444

4545
/**
46-
* @return void
46+
* @inheritDoc
4747
*/
4848
protected function setModuleValues():void{
4949

@@ -64,9 +64,7 @@ protected function setModuleValues():void{
6464
}
6565

6666
/**
67-
* @param string|null $file
68-
*
69-
* @return string
67+
* @inheritDoc
7068
*/
7169
public function dump(string $file = null):string{
7270
$this->image = imagecreatetruecolor($this->length, $this->length);

src/Output/QRImagick.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class QRImagick extends QROutputAbstract{
2626

2727
/**
28-
* @return void
28+
* @inheritDoc
2929
*/
3030
protected function setModuleValues():void{
3131

@@ -44,9 +44,7 @@ protected function setModuleValues():void{
4444
}
4545

4646
/**
47-
* @param string|null $file
48-
*
49-
* @return string
47+
* @inheritDoc
5048
*/
5149
public function dump(string $file = null):string{
5250
$file = $file ?? $this->options->cachefile;

src/Output/QRMarkup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QRMarkup extends QROutputAbstract{
3434
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">';
3535

3636
/**
37-
* @return void
37+
* @inheritDoc
3838
*/
3939
protected function setModuleValues():void{
4040

src/Output/QROutputAbstract.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ public function __construct(SettingsContainerInterface $options, QRMatrix $matri
9292
abstract protected function setModuleValues():void;
9393

9494
/**
95+
* saves the qr data to a file
96+
*
9597
* @see file_put_contents()
98+
* @see \chillerlan\QRCode\QROptions::cachefile
9699
*
97100
* @param string $data
98101
* @param string $file
@@ -110,11 +113,10 @@ protected function saveToFile(string $data, string $file):bool{
110113
}
111114

112115
/**
113-
* @param string|null $file
114-
*
115-
* @return string|mixed
116+
* @inheritDoc
116117
*/
117118
public function dump(string $file = null){
119+
// call the built-in output method
118120
$data = call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
119121
$file = $file ?? $this->options->cachefile;
120122

src/Output/QROutputInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ interface QROutputInterface{
4242
];
4343

4444
/**
45+
* generates the output, optionally dumps it to a file, and returns it
46+
*
4547
* @param string|null $file
4648
*
4749
* @return mixed

src/Output/QRString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class QRString extends QROutputAbstract{
2727
protected $defaultMode = QRCode::OUTPUT_STRING_TEXT;
2828

2929
/**
30-
* @return void
30+
* @inheritDoc
3131
*/
3232
protected function setModuleValues():void{
3333

src/QRCode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class QRCode{
9191
];
9292

9393
/**
94-
* @var \chillerlan\QRCode\QROptions
94+
* @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface
9595
*/
9696
protected $options;
9797

0 commit comments

Comments
 (0)