Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| HttpStatus | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| requiresActive | |
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\HttpStatus; |
| 3 | |
| 4 | use Apie\Core\Lists\StringSet; |
| 5 | use Apie\Core\ValueObjects\Interfaces\LimitedOptionsInterface; |
| 6 | use Apie\Core\ValueObjects\Interfaces\StringValueObjectInterface; |
| 7 | use Apie\IanaValueObjects\StaticDataValueObject; |
| 8 | |
| 9 | /** |
| 10 | * All HTTP status codes registered in the IANA HTTP Status Codes Registry. |
| 11 | * |
| 12 | * @see https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
| 13 | * |
| 14 | * Any HTTP status code that is not active/valid anymore (e.g. obsolete) can be used as well (for data integrity). |
| 15 | */ |
| 16 | final class HttpStatus implements StringValueObjectInterface, LimitedOptionsInterface |
| 17 | { |
| 18 | use IsHttpStatus; |
| 19 | use StaticDataValueObject; |
| 20 | |
| 21 | protected static function requiresActive(): bool |
| 22 | { |
| 23 | return false; |
| 24 | } |
| 25 | |
| 26 | public static function getOptions(): StringSet |
| 27 | { |
| 28 | return new StringSet(array_map('strval', array_keys(static::getData()))); |
| 29 | } |
| 30 | } |