:octocat: deprecate parameter $transform of QROutputAbstract::collectModules()

This commit is contained in:
smiley
2025-10-09 23:10:37 +02:00
parent 390393e97a
commit cae3a63e6f
+22
View File
@@ -225,6 +225,10 @@ abstract class QROutputAbstract implements QROutputInterface{
* $y - current row
* $M_TYPE - field value
* $M_TYPE_LAYER - (possibly modified) field value that acts as layer id
*
* @deprecated 5.0.5 The parameter $transform will be removed in the next major version
* in favor of a concrete method QROutputAbstract::moduleTransform()
* @see \chillerlan\QRCode\Output\QROutputAbstract::moduleTransform()
*/
protected function collectModules(Closure $transform):array{
$paths = [];
@@ -258,4 +262,22 @@ abstract class QROutputAbstract implements QROutputInterface{
return $paths;
}
/**
* The transform callback for the module collector
*
* $x - current column
* $y - current row
* $M_TYPE - field value
* $M_TYPE_LAYER - (possibly modified) field value that acts as layer id ($paths array key)
*
* This method should return a value suitable for the current output class.
* It must return `null` for an empty value.
*
* @see \chillerlan\QRCode\Output\QROutputAbstract::collectModules()
* @return mixed|null
*/
protected function moduleTransform(int $x, int $y, int $M_TYPE, int $M_TYPE_LAYER){
return null;
}
}