LimitColors   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 1
lcom 1
cbo 1
dl 20
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php namespace Modules\Media\Image\Intervention\Manipulations;
2
3
use Modules\Media\Image\ImageHandlerInterface;
4
5 View Code Duplication
class LimitColors implements ImageHandlerInterface
6
{
7
    private $defaults = [
8
        'count' => 255,
9
        'matte' => null,
10
    ];
11
12
    /**
13
     * Handle the image manipulation request
14
     * @param  \Intervention\Image\Image $image
15
     * @param  array                     $options
16
     * @return \Intervention\Image\Image
17
     */
18
    public function handle($image, $options)
19
    {
20
        $options = array_merge($this->defaults, $options);
21
22
        return $image->limitColors($options['count'], $options['matte']);
23
    }
24
}
25