| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 131 | public function convert(Color $color): Color |
|
| 15 | { |
||
| 16 | /* @var RGB $color */ |
||
| 17 | 131 | Assert::isInstanceOf($color, RGB::class, sprintf('color should be an instance of [%s]', RGB::class)); |
|
| 18 | |||
| 19 | 130 | $red = dechex($color->getRed()); |
|
| 20 | 130 | $green = dechex($color->getGreen()); |
|
| 21 | 130 | $blue = dechex($color->getBlue()); |
|
| 22 | |||
| 23 | 130 | $red = str_pad($red, 2, '0', STR_PAD_LEFT); |
|
| 24 | 130 | $green = str_pad($green, 2, '0', STR_PAD_LEFT); |
|
| 25 | 130 | $blue = str_pad($blue, 2, '0', STR_PAD_LEFT); |
|
| 26 | |||
| 27 | 130 | return new HEX($red, $green, $blue); |
|
| 28 | } |
||
| 40 |