Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
18 | 3 | public function run(Image $image) |
|
19 | { |
||
20 | 3 | if (is_null($this->bg)) { |
|
21 | 3 | return; |
|
22 | } |
||
23 | |||
24 | 3 | $color = (new Color($this->bg))->formatted(); |
|
25 | |||
26 | 3 | if ($color) { |
|
27 | 3 | $new = $image->getDriver()->newImage($image->width(), $image->height(), $color); |
|
28 | 3 | $new->mime = $image->mime; |
|
29 | 3 | $image = $new->insert($image, 'top-left', 0, 0); |
|
30 | 2 | } |
|
31 | |||
32 | 3 | return $image; |
|
33 | } |
||
34 | } |
||
35 |