Completed
Pull Request — master (#41)
by
unknown
02:46
created

Watermark   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 1
cbo 1
dl 22
loc 22
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 Watermark implements ImageHandlerInterface
6
{
7
    private $defaults = [
8
        'source' => 'public/assets/watermark.png',
9
        'position' => 'bottom-right',
10
        'x' => null,
11
        'y' => null,
12
    ];
13
14
    /**
15
     * Handle the image manipulation request
16
     * @param  \Intervention\Image\Image $image
17
     * @param  array                     $options
18
     * @return \Intervention\Image\Image
19
     */
20
    public function handle($image, $options)
21
    {
22
        $options = array_merge($this->defaults, $options);
23
24
        return $image->insert($options['source'], $options['position'], $options['x'], $options['y']);
25
    }
26
}
27