Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| PropertyInfo | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isDeprecated | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| acceptsAnyDomain | |
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 PropertyInfo |
| 8 | { |
| 9 | /** Domain marker meaning "usable on any class". */ |
| 10 | public const string ANY_DOMAIN = '*'; |
| 11 | |
| 12 | /** |
| 13 | * @param list<string> $ranges IRIs (classes, code lists or XSD datatypes) |
| 14 | * @param list<string> $domains class IRIs, or [ANY_DOMAIN] |
| 15 | */ |
| 16 | public function __construct( |
| 17 | public string $iri, |
| 18 | public string $name, |
| 19 | public PropertyKind $kind, |
| 20 | public array $ranges, |
| 21 | public array $domains, |
| 22 | public string $since, |
| 23 | public ?string $deprecatedIn, |
| 24 | public ?string $removedIn, |
| 25 | ) {} |
| 26 | |
| 27 | public function isDeprecated(): bool |
| 28 | { |
| 29 | return $this->deprecatedIn !== null || $this->removedIn !== null; |
| 30 | } |
| 31 | |
| 32 | public function acceptsAnyDomain(): bool |
| 33 | { |
| 34 | return \in_array(self::ANY_DOMAIN, $this->domains, true); |
| 35 | } |
| 36 | } |