| @@ 20-28 (lines=9) @@ | ||
| 17 | $this->lightness = $lightness; |
|
| 18 | } |
|
| 19 | ||
| 20 | public static function fromString(string $string) |
|
| 21 | { |
|
| 22 | Validate::hslColorString($string); |
|
| 23 | ||
| 24 | $matches = null; |
|
| 25 | preg_match('/hsl\( *(-?\d{1,3}) *, *(\d{1,3})%? *, *(\d{1,3})%? *\)/i', $string, $matches); |
|
| 26 | ||
| 27 | return new static($matches[1], $matches[2], $matches[3]); |
|
| 28 | } |
|
| 29 | ||
| 30 | public function hue(): float |
|
| 31 | { |
|
| @@ 22-30 (lines=9) @@ | ||
| 19 | $this->alpha = $alpha; |
|
| 20 | } |
|
| 21 | ||
| 22 | public static function fromString(string $string) |
|
| 23 | { |
|
| 24 | Validate::hslaColorString($string); |
|
| 25 | ||
| 26 | $matches = null; |
|
| 27 | preg_match('/hsla\( *(\d{1,3}) *, *(\d{1,3})%? *, *(\d{1,3})%? *, *([0-1](\.\d{1,2})?) *\)/i', $string, $matches); |
|
| 28 | ||
| 29 | return new static($matches[1], $matches[2], $matches[3], $matches[4]); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function hue(): float |
|
| 33 | { |
|