| @@ 10-19 (lines=10) @@ | ||
| 7 | /** @var int */ |
|
| 8 | protected $red, $green, $blue; |
|
| 9 | ||
| 10 | public function __construct(int $red, int $green, int $blue) |
|
| 11 | { |
|
| 12 | Validate::rgbChannelValue($red, 'red'); |
|
| 13 | Validate::rgbChannelValue($green, 'green'); |
|
| 14 | Validate::rgbChannelValue($blue, 'blue'); |
|
| 15 | ||
| 16 | $this->red = $red; |
|
| 17 | $this->green = $green; |
|
| 18 | $this->blue = $blue; |
|
| 19 | } |
|
| 20 | ||
| 21 | public static function fromString(string $string) |
|
| 22 | { |
|
| @@ 13-24 (lines=12) @@ | ||
| 10 | /** @var float */ |
|
| 11 | protected $alpha; |
|
| 12 | ||
| 13 | public function __construct(int $red, int $green, int $blue, float $alpha) |
|
| 14 | { |
|
| 15 | Validate::rgbChannelValue($red, 'red'); |
|
| 16 | Validate::rgbChannelValue($green, 'green'); |
|
| 17 | Validate::rgbChannelValue($blue, 'blue'); |
|
| 18 | Validate::alphaChannelValue($alpha); |
|
| 19 | ||
| 20 | $this->red = $red; |
|
| 21 | $this->green = $green; |
|
| 22 | $this->blue = $blue; |
|
| 23 | $this->alpha = $alpha; |
|
| 24 | } |
|
| 25 | ||
| 26 | public static function fromString(string $string) |
|
| 27 | { |
|