PixelateFilter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 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
class PixelateFilter extends AbstractFilter
16
{
17
    private $blockSize;
18
    private $useAdvancedMode;
19
20 1
    public function __construct($blockSize, $useAdvancedMode = false)
21
    {
22 1
        $this->blockSize = $blockSize;
23 1
        $this->useAdvancedMode = $useAdvancedMode;
24 1
    }
25
26 1
    public function render(Image $srcImage)
27
    {
28 1
        imagefilter($srcImage->getResource(), IMG_FILTER_PIXELATE, $this->blockSize, $this->useAdvancedMode);
29
30 1
        return $srcImage->getResource();
31
    }
32
}
33