Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| CodeListInfo | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| iriOf | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| hasCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Vocabulary; |
| 6 | |
| 7 | final readonly class CodeListInfo |
| 8 | { |
| 9 | /** |
| 10 | * @param array<string, string> $codes code => version that introduced it |
| 11 | */ |
| 12 | public function __construct( |
| 13 | public string $iri, |
| 14 | public string $name, |
| 15 | public bool $open, |
| 16 | public string $since, |
| 17 | public array $codes, |
| 18 | ) {} |
| 19 | |
| 20 | public function iriOf(string $code): string |
| 21 | { |
| 22 | return $this->iri . '#' . $code; |
| 23 | } |
| 24 | |
| 25 | public function hasCode(string $code): bool |
| 26 | { |
| 27 | return isset($this->codes[$code]); |
| 28 | } |
| 29 | } |