Completed
Pull Request — master (#732)
by 12345
03:41
created

RotateFilterLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 17
wmc 3
c 1
b 0
f 1
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 6 3
1
<?php
2
3
namespace Liip\ImagineBundle\Imagine\Filter\Loader;
4
5
use Imagine\Image\ImageInterface;
6
use Imagine\Image\ManipulatorInterface;
7
8
/**
9
 * Loader for Imagine's basic rotate method.
10
 *
11
 * @author Bocharsky Victor <[email protected]>
12
 */
13
class RotateFilterLoader implements LoaderInterface
14
{
15
    /**
16
     * Loads and applies a filter on the given image.
17
     *
18
     * @param ImageInterface $image
19
     * @param array          $options
20
     *
21
     * @return ManipulatorInterface
22
     */
23
    public function load(ImageInterface $image, array $options = array())
24
    {
25
        $angle = isset($options['angle']) ? (int) $options['angle'] : 0;
26
27
        return 0 === $angle ? $image : $image->rotate($angle);
28
    }
29
}
30