| Total Complexity | 8 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class MediaTypeNegotiator |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var MediaTypeHandler[] |
||
| 13 | */ |
||
| 14 | private $handlers; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Negotiate a media type handler best matching the given media types. |
||
| 18 | * |
||
| 19 | * @param string ...$mediaTypes |
||
| 20 | * |
||
| 21 | * @throws NonNegotiableMediaTypeException |
||
| 22 | * |
||
| 23 | * @return MediaTypeHandler |
||
| 24 | */ |
||
| 25 | 3 | public function negotiate(string ...$mediaTypes): MediaTypeHandler |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Add a list of media type handlers for negotiation. |
||
| 40 | * |
||
| 41 | * @param MediaTypeHandler ...$handlers |
||
| 42 | * |
||
| 43 | * @return MediaTypeNegotiator |
||
| 44 | */ |
||
| 45 | 4 | public function addHandler(MediaTypeHandler ...$handlers): self |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get a list of all the media types supported by the registered handlers. |
||
| 56 | * |
||
| 57 | * @return string[] |
||
| 58 | */ |
||
| 59 | 1 | public function getSupportedMediaTypes(): array |
|
| 69 |