1 | <?php |
||
8 | abstract class AbstractNegotiator |
||
9 | { |
||
10 | /** |
||
11 | * @param string $header A string containing an `Accept|Accept-*` header. |
||
12 | * @param array $priorities A set of server priorities. |
||
13 | * |
||
14 | * @return AcceptHeader|null best matching type |
||
15 | */ |
||
16 | 58 | public function getBest($header, array $priorities) |
|
53 | |||
54 | /** |
||
55 | * @param string $header accept header part or server priority |
||
56 | * |
||
57 | * @return AcceptHeader Parsed header object |
||
58 | */ |
||
59 | abstract protected function acceptFactory($header); |
||
60 | |||
61 | /** |
||
62 | * @param AcceptHeader $header |
||
63 | * @param AcceptHeader $priority |
||
64 | * @param integer $index |
||
65 | * |
||
66 | * @return Match|null Headers matched |
||
67 | */ |
||
68 | 17 | protected function match(AcceptHeader $header, AcceptHeader $priority, $index) |
|
83 | |||
84 | /** |
||
85 | * @param string $header A string that contains an `Accept*` header. |
||
86 | * |
||
87 | * @return AcceptHeader[] |
||
88 | */ |
||
89 | 71 | private function parseHeader($header) |
|
99 | |||
100 | /** |
||
101 | * @param AcceptHeader[] $headerParts |
||
102 | * @param Priority[] $priorities Configured priorities |
||
103 | * |
||
104 | * @return Match[] Headers matched |
||
105 | */ |
||
106 | 55 | private function findMatches(array $headerParts, array $priorities) |
|
119 | } |
||
120 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.