Code Duplication    Length = 5-7 lines in 2 locations

src/Elphin/IcoFileLoader/Ico.php 2 locations

@@ 314-320 (lines=7) @@
311
                //we translate the BGRA to aRGB ourselves, which is twice as fast
312
                //as calling imagecolorallocatealpha
313
                $alpha7 = ((~ord($binary[$offset+3])) & 0xff) >> 1;
314
                if ($alpha7 < 127) {
315
                    $col = ($alpha7 << 24) |
316
                        (ord($binary[$offset+2]) << 16) |
317
                        (ord($binary[$offset+1]) << 8) |
318
                        (ord($binary[$offset]));
319
                    imagesetpixel($im, $j, $i, $col);
320
                }
321
                $offset += 4;
322
            }
323
        }
@@ 339-343 (lines=5) @@
336
337
        for ($i = $metadata['Height'] - 1; $i >= 0; --$i) {
338
            for ($j = 0; $j < $metadata['Width']; ++$j) {
339
                if ($maskBits[$bitoffset] == 0) {
340
                    //translate BGR to RGB
341
                    $col = (ord($binary[$offset+2]) << 16) | (ord($binary[$offset+1]) << 8) | (ord($binary[$offset]));
342
                    imagesetpixel($im, $j, $i, $col);
343
                }
344
                $offset += 3;
345
                ++$bitoffset;
346
            }