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

RotateFilterLoader::load()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 3
eloc 3
nc 4
nop 2
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