Background   A
last analyzed

Coupling/Cohesion

Components 1
Dependencies 4

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 76.92%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 24
ccs 10
cts 13
cp 0.7692
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 16 3
1
<?php
2
3
namespace League\Glide\Manipulators;
4
5
use Intervention\Image\Image;
6
use League\Glide\Manipulators\Helpers\Color;
7
8
/**
9
 * @property string $bg
10
 */
11
class Background extends BaseManipulator
12
{
13
    /**
14
     * Perform blur image manipulation.
15
     * @param  Image $image The source image.
16
     * @return Image The manipulated image.
17
     */
18 1
    public function run(Image $image)
19
    {
20 1
        if (is_null($this->bg)) {
21 1
            return $image;
22
        }
23
24 1
        $color = (new Color($this->bg))->formatted();
25
26 1
        if ($color) {
27 1
            $new = $image->getDriver()->newImage($image->width(), $image->height(), $color);
28 1
            $new->mime = $image->mime;
29 1
            $image = $new->insert($image, 'top-left', 0, 0);
30 1
        }
31
32 1
        return $image;
33
    }
34
}
35