1 | <?php |
||
25 | abstract class AbstractRequester |
||
26 | { |
||
27 | protected $method = 'get'; |
||
28 | protected $path = '/'; |
||
29 | protected $requestHeader = []; |
||
30 | protected $query = []; |
||
31 | protected $requestBody = null; |
||
32 | /** |
||
33 | * @var Schema |
||
34 | */ |
||
35 | protected $schema = null; |
||
36 | |||
37 | protected $statusExpected = 200; |
||
38 | protected $assertHeader = []; |
||
39 | |||
40 | /** |
||
41 | * abstract function to be implemented by derived classes |
||
42 | * |
||
43 | * This function must be implemented by derived classes. It should process |
||
44 | * the given request and return an according response. |
||
45 | * |
||
46 | * @param RequestInterface $request |
||
47 | * @return ResponseInterface |
||
48 | */ |
||
49 | abstract protected function handleRequest(RequestInterface $request); |
||
50 | |||
51 | /** |
||
52 | * @param Schema $schema |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function withSchema($schema) |
||
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function hasSchema() |
||
69 | |||
70 | /** |
||
71 | * @param string $method |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function withMethod($method) |
||
80 | |||
81 | /** |
||
82 | * @param string $path |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function withPath($path) |
||
91 | |||
92 | /** |
||
93 | * @param array $requestHeader |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function withRequestHeader($requestHeader) |
||
107 | |||
108 | /** |
||
109 | * @param array $query |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function withQuery($query) |
||
123 | |||
124 | /** |
||
125 | * @param null $requestBody |
||
126 | * @return $this |
||
127 | */ |
||
128 | public function withRequestBody($requestBody) |
||
134 | |||
135 | public function assertResponseCode($code) |
||
141 | |||
142 | public function assertHeaderContains($header, $contains) |
||
148 | |||
149 | /** |
||
150 | * @return mixed |
||
151 | * @throws Exception\DefinitionNotFoundException |
||
152 | * @throws Exception\GenericSwaggerException |
||
153 | * @throws Exception\HttpMethodNotFoundException |
||
154 | * @throws Exception\InvalidDefinitionException |
||
155 | * @throws Exception\PathNotFoundException |
||
156 | * @throws NotMatchedException |
||
157 | * @throws StatusCodeNotMatchedException |
||
158 | * @throws MessageException |
||
159 | */ |
||
160 | public function send() |
||
235 | } |
||
236 |
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.