1616use chillerlan \QRCode \QROptions ;
1717use chillerlan \QRCode \Decoder \QRCodeDecoderException ;
1818use chillerlan \Settings \SettingsContainerInterface ;
19- use function array_slice , array_splice , file_exists , is_file , is_readable , realpath ;
19+ use function array_slice , file_exists , is_file , is_readable , realpath ;
2020
2121/**
2222 * The purpose of this class hierarchy is to abstract different bitmap implementations across
@@ -28,16 +28,14 @@ abstract class LuminanceSourceAbstract implements LuminanceSourceInterface{
2828
2929 protected SettingsContainerInterface |QROptions $ options ;
3030 /** @var int[] */
31- protected array $ luminances ;
31+ protected array $ luminances = [] ;
3232 protected int $ width ;
3333 protected int $ height ;
3434
3535 public function __construct (int $ width , int $ height , SettingsContainerInterface |QROptions $ options = new QROptions ){
3636 $ this ->width = $ width ;
3737 $ this ->height = $ height ;
3838 $ this ->options = $ options ;
39-
40- $ this ->luminances = [];
4139 }
4240
4341 public function getLuminances ():array {
@@ -54,15 +52,11 @@ public function getHeight():int{
5452
5553 public function getRow (int $ y ):array {
5654
57- if ($ y < 0 || $ y >= $ this ->getHeight () ){
55+ if ($ y < 0 || $ y >= $ this ->height ){
5856 throw new QRCodeDecoderException ('Requested row is outside the image: ' .$ y );
5957 }
6058
61- $ arr = [];
62-
63- array_splice ($ arr , 0 , $ this ->width , array_slice ($ this ->luminances , ($ y * $ this ->width ), $ this ->width ));
64-
65- return $ arr ;
59+ return array_slice ($ this ->luminances , ($ y * $ this ->width ), $ this ->width );
6660 }
6761
6862 protected function setLuminancePixel (int $ r , int $ g , int $ b ):void {
0 commit comments