Fit::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

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