| 1 | <?php namespace Neomerx\JsonApi\Http\Headers; |
||
| 26 | class Header implements HeaderInterface |
||
| 27 | { |
||
| 28 | /** |
||
| 29 | * @var string |
||
| 30 | */ |
||
| 31 | private $name; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var MediaTypeInterface[] |
||
| 35 | */ |
||
| 36 | private $mediaTypes; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $name |
||
| 40 | * @param MediaTypeInterface[] $mediaTypes |
||
| 41 | */ |
||
| 42 | 53 | public function __construct($name, $mediaTypes) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @inheritdoc |
||
| 59 | */ |
||
| 60 | 2 | public function getName() |
|
| 64 | |||
| 65 | /** |
||
| 66 | * @inheritdoc |
||
| 67 | */ |
||
| 68 | 40 | public function getMediaTypes() |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Parse header. |
||
| 75 | * |
||
| 76 | * @param string $header |
||
| 77 | * @param string $name |
||
| 78 | * |
||
| 79 | * @return HeaderInterface |
||
|
1 ignored issue
–
show
|
|||
| 80 | */ |
||
| 81 | 55 | public static function parse($header, $name) |
|
| 96 | |||
| 97 | /** |
||
| 98 | * @param int $position |
||
| 99 | * @param string $mediaType |
||
| 100 | * |
||
| 101 | * @return MediaTypeInterface |
||
|
1 ignored issue
–
show
|
|||
| 102 | */ |
||
| 103 | 37 | protected static function parseMediaType($position, $mediaType) |
|
| 107 | |||
| 108 | /** |
||
| 109 | * @param string $name |
||
| 110 | * @param MediaTypeInterface[] $mediaTypes |
||
| 111 | * |
||
| 112 | * @return Header |
||
| 113 | */ |
||
| 114 | 36 | protected static function newInstance($name, $mediaTypes) |
|
| 118 | } |
||
| 119 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.