Skip to content

Commit a4ae0e9

Browse files
committed
:octocat: rename QROutputAbstract::getModuleValue() to prepareModuleValue() to better reflect what it does
1 parent 6b9f6f8 commit a4ae0e9

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

examples/custom_output.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public static function moduleValueIsValid($value):bool{
3131
/**
3232
* @inheritDoc
3333
*/
34-
protected function getModuleValue($value){
35-
// TODO: Implement getModuleValue() method. (abstract)
34+
protected function prepareModuleValue($value){
35+
// TODO: Implement prepareModuleValue() method. (abstract)
3636
return null;
3737
}
3838

src/Output/QREps.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function moduleValueIsValid($value):bool{
5252
*
5353
* @inheritDoc
5454
*/
55-
protected function getModuleValue($value):array{
55+
protected function prepareModuleValue($value):array{
5656
$values = [];
5757

5858
foreach(array_values($value) as $i => $val){

src/Output/QRFpdf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function moduleValueIsValid($value):bool{
7474
*
7575
* @inheritDoc
7676
*/
77-
protected function getModuleValue($value):array{
77+
protected function prepareModuleValue($value):array{
7878
$values = [];
7979

8080
foreach(array_values($value) as $i => $val){
@@ -107,7 +107,7 @@ public function dump(string $file = null){
107107
$fpdf->AddPage();
108108

109109
if($this::moduleValueIsValid($this->options->bgColor)){
110-
$bgColor = $this->getModuleValue($this->options->bgColor);
110+
$bgColor = $this->prepareModuleValue($this->options->bgColor);
111111
/** @phan-suppress-next-line PhanParamTooFewUnpack */
112112
$fpdf->SetFillColor(...$bgColor);
113113
$fpdf->Rect(0, 0, $this->length, $this->length, 'F');

src/Output/QRGdImage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static function moduleValueIsValid($value):bool{
110110
* @inheritDoc
111111
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
112112
*/
113-
protected function getModuleValue($value):int{
113+
protected function prepareModuleValue($value):int{
114114
$values = [];
115115

116116
foreach(array_values($value) as $i => $val){
@@ -136,7 +136,7 @@ protected function getModuleValue($value):int{
136136
* @inheritDoc
137137
*/
138138
protected function getDefaultModuleValue(bool $isDark):int{
139-
return $this->getModuleValue(($isDark) ? [0, 0, 0] : [255, 255, 255]);
139+
return $this->prepareModuleValue(($isDark) ? [0, 0, 0] : [255, 255, 255]);
140140
}
141141

142142
/**
@@ -199,12 +199,12 @@ protected function setBgColor():void{
199199
}
200200

201201
if($this::moduleValueIsValid($this->options->bgColor)){
202-
$this->background = $this->getModuleValue($this->options->bgColor);
202+
$this->background = $this->prepareModuleValue($this->options->bgColor);
203203

204204
return;
205205
}
206206

207-
$this->background = $this->getModuleValue([255, 255, 255]);
207+
$this->background = $this->prepareModuleValue([255, 255, 255]);
208208
}
209209

210210
/**
@@ -219,7 +219,7 @@ protected function setTransparencyColor():void{
219219
$transparencyColor = $this->background;
220220

221221
if($this::moduleValueIsValid($this->options->transparencyColor)){
222-
$transparencyColor = $this->getModuleValue($this->options->transparencyColor);
222+
$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);
223223
}
224224

225225
imagecolortransparent($this->image, $transparencyColor);

src/Output/QRImagick.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ public static function moduleValueIsValid($value):bool{
9999
* @inheritDoc
100100
* @throws \ImagickPixelException
101101
*/
102-
protected function getModuleValue($value):ImagickPixel{
102+
protected function prepareModuleValue($value):ImagickPixel{
103103
return new ImagickPixel($value);
104104
}
105105

106106
/**
107107
* @inheritDoc
108108
*/
109109
protected function getDefaultModuleValue(bool $isDark):ImagickPixel{
110-
return $this->getModuleValue(($isDark) ? $this->options->markupDark : $this->options->markupLight);
110+
return $this->prepareModuleValue(($isDark) ? $this->options->markupDark : $this->options->markupLight);
111111
}
112112

113113
/**
@@ -153,12 +153,12 @@ protected function setBgColor():void{
153153
}
154154

155155
if($this::moduleValueIsValid($this->options->bgColor)){
156-
$this->background = $this->getModuleValue($this->options->bgColor);
156+
$this->background = $this->prepareModuleValue($this->options->bgColor);
157157

158158
return;
159159
}
160160

161-
$this->background = $this->getModuleValue('white');
161+
$this->background = $this->prepareModuleValue('white');
162162
}
163163

164164
/**
@@ -173,7 +173,7 @@ protected function setTransparencyColor():void{
173173
$transparencyColor = $this->background;
174174

175175
if($this::moduleValueIsValid($this->options->transparencyColor)){
176-
$transparencyColor = $this->getModuleValue($this->options->transparencyColor);
176+
$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);
177177
}
178178

179179
$this->imagick->transparentPaintImage($transparencyColor, 0.0, 10, false);

src/Output/QRMarkup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function moduleValueIsValid($value):bool{
5757
/**
5858
* @inheritDoc
5959
*/
60-
protected function getModuleValue($value):string{
60+
protected function prepareModuleValue($value):string{
6161
return trim(strip_tags($value), " '\"\r\n\t");
6262
}
6363

src/Output/QROutputAbstract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function setModuleValues():void{
8585
$value = ($this->options->moduleValues[$M_TYPE] ?? null);
8686

8787
$this->moduleValues[$M_TYPE] = $this::moduleValueIsValid($value)
88-
? $this->getModuleValue($value)
88+
? $this->prepareModuleValue($value)
8989
: $this->getDefaultModuleValue($defaultValue);
9090
}
9191

@@ -98,7 +98,7 @@ protected function setModuleValues():void{
9898
*
9999
* @return mixed
100100
*/
101-
abstract protected function getModuleValue($value);
101+
abstract protected function prepareModuleValue($value);
102102

103103
/**
104104
* Returns a default value for either dark or light modules (return value depends on the output module)

src/Output/QRString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static function moduleValueIsValid($value):bool{
3030
/**
3131
* @inheritDoc
3232
*/
33-
protected function getModuleValue($value):string{
33+
protected function prepareModuleValue($value):string{
3434
return $value;
3535
}
3636

0 commit comments

Comments
 (0)