| Total Complexity | 10 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class HSV extends Color |
||
| 10 | { |
||
| 11 | private $hue; |
||
| 12 | private $saturation; |
||
| 13 | private $value; |
||
| 14 | |||
| 15 | 351 | public function __construct(int $hue, float $saturation, float $value) |
|
| 16 | { |
||
| 17 | 351 | if ($hue < 0 || $hue > 360) { |
|
| 18 | 1 | throw new InvalidArgumentException(sprintf('Given hue value %d is expected to be between %d and %d >> [%2$d,%3$d]', $hue, 0, 360)); |
|
| 19 | } |
||
| 20 | |||
| 21 | 350 | if (((int) floor($saturation)) < 0 || ((int) ceil($saturation)) > 100) { |
|
| 22 | 2 | throw new InvalidArgumentException(sprintf('Given saturation value %f must be between %d and %d >> [%2$d, %3$d]', $saturation, 0, 100)); |
|
| 23 | } |
||
| 24 | |||
| 25 | 348 | if (((int) floor($value)) < 0 || ((int) ceil($value)) > 100) { |
|
| 26 | 2 | throw new InvalidArgumentException(sprintf('Given value value %f must be between %d and %d >> [%2$d, %3$d]', $value, 0, 100)); |
|
| 27 | } |
||
| 28 | |||
| 29 | 346 | $this->hue = $hue; |
|
| 30 | 346 | $this->saturation = $saturation; |
|
| 31 | 346 | $this->value = $value; |
|
| 32 | 346 | } |
|
| 33 | |||
| 34 | 342 | public function getHue(): int |
|
| 37 | } |
||
| 38 | |||
| 39 | 342 | public function getSaturation(): float |
|
| 40 | { |
||
| 41 | 342 | return $this->saturation; |
|
| 42 | } |
||
| 43 | |||
| 44 | 342 | public function getValue(): float |
|
| 47 | } |
||
| 48 | } |
||
| 49 |