Crop::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
1
<?php namespace Modules\Media\Image\Intervention\Manipulations;
2
3
use Modules\Media\Image\ImageHandlerInterface;
4
5
class Crop implements ImageHandlerInterface
6
{
7
    private $defaults = [
8
        'width' => '100',
9
        'height' => '100',
10
        'x' => null,
11
        'y' => null,
12
    ];
13
14
    /**
15
     * Handle the image manipulation request
16
     * @param  \Intervention\Image\Image $image
17
     * @param  array                     $options
18
     * @return mixed
19
     */
20
    public function handle($image, $options)
21
    {
22
        $options = array_merge($this->defaults, $options);
23
24
        return $image->crop($options['width'], $options['height'], $options['x'], $options['y']);
25
    }
26
}
27