Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
23 | 9 | public static function getColors(Config $config): array |
|
24 | { |
||
25 | 9 | if ($config->imageColors() === null) { |
|
26 | 3 | return self::getEvenlyDistributedColors($config->imageHue(), $config->states()); |
|
27 | } |
||
28 | |||
29 | 6 | $colors = $config->imageColors(); |
|
30 | |||
31 | 6 | if (count($colors) !== $config->states()) { |
|
32 | 3 | throw new InvalidColorsException("Not enough colors specified."); |
|
33 | } |
||
34 | |||
35 | 3 | return $colors; |
|
36 | } |
||
56 |