Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
7.14% |
1 / 14 |
|
11.11% |
1 / 9 |
CRAP | |
0.00% |
0 / 1 |
| IsUriScheme | |
7.14% |
1 / 14 |
|
11.11% |
1 / 9 |
195.15 | |
0.00% |
0 / 1 |
| getData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTemplate | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getDescription | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getStatus | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCriSchemeNumber | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getWellKnownUriSupport | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
12 | |||
| getReference | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| getNotes | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| isActive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\IanaValueObjects\UriScheme; |
| 3 | |
| 4 | use Apie\Core\ValueObjects\NonEmptyString; |
| 5 | use Apie\Core\ValueObjects\Utils; |
| 6 | use Apie\IanaValueObjects\StaticDataValueObject; |
| 7 | |
| 8 | trait IsUriScheme |
| 9 | { |
| 10 | use StaticDataValueObject; |
| 11 | |
| 12 | protected static function getData(): array |
| 13 | { |
| 14 | return require __DIR__ . '/../../fixtures/uri-schemes.php'; |
| 15 | } |
| 16 | |
| 17 | public function getTemplate(): ?NonEmptyString |
| 18 | { |
| 19 | $template = $this->getFieldValue('Template'); |
| 20 | return $template ? NonEmptyString::fromNative($template) : null; |
| 21 | } |
| 22 | |
| 23 | public function getDescription(): ?NonEmptyString |
| 24 | { |
| 25 | $template = $this->getFieldValue('Template'); |
| 26 | return $template ? NonEmptyString::fromNative($template) : null; |
| 27 | } |
| 28 | |
| 29 | public function getStatus() |
| 30 | { |
| 31 | return $this->getFieldValue('Status'); |
| 32 | } |
| 33 | |
| 34 | public function getCriSchemeNumber(): int |
| 35 | { |
| 36 | return Utils::toInt($this->getFieldValue('CRI Scheme Number')); |
| 37 | } |
| 38 | |
| 39 | public function getWellKnownUriSupport(): ?NonEmptyString |
| 40 | { |
| 41 | $value = $this->getFieldValue('Well-Known URI Support'); |
| 42 | return (!$value || $value ==='-') ? null : NonEmptyString::fromNative($value); |
| 43 | } |
| 44 | |
| 45 | public function getReference(): ?NonEmptyString |
| 46 | { |
| 47 | $template = $this->getFieldValue('Reference'); |
| 48 | return $template ? NonEmptyString::fromNative($template) : null; |
| 49 | } |
| 50 | |
| 51 | public function getNotes(): ?NonEmptyString |
| 52 | { |
| 53 | $template = $this->getFieldValue('Notes'); |
| 54 | return $template ? NonEmptyString::fromNative($template) : null; |
| 55 | } |
| 56 | |
| 57 | public function isActive(): bool |
| 58 | { |
| 59 | return (bool) $this->getFieldValue('Active'); |
| 60 | } |
| 61 | } |