BrightnessFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
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 20
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 6 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\Filter\AbstractFilter;
13
use Kaloa\Image\Image;
14
15
final class BrightnessFilter extends AbstractFilter
16
{
17
    private $level;
18
19
    /**
20
     *
21
     * @param int $level [-255, 255]
22
     */
23 1
    public function __construct($level)
24
    {
25 1
        $this->level = $level;
26 1
    }
27
28 1
    public function render(Image $srcImage)
29
    {
30 1
        imagefilter($srcImage->getResource(), IMG_FILTER_BRIGHTNESS, $this->level);
31
32 1
        return $srcImage->getResource();
33
    }
34
}
35