Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| ActiveLanguageRegion | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
3.33 | |
0.00% |
0 / 1 |
| requiresActive | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOptions | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\IanaValueObjects; |
| 3 | |
| 4 | use Apie\Core\Lists\StringSet; |
| 5 | use Apie\Core\ValueObjects\Interfaces\LimitedOptionsInterface; |
| 6 | use Apie\Core\ValueObjects\Interfaces\StringValueObjectInterface; |
| 7 | |
| 8 | /** |
| 9 | * All language regions registered in the IANA Language Subtag Registry. |
| 10 | * |
| 11 | * Only active language regions can be used. |
| 12 | */ |
| 13 | final class ActiveLanguageRegion implements StringValueObjectInterface, LimitedOptionsInterface |
| 14 | { |
| 15 | use IsLanguageSubtag; |
| 16 | |
| 17 | protected static function requiresActive(): bool |
| 18 | { |
| 19 | return true; |
| 20 | } |
| 21 | |
| 22 | protected static function getData(): array |
| 23 | { |
| 24 | return require __DIR__ . '/../fixtures/language-regions.php'; |
| 25 | } |
| 26 | |
| 27 | public static function getOptions(): StringSet |
| 28 | { |
| 29 | return new StringSet(array_keys(static::getActiveData())); |
| 30 | } |
| 31 | } |