RotateFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
c 2
b 0
f 2
lcom 1
cbo 2
dl 0
loc 25
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A render() 0 11 1
1
<?php
2
3
/*
4
 * This file is part of the kaloa/image package.
5
 *
6
 * For full copyright and license information, please view the LICENSE file
7
 * that was distributed with this source code.
8
 */
9
10
namespace Kaloa\Image\Filter;
11
12
use Kaloa\Image\Image;
13
14
final class RotateFilter extends AbstractFilter
15
{
16
    private $angle;
17
    private $backgroundColor;
18
    private $ignoreTransparent;
19
20 1
    public function __construct($angle, $backgroundColor, $ignoreTransparent = 0)
21
    {
22 1
        $this->angle             = $angle;
23 1
        $this->backgroundColor   = $backgroundColor;
24 1
        $this->ignoreTransparent = $ignoreTransparent;
25 1
    }
26
27 1
    public function render(Image $srcImage)
28
    {
29 1
        $newResource = imagerotate(
30 1
            $srcImage->getResource(),
31 1
            $this->angle,
32 1
            $this->backgroundColor,
33 1
            $this->ignoreTransparent
34 1
        );
35
36 1
        return $newResource;
37
    }
38
}
39