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

CropFilterLoader   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
dl 0
loc 16
wmc 1
lcom 0
cbo 3
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
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