Skip to content

Commit 6b2a529

Browse files
committed
💄 code style fixes
1 parent abfd69e commit 6b2a529

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+845
-779
lines changed

examples/custom_output.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function dump(string $file = null):string{
7272

7373
// invoke the QROutputInterface manually
7474
$options = new QROptions([
75-
'version' => 5,
76-
'eccLevel' => EccLevel::L,
75+
'version' => 5,
76+
'eccLevel' => EccLevel::L,
7777
]);
7878

7979
$qrcode = new QRCode($options);

examples/eps.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@
2323
'cachefile' => __DIR__.'/test.eps', // save to file
2424
'moduleValues' => [
2525
// finder
26-
QRMatrix::M_FINDER | QRMatrix::IS_DARK => [0, 63, 255], // dark (true)
27-
QRMatrix::M_FINDER => [233, 233, 233], // light (false)
28-
QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => [0, 63, 255], // finder dot, dark (true)
26+
(QRMatrix::M_FINDER | QRMatrix::IS_DARK) => [0, 63, 255], // dark (true)
27+
QRMatrix::M_FINDER => [233, 233, 233], // light (false)
28+
(QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => [0, 63, 255], // finder dot, dark (true)
2929
// alignment
30-
QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => [255, 0, 255],
31-
QRMatrix::M_ALIGNMENT => [233, 233, 233],
30+
(QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => [255, 0, 255],
31+
QRMatrix::M_ALIGNMENT => [233, 233, 233],
3232
// timing
33-
QRMatrix::M_TIMING | QRMatrix::IS_DARK => [255, 0, 0],
34-
QRMatrix::M_TIMING => [233, 233, 233],
33+
(QRMatrix::M_TIMING | QRMatrix::IS_DARK) => [255, 0, 0],
34+
QRMatrix::M_TIMING => [233, 233, 233],
3535
// format
36-
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => [67, 159, 84],
37-
QRMatrix::M_FORMAT => [233, 233, 233],
36+
(QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => [67, 159, 84],
37+
QRMatrix::M_FORMAT => [233, 233, 233],
3838
// version
39-
QRMatrix::M_VERSION | QRMatrix::IS_DARK => [62, 174, 190],
40-
QRMatrix::M_VERSION => [233, 233, 233],
39+
(QRMatrix::M_VERSION | QRMatrix::IS_DARK) => [62, 174, 190],
40+
QRMatrix::M_VERSION => [233, 233, 233],
4141
// data
42-
QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
43-
QRMatrix::M_DATA => [233, 233, 233],
42+
(QRMatrix::M_DATA | QRMatrix::IS_DARK) => [0, 0, 0],
43+
QRMatrix::M_DATA => [233, 233, 233],
4444
// darkmodule
45-
QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => [0, 0, 0],
45+
(QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => [0, 0, 0],
4646
// separator
47-
QRMatrix::M_SEPARATOR => [233, 233, 233],
47+
QRMatrix::M_SEPARATOR => [233, 233, 233],
4848
// quietzone
49-
QRMatrix::M_QUIETZONE => [233, 233, 233],
49+
QRMatrix::M_QUIETZONE => [233, 233, 233],
5050
// logo (requires a call to QRMatrix::setLogoSpace()), see QRImageWithLogo
51-
QRMatrix::M_LOGO => [233, 233, 233],
51+
QRMatrix::M_LOGO => [233, 233, 233],
5252
],
5353
]);
5454

@@ -62,6 +62,3 @@
6262
echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
6363

6464
exit;
65-
66-
67-

examples/fpdf.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@
2222
'imageBase64' => false,
2323
'moduleValues' => [
2424
// finder
25-
QRMatrix::M_FINDER | QRMatrix::IS_DARK => [0, 63, 255], // dark (true)
26-
QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
25+
(QRMatrix::M_FINDER | QRMatrix::IS_DARK) => [0, 63, 255], // dark (true)
26+
QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
2727
// alignment
28-
QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => [255, 0, 255],
29-
QRMatrix::M_ALIGNMENT => [255, 255, 255],
28+
(QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => [255, 0, 255],
29+
QRMatrix::M_ALIGNMENT => [255, 255, 255],
3030
// timing
31-
QRMatrix::M_TIMING | QRMatrix::IS_DARK => [255, 0, 0],
32-
QRMatrix::M_TIMING => [255, 255, 255],
31+
(QRMatrix::M_TIMING | QRMatrix::IS_DARK) => [255, 0, 0],
32+
QRMatrix::M_TIMING => [255, 255, 255],
3333
// format
34-
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => [67, 191, 84],
35-
QRMatrix::M_FORMAT => [255, 255, 255],
34+
(QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => [67, 191, 84],
35+
QRMatrix::M_FORMAT => [255, 255, 255],
3636
// version
37-
QRMatrix::M_VERSION | QRMatrix::IS_DARK => [62, 174, 190],
38-
QRMatrix::M_VERSION => [255, 255, 255],
37+
(QRMatrix::M_VERSION | QRMatrix::IS_DARK) => [62, 174, 190],
38+
QRMatrix::M_VERSION => [255, 255, 255],
3939
// data
40-
QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
41-
QRMatrix::M_DATA => [255, 255, 255],
40+
(QRMatrix::M_DATA | QRMatrix::IS_DARK) => [0, 0, 0],
41+
QRMatrix::M_DATA => [255, 255, 255],
4242
// darkmodule
43-
QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => [0, 0, 0],
43+
(QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => [0, 0, 0],
4444
// separator
45-
QRMatrix::M_SEPARATOR => [255, 255, 255],
45+
QRMatrix::M_SEPARATOR => [255, 255, 255],
4646
// quietzone
47-
QRMatrix::M_QUIETZONE => [255, 255, 255],
47+
QRMatrix::M_QUIETZONE => [255, 255, 255],
4848
],
4949
]);
5050

examples/html.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@
2222
'cssClass' => 'qrcode',
2323
'moduleValues' => [
2424
// finder
25-
QRMatrix::M_FINDER | QRMatrix::IS_DARK => '#A71111', // dark (true)
26-
QRMatrix::M_FINDER => '#FFBFBF', // light (false)
27-
QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => '#A71111', // finder dot, dark (true)
25+
(QRMatrix::M_FINDER | QRMatrix::IS_DARK) => '#A71111', // dark (true)
26+
QRMatrix::M_FINDER => '#FFBFBF', // light (false)
27+
(QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => '#A71111', // finder dot, dark (true)
2828
// alignment
29-
QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => '#A70364',
30-
QRMatrix::M_ALIGNMENT => '#FFC9C9',
29+
(QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => '#A70364',
30+
QRMatrix::M_ALIGNMENT => '#FFC9C9',
3131
// timing
32-
QRMatrix::M_TIMING | QRMatrix::IS_DARK => '#98005D',
33-
QRMatrix::M_TIMING => '#FFB8E9',
32+
(QRMatrix::M_TIMING | QRMatrix::IS_DARK) => '#98005D',
33+
QRMatrix::M_TIMING => '#FFB8E9',
3434
// format
35-
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => '#003804',
36-
QRMatrix::M_FORMAT => '#00FB12',
35+
(QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => '#003804',
36+
QRMatrix::M_FORMAT => '#00FB12',
3737
// version
38-
QRMatrix::M_VERSION | QRMatrix::IS_DARK => '#650098',
39-
QRMatrix::M_VERSION => '#E0B8FF',
38+
(QRMatrix::M_VERSION | QRMatrix::IS_DARK) => '#650098',
39+
QRMatrix::M_VERSION => '#E0B8FF',
4040
// data
41-
QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
42-
QRMatrix::M_DATA => '#ECF9BE',
41+
(QRMatrix::M_DATA | QRMatrix::IS_DARK) => '#4A6000',
42+
QRMatrix::M_DATA => '#ECF9BE',
4343
// darkmodule
44-
QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => '#080063',
44+
(QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => '#080063',
4545
// separator
46-
QRMatrix::M_SEPARATOR => '#AFBFBF',
46+
QRMatrix::M_SEPARATOR => '#AFBFBF',
4747
// quietzone
48-
QRMatrix::M_QUIETZONE => '#DDDDDD',
48+
QRMatrix::M_QUIETZONE => '#DDDDDD',
4949
],
5050
]);
5151

@@ -82,6 +82,3 @@
8282
?>
8383
</body>
8484
</html>
85-
86-
87-

examples/image.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,39 @@
2323
'imageTransparent' => false,
2424
'drawCircularModules' => true,
2525
'circleRadius' => 0.4,
26-
'keepAsSquare' => [QRMatrix::M_FINDER|QRMatrix::IS_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK],
26+
'keepAsSquare' => [
27+
(QRMatrix::M_FINDER|QRMatrix::IS_DARK),
28+
QRMatrix::M_FINDER_DOT,
29+
(QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK),
30+
],
2731
'moduleValues' => [
2832
// finder
29-
QRMatrix::M_FINDER | QRMatrix::IS_DARK => [0, 63, 255], // dark (true)
30-
QRMatrix::M_FINDER => [233, 233, 233], // light (false), white is the transparency color and is enabled by default
31-
QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => [0, 63, 255], // finder dot, dark (true)
33+
(QRMatrix::M_FINDER | QRMatrix::IS_DARK) => [0, 63, 255], // dark (true)
34+
QRMatrix::M_FINDER => [233, 233, 233], // light (false), white is the transparency color and is enabled by default
35+
(QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => [0, 63, 255], // finder dot, dark (true)
3236
// alignment
33-
QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => [255, 0, 255],
34-
QRMatrix::M_ALIGNMENT => [233, 233, 233],
37+
(QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => [255, 0, 255],
38+
QRMatrix::M_ALIGNMENT => [233, 233, 233],
3539
// timing
36-
QRMatrix::M_TIMING | QRMatrix::IS_DARK => [255, 0, 0],
37-
QRMatrix::M_TIMING => [233, 233, 233],
40+
(QRMatrix::M_TIMING | QRMatrix::IS_DARK) => [255, 0, 0],
41+
QRMatrix::M_TIMING => [233, 233, 233],
3842
// format
39-
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => [67, 159, 84],
40-
QRMatrix::M_FORMAT => [233, 233, 233],
43+
(QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => [67, 159, 84],
44+
QRMatrix::M_FORMAT => [233, 233, 233],
4145
// version
42-
QRMatrix::M_VERSION | QRMatrix::IS_DARK => [62, 174, 190],
43-
QRMatrix::M_VERSION => [233, 233, 233],
46+
(QRMatrix::M_VERSION | QRMatrix::IS_DARK) => [62, 174, 190],
47+
QRMatrix::M_VERSION => [233, 233, 233],
4448
// data
45-
QRMatrix::M_DATA | QRMatrix::IS_DARK => [0, 0, 0],
46-
QRMatrix::M_DATA => [233, 233, 233],
49+
(QRMatrix::M_DATA | QRMatrix::IS_DARK) => [0, 0, 0],
50+
QRMatrix::M_DATA => [233, 233, 233],
4751
// darkmodule
48-
QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => [0, 0, 0],
52+
(QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => [0, 0, 0],
4953
// separator
50-
QRMatrix::M_SEPARATOR => [233, 233, 233],
54+
QRMatrix::M_SEPARATOR => [233, 233, 233],
5155
// quietzone
52-
QRMatrix::M_QUIETZONE => [233, 233, 233],
56+
QRMatrix::M_QUIETZONE => [233, 233, 233],
5357
// logo (requires a call to QRMatrix::setLogoSpace()), see QRImageWithLogo
54-
QRMatrix::M_LOGO => [233, 233, 233],
58+
QRMatrix::M_LOGO => [233, 233, 233],
5559
],
5660
]);
5761

examples/imageWithLogo.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function dump(string $file = null, string $logo = null):string{
3232
// set returnResource to true to skip further processing for now
3333
$this->options->returnResource = true;
3434

35-
// of course you could accept other formats too (such as resource or Imagick)
36-
// i'm not checking for the file type either for simplicity reasons (assuming PNG)
35+
// of course, you could accept other formats too (such as resource or Imagick)
36+
// I'm not checking for the file type either for simplicity reasons (assuming PNG)
3737
if(!is_file($logo) || !is_readable($logo)){
3838
throw new QRCodeOutputException('invalid logo');
3939
}
@@ -48,14 +48,14 @@ public function dump(string $file = null, string $logo = null):string{
4848
$h = imagesy($im);
4949

5050
// set new logo size, leave a border of 1 module (no proportional resize/centering)
51-
$lw = ($this->options->logoSpaceWidth - 2) * $this->options->scale;
52-
$lh = ($this->options->logoSpaceHeight - 2) * $this->options->scale;
51+
$lw = (($this->options->logoSpaceWidth - 2) * $this->options->scale);
52+
$lh = (($this->options->logoSpaceHeight - 2) * $this->options->scale);
5353

5454
// get the qrcode size
55-
$ql = $this->matrix->size() * $this->options->scale;
55+
$ql = ($this->matrix->size() * $this->options->scale);
5656

5757
// scale the logo and copy it over. done!
58-
imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h);
58+
imagecopyresampled($this->image, $im, (($ql - $lw) / 2), (($ql - $lh) / 2), 0, 0, $lw, $lh, $w, $h);
5959

6060
$imageData = $this->dumpImage();
6161

examples/imageWithText.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ public function dump(string $file = null, string $text = null):string{
4848
return $imageData;
4949
}
5050

51-
/**
52-
* @inheritDoc
53-
*/
5451
protected function addText(string $text):void{
5552
// save the qrcode image
5653
$qrcode = $this->image;
@@ -61,7 +58,7 @@ protected function addText(string $text):void{
6158
$textColor = [50, 50, 50];
6259

6360
$bgWidth = $this->length;
64-
$bgHeight = $bgWidth + 20; // 20px extra space
61+
$bgHeight = ($bgWidth + 20); // 20px extra space
6562

6663
// create a new image with additional space
6764
$this->image = imagecreatetruecolor($bgWidth, $bgHeight);
@@ -97,10 +94,10 @@ protected function addText(string $text):void{
9794
*/
9895

9996
$options = new QROptions([
100-
'version' => 7,
101-
'outputType' => QROutputInterface::GDIMAGE_PNG,
102-
'scale' => 3,
103-
'imageBase64' => false,
97+
'version' => 7,
98+
'outputType' => QROutputInterface::GDIMAGE_PNG,
99+
'scale' => 3,
100+
'imageBase64' => false,
104101
]);
105102

106103
$qrcode = new QRCode($options);

examples/imagick.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,37 @@
2323
'drawLightModules' => true,
2424
'drawCircularModules' => true,
2525
'circleRadius' => 0.4,
26-
'keepAsSquare' => [QRMatrix::M_FINDER|QRMatrix::IS_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK],
26+
'keepAsSquare' => [
27+
(QRMatrix::M_FINDER|QRMatrix::IS_DARK),
28+
QRMatrix::M_FINDER_DOT,
29+
(QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK),
30+
],
2731
'moduleValues' => [
2832
// finder
29-
QRMatrix::M_FINDER | QRMatrix::IS_DARK => '#A71111', // dark (true)
30-
QRMatrix::M_FINDER => '#FFBFBF', // light (false)
31-
QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => '#A71111', // finder dot, dark (true)
33+
(QRMatrix::M_FINDER | QRMatrix::IS_DARK) => '#A71111', // dark (true)
34+
QRMatrix::M_FINDER => '#FFBFBF', // light (false)
35+
(QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK) => '#A71111', // finder dot, dark (true)
3236
// alignment
33-
QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => '#A70364',
34-
QRMatrix::M_ALIGNMENT => '#FFC9C9',
37+
(QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK) => '#A70364',
38+
QRMatrix::M_ALIGNMENT => '#FFC9C9',
3539
// timing
36-
QRMatrix::M_TIMING | QRMatrix::IS_DARK => '#98005D',
37-
QRMatrix::M_TIMING => '#FFB8E9',
40+
(QRMatrix::M_TIMING | QRMatrix::IS_DARK) => '#98005D',
41+
QRMatrix::M_TIMING => '#FFB8E9',
3842
// format
39-
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => '#003804',
40-
QRMatrix::M_FORMAT => '#CCFB12',
43+
(QRMatrix::M_FORMAT | QRMatrix::IS_DARK) => '#003804',
44+
QRMatrix::M_FORMAT => '#CCFB12',
4145
// version
42-
QRMatrix::M_VERSION | QRMatrix::IS_DARK => '#650098',
43-
QRMatrix::M_VERSION => '#E0B8FF',
46+
(QRMatrix::M_VERSION | QRMatrix::IS_DARK) => '#650098',
47+
QRMatrix::M_VERSION => '#E0B8FF',
4448
// data
45-
QRMatrix::M_DATA | QRMatrix::IS_DARK => '#4A6000',
46-
QRMatrix::M_DATA => '#ECF9BE',
49+
(QRMatrix::M_DATA | QRMatrix::IS_DARK) => '#4A6000',
50+
QRMatrix::M_DATA => '#ECF9BE',
4751
// darkmodule
48-
QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => '#080063',
52+
(QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK) => '#080063',
4953
// separator
50-
QRMatrix::M_SEPARATOR => '#DDDDDD',
54+
QRMatrix::M_SEPARATOR => '#DDDDDD',
5155
// quietzone
52-
QRMatrix::M_QUIETZONE => '#DDDDDD',
56+
QRMatrix::M_QUIETZONE => '#DDDDDD',
5357
],
5458
]);
5559

examples/imagickWithLogo.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ public function dump(string $file = null):string{
3535
parent::dump($file);
3636

3737
// set new logo size, leave a border of 1 module (no proportional resize/centering)
38-
$size = ($this->options->logoSpaceWidth - 2) * $this->options->scale;
38+
$size = (($this->options->logoSpaceWidth - 2) * $this->options->scale);
3939

4040
// logo position: the top left corner of the logo space
41-
$pos = ($this->moduleCount * $this->options->scale - $size) / 2;
41+
$pos = (($this->moduleCount * $this->options->scale - $size) / 2);
4242

4343
// invoke logo instance
4444
$imLogo = new Imagick($this->options->pngLogo);
@@ -72,7 +72,7 @@ class ImagickWithLogoOptions extends QROptions{
7272
/**
7373
* check logo
7474
*
75-
* of course we could accept other formats too.
75+
* of course, we could accept other formats too.
7676
* we're not checking for the file type either for simplicity reasons (assuming PNG)
7777
*/
7878
protected function set_pngLogo(string $pngLogo):void{
@@ -109,7 +109,11 @@ protected function set_pngLogo(string $pngLogo):void{
109109
'drawLightModules' => false,
110110
'drawCircularModules' => true,
111111
'circleRadius' => 0.4,
112-
'keepAsSquare' => [QRMatrix::M_FINDER|QRMatrix::IS_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK],
112+
'keepAsSquare' => [
113+
(QRMatrix::M_FINDER|QRMatrix::IS_DARK),
114+
QRMatrix::M_FINDER_DOT,
115+
(QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK),
116+
],
113117
]);
114118

115119

0 commit comments

Comments
 (0)