| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\MetadataService\Statement; |
| 6 |
|
| 7 |
use Webauthn\Exception\MetadataStatementLoadingException; |
| 8 |
|
| 9 |
readonly class RgbPaletteEntry |
| 10 |
{ |
| 11 |
public function __construct( |
| 12 |
public int $r, |
| 13 |
public int $g, |
| 14 |
public int $b, |
| 15 |
) { |
| 16 |
($r >= 0 && $r <= 255) || throw MetadataStatementLoadingException::create('The key "r" is invalid'); |
| 17 |
($g >= 0 && $g <= 255) || throw MetadataStatementLoadingException::create('The key "g" is invalid'); |
| 18 |
($b >= 0 && $b <= 255) || throw MetadataStatementLoadingException::create('The key "b" is invalid'); |
| 19 |
} |
| 20 |
|
| 21 |
public static function create(int $r, int $g, int $b): self |
| 22 |
{ |
| 23 |
return new self($r, $g, $b); |
| 24 |
} |
| 25 |
} |