Completed
Push — refactor ( dbf3dc...4a4a60 )
by Paul
02:05
created
src/Elphin/IcoFileLoader/Ico.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
         /*
106 106
          * Extract aditional headers for each extracted icon header
107 107
          **/
108
-        $formatCount=count($this->formats);
108
+        $formatCount = count($this->formats);
109 109
         for ($i = 0; $i < $formatCount; ++$i) {
110 110
             $icodata = unpack(
111
-                'LSize/LWidth/LHeight/SPlanes/SBitCount/LCompression/LImageSize/'.
111
+                'LSize/LWidth/LHeight/SPlanes/SBitCount/LCompression/LImageSize/' .
112 112
                 'LXpixelsPerM/LYpixelsPerM/LColorsUsed/LColorsImportant',
113 113
                 substr($data, $this->formats[$i]['FileOffset'])
114 114
             );
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
     public function setBackground($red = 255, $green = 255, $blue = 255)
232 232
     {
233 233
         if (is_string($red) && preg_match('/^\#[0-9a-f]{6}$/', $red)) {
234
-            $green = hexdec($red[3].$red[4]);
235
-            $blue = hexdec($red[5].$red[6]);
236
-            $red = hexdec($red[1].$red[2]);
234
+            $green = hexdec($red[3] . $red[4]);
235
+            $blue = hexdec($red[5] . $red[6]);
236
+            $red = hexdec($red[1] . $red[2]);
237 237
         }
238 238
 
239 239
         $this->bgcolor = [$red, $green, $blue];
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
         }
276 276
 
277 277
         //we may build a string of 1/0 to represent the XOR mask
278
-        $maskBits='';
278
+        $maskBits = '';
279 279
         //we may build a palette for 8 bit images
280
-        $palette=[];
280
+        $palette = [];
281 281
 
282 282
         // allocate palette and get XOR image
283 283
         if (in_array($this->formats[$index]['BitCount'], [1, 4, 8, 24])) {
@@ -381,17 +381,17 @@  discard block
 block discarded – undo
381 381
                 $offset = 0;
382 382
                 $maskoffset = 0;
383 383
                 for ($i = $this->formats[$index]['Height'] - 1; $i >= 0; --$i) {
384
-                    for ($j = 0; $j < $this->formats[$index]['Width']; $j+=2) {
384
+                    for ($j = 0; $j < $this->formats[$index]['Width']; $j += 2) {
385 385
                         $colorByte = ord($this->formats[$index]['data'][$offset]);
386
-                        $lowNibble=$colorByte&0x0f;
387
-                        $highNibble=($colorByte&0xf0) >> 4;
386
+                        $lowNibble = $colorByte & 0x0f;
387
+                        $highNibble = ($colorByte & 0xf0) >> 4;
388 388
 
389 389
                         if ($maskBits[$maskoffset++] == 0) {
390 390
                             imagesetpixel($im, $j, $i, $palette[$highNibble]);
391 391
                         }
392 392
 
393 393
                         if ($maskBits[$maskoffset++] == 0) {
394
-                            imagesetpixel($im, $j+1, $i, $palette[$lowNibble]);
394
+                            imagesetpixel($im, $j + 1, $i, $palette[$lowNibble]);
395 395
                         }
396 396
                         $offset++;
397 397
                     }
Please login to merge, or discard this patch.