| 1 | <?php namespace Neomerx\JsonApi\Http\Headers; |
||
| 27 | class AcceptHeader extends Header implements AcceptHeaderInterface |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * @param AcceptMediaTypeInterface[] $unsortedMediaTypes |
||
| 31 | */ |
||
| 32 | 50 | public function __construct($unsortedMediaTypes) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @inheritdoc |
||
| 46 | * |
||
| 47 | * @return AcceptHeaderInterface |
||
|
1 ignored issue
–
show
|
|||
| 48 | */ |
||
| 49 | 51 | public static function parse($header, $accept = self::HEADER_ACCEPT) |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | * |
||
| 57 | * @return AcceptMediaTypeInterface |
||
|
1 ignored issue
–
show
|
|||
| 58 | */ |
||
| 59 | 51 | protected static function parseMediaType($position, $mediaType) |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @inheritdoc |
||
| 66 | * |
||
| 67 | * @return AcceptHeaderInterface |
||
|
1 ignored issue
–
show
|
|||
| 68 | */ |
||
| 69 | 47 | protected static function newInstance($name, $mediaTypes) |
|
| 74 | |||
| 75 | /** |
||
| 76 | * @return Closure |
||
| 77 | */ |
||
| 78 | private function getMediaTypeCompareClosure() |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @param float $lhs |
||
| 107 | * @param float $rhs |
||
| 108 | * |
||
| 109 | * @return int |
||
| 110 | */ |
||
| 111 | 12 | private function compareQuality($lhs, $rhs) |
|
| 122 | |||
| 123 | /** |
||
| 124 | * @param string $lhs |
||
| 125 | * @param string $rhs |
||
| 126 | * |
||
| 127 | * @return int |
||
| 128 | */ |
||
| 129 | 4 | private function compareStrings($lhs, $rhs) |
|
| 133 | |||
| 134 | /** |
||
| 135 | * @param array|null $lhs |
||
| 136 | * @param array|null $rhs |
||
| 137 | * |
||
| 138 | * @return int |
||
| 139 | */ |
||
| 140 | 3 | private function compareParameters($lhs, $rhs) |
|
| 144 | } |
||
| 145 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.