Skip to content

Commit cae3a63

Browse files
committed
:octocat: deprecate parameter $transform of QROutputAbstract::collectModules()
1 parent 390393e commit cae3a63

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Output/QROutputAbstract.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ protected function saveToFile(string $data, ?string $file = null):void{
225225
* $y - current row
226226
* $M_TYPE - field value
227227
* $M_TYPE_LAYER - (possibly modified) field value that acts as layer id
228+
*
229+
* @deprecated 5.0.5 The parameter $transform will be removed in the next major version
230+
* in favor of a concrete method QROutputAbstract::moduleTransform()
231+
* @see \chillerlan\QRCode\Output\QROutputAbstract::moduleTransform()
228232
*/
229233
protected function collectModules(Closure $transform):array{
230234
$paths = [];
@@ -258,4 +262,22 @@ protected function collectModules(Closure $transform):array{
258262
return $paths;
259263
}
260264

265+
/**
266+
* The transform callback for the module collector
267+
*
268+
* $x - current column
269+
* $y - current row
270+
* $M_TYPE - field value
271+
* $M_TYPE_LAYER - (possibly modified) field value that acts as layer id ($paths array key)
272+
*
273+
* This method should return a value suitable for the current output class.
274+
* It must return `null` for an empty value.
275+
*
276+
* @see \chillerlan\QRCode\Output\QROutputAbstract::collectModules()
277+
* @return mixed|null
278+
*/
279+
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER){
280+
return null;
281+
}
282+
261283
}

0 commit comments

Comments
 (0)