Code Duplication    Length = 9-10 lines in 2 locations

src/CImage/CImage.php 2 locations

@@ 1663-1671 (lines=9) @@
1660
1661
1662
        // Only use a specified area of the image, $this->offset is defining the area to use
1663
        if (isset($this->offset)) {
1664
1665
            $this->log("Offset for area to use, cropping it width={$this->offset['width']}, height={$this->offset['height']}, start_x={$this->offset['left']}, start_y={$this->offset['top']}");
1666
            $img = $this->CreateImageKeepTransparency($this->offset['width'], $this->offset['height']);
1667
            imagecopy($img, $this->image, 0, 0, $this->offset['left'], $this->offset['top'], $this->offset['width'], $this->offset['height']);
1668
            $this->image = $img;
1669
            $this->width = $this->offset['width'];
1670
            $this->height = $this->offset['height'];
1671
        }
1672
1673
        if ($this->crop) {
1674
@@ 1673-1682 (lines=10) @@
1670
            $this->height = $this->offset['height'];
1671
        }
1672
1673
        if ($this->crop) {
1674
1675
            // Do as crop, take only part of image
1676
            $this->log("Cropping area width={$this->crop['width']}, height={$this->crop['height']}, start_x={$this->crop['start_x']}, start_y={$this->crop['start_y']}");
1677
            $img = $this->CreateImageKeepTransparency($this->crop['width'], $this->crop['height']);
1678
            imagecopy($img, $this->image, 0, 0, $this->crop['start_x'], $this->crop['start_y'], $this->crop['width'], $this->crop['height']);
1679
            $this->image = $img;
1680
            $this->width = $this->crop['width'];
1681
            $this->height = $this->crop['height'];
1682
        }
1683
1684
        if (!$this->upscale) {
1685
            // Consider rewriting the no-upscale code to fit within this if-statement,