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