Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Negotiated | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| contentType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Server\Http; |
| 6 | |
| 7 | use LambdaTwelve\OneRecord\Spec\ApiVersion; |
| 8 | |
| 9 | /** |
| 10 | * What one request negotiated: the API version to answer in and the language. |
| 11 | */ |
| 12 | final readonly class Negotiated |
| 13 | { |
| 14 | public function __construct( |
| 15 | public ApiVersion $version, |
| 16 | public string $language, |
| 17 | public bool $versionRequested, |
| 18 | ) {} |
| 19 | |
| 20 | public function contentType(): string |
| 21 | { |
| 22 | return 'application/ld+json; version=' . $this->version->value; |
| 23 | } |
| 24 | } |