BlurCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 3
A __construct() 0 3 1
1
<?php
2
3
namespace Jackal\ImageMerge\Command;
4
5
use Jackal\ImageMerge\Command\Options\LevelCommandOption;
6
use Jackal\ImageMerge\Model\Image;
7
8
/**
9
 * Class BlurCommand
10
 * @package Jackal\ImageMerge\Command
11
 */
12
class BlurCommand extends AbstractCommand
13
{
14
    /**
15
     * BlurCommand constructor.
16
     * @param LevelCommandOption $options
17
     */
18
    public function __construct(LevelCommandOption $options)
19
    {
20
        parent::__construct($options);
21
    }
22
23
    /**
24
     * @param Image $image
25
     * @return Image
26
     */
27
    public function execute(Image $image)
28
    {
29
        if ($this->options->get('level')) {
30
            for ($i = 0; $i < $this->options->get('level'); $i++) {
31
                imagefilter($image->getResource(), IMG_FILTER_GAUSSIAN_BLUR);
32
            }
33
        }
34
35
        return $image;
36
    }
37
}
38