Completed
Push — master ( c2562a...15ecc0 )
by Lukas Kahwe
09:33 queued 06:51
created

CropFilterLoader   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B load() 0 13 5
1
<?php
2
3
namespace Liip\ImagineBundle\Imagine\Filter\Loader;
4
5
use Imagine\Filter\Basic\Crop;
6
use Imagine\Image\Box;
7
use Imagine\Image\Point;
8
use Imagine\Image\ImageInterface;
9
10
class CropFilterLoader implements LoaderInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function load(ImageInterface $image, array $options = array())
16
    {
17
        $x = isset($options['start'][0]) ? $options['start'][0] : null;
18
        $y = isset($options['start'][1]) ? $options['start'][1] : null;
19
20
        $width = isset($options['size'][0]) ? $options['size'][0] : null;
21
        $height = isset($options['size'][1]) ? $options['size'][1] : null;
22
23
        $filter = new Crop(new Point($x, $y), new Box($width, $height));
24
        $image = $filter->apply($image);
25
26
        return $image;
27
    }
28
}
29