Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| LanguageExtlang | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| requiresActive | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOptions | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\IanaValueObjects\LanguageTag; |
| 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 extlangs registered in the IANA Language Subtag Registry. |
| 10 | * |
| 11 | * @see https://www.iana.org/assignments/language-subtag-registry |
| 12 | * |
| 13 | * Any language extlang that is not active anymore can be used as well (for data integrity). |
| 14 | */ |
| 15 | final class LanguageExtlang implements StringValueObjectInterface, LimitedOptionsInterface |
| 16 | { |
| 17 | use IsLanguageSubtag; |
| 18 | |
| 19 | protected static function requiresActive(): bool |
| 20 | { |
| 21 | return false; |
| 22 | } |
| 23 | |
| 24 | protected static function getData(): array |
| 25 | { |
| 26 | return require __DIR__ . '/../../fixtures/language-extlangs.php'; |
| 27 | } |
| 28 | |
| 29 | public static function getOptions(): StringSet |
| 30 | { |
| 31 | return new StringSet(array_keys(static::getData())); |
| 32 | } |
| 33 | } |