| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace TckImageResizer\View\Helper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Zend\View\Helper\AbstractHelper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use TckImageResizer\Util\UrlSafeBase64; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | class Resize extends AbstractHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |     /** @var  array */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |     protected $imgParts; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     /** @var  string*/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     protected $commands; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @param $imgPath | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 | 33 |  |     public function __invoke($imgPath) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 | 33 |  |         $this->imgParts = pathinfo($imgPath); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 | 33 |  |         $this->commands = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 33 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @param $width | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @param $height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 | 3 |  |     public function thumb($width, $height) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 3 |  |         $this->commands .= '$thumb,' . $width . ',' . $height; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @param $width | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * @param $height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @return $this | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 44 | 3 |  |     public function resize($width, $height) | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 46 | 3 |  |         $this->commands .= '$resize,' . $width . ',' . $height; | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |          | 
            
                                                                        
                            
            
                                    
            
            
                | 48 | 3 |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 3 |  |     public function grayscale() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 3 |  |         $this->commands .= '$grayscale'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 3 |  |     public function negative() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 3 |  |         $this->commands .= '$negative'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @param $correction | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 3 |  |     public function gamma($correction) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 3 |  |         $this->commands .= '$gamma,' . $correction; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * @param $hexColor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 3 |  |     public function colorize($hexColor) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 3 |  |         $this->commands .= '$colorize,' . $hexColor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 3 |  |     public function sharpen() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 | 3 |  |         $this->commands .= '$sharpen'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @param null $sigma | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 3 |  |     public function blur($sigma = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 | 3 |  |         $this->commands .= '$blur' . ($sigma !== null ? ',' . $sigma : ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |      * @param null $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      * @param null $backgroundColor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * @param null $color | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * @param null $width | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * @param null $height | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * @return $this | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 3 |  |     public function x404($text = null, $backgroundColor = null, $color = null, $width = null, $height = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 3 |  |         $this->commands .= '$404' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 | 3 |  |                 . ($text !== null ? ',' . UrlSafeBase64::encode($text) : '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 | 3 |  |                 . ($backgroundColor !== null ? ',' . $backgroundColor : '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 | 3 |  |                 . ($color !== null ? ',' . $color : '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 | 3 |  |                 . ($width !== null ? ',' . $width : '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 | 3 |  |                 . ($height !== null ? ',' . $height : ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 | 30 |  |     public function __toString() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 | 30 |  |         return $this->getView()->basePath( | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             'processed/' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 | 30 |  |             . ($this->imgParts['dirname'] && $this->imgParts['dirname'] !== '.' ? $this->imgParts['dirname'] . '/' : '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 30 |  |             . $this->imgParts['filename'] . '.' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 | 30 |  |             . $this->commands . '.' . $this->imgParts['extension'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 | 30 |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 146 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 147 |  |  |  | 
            
                        
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..