Completed
Push — master ( 0a7932...aee286 )
by Maksim
13s
created

CropFilterLoader::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
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
        list($x, $y) = $options['start'];
18
        list($width, $height) = $options['size'];
19
20
        $filter = new Crop(new Point($x, $y), new Box($width, $height));
21
        $image = $filter->apply($image);
22
23
        return $image;
24
    }
25
}
26