1 | <?php |
||
23 | abstract class AbstractRequester |
||
24 | { |
||
25 | protected $method = 'get'; |
||
26 | protected $path = '/'; |
||
27 | protected $requestHeader = []; |
||
28 | protected $query = []; |
||
29 | protected $requestBody = null; |
||
30 | /** |
||
31 | * @var SwaggerSchema |
||
32 | */ |
||
33 | protected $swaggerSchema = null; |
||
34 | |||
35 | protected $statusExpected = 200; |
||
36 | protected $assertHeader = []; |
||
37 | |||
38 | public function __construct() |
||
41 | |||
42 | /** |
||
43 | * abstract function to be implemented by derived classes |
||
44 | * |
||
45 | * This function must be implemented by derived classes. It should process |
||
46 | * the given request and return an according response. |
||
47 | * |
||
48 | * @param RequestInterface $request |
||
49 | * @return ResponseInterface |
||
50 | */ |
||
51 | abstract protected function handleRequest(RequestInterface $request); |
||
52 | |||
53 | /** |
||
54 | * @param SwaggerSchema $schema |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function withSwaggerSchema($schema) |
||
63 | |||
64 | /** |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function hasSwaggerSchema() |
||
71 | |||
72 | /** |
||
73 | * @param string $method |
||
74 | * @return $this |
||
75 | */ |
||
76 | public function withMethod($method) |
||
82 | |||
83 | /** |
||
84 | * @param string $path |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function withPath($path) |
||
93 | |||
94 | /** |
||
95 | * @param array $requestHeader |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function withRequestHeader($requestHeader) |
||
109 | |||
110 | /** |
||
111 | * @param array $query |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function withQuery($query) |
||
125 | |||
126 | /** |
||
127 | * @param null $requestBody |
||
128 | * @return $this |
||
129 | */ |
||
130 | public function withRequestBody($requestBody) |
||
136 | |||
137 | public function assertResponseCode($code) |
||
143 | |||
144 | public function assertHeaderContains($header, $contains) |
||
150 | |||
151 | /** |
||
152 | * @return mixed |
||
153 | * @throws Exception\DefinitionNotFoundException |
||
154 | * @throws Exception\GenericSwaggerException |
||
155 | * @throws Exception\HttpMethodNotFoundException |
||
156 | * @throws Exception\InvalidDefinitionException |
||
157 | * @throws Exception\InvalidRequestException |
||
158 | * @throws Exception\PathNotFoundException |
||
159 | * @throws Exception\RequiredArgumentNotFound |
||
160 | * @throws NotMatchedException |
||
161 | * @throws StatusCodeNotMatchedException |
||
162 | * @throws GuzzleException |
||
163 | */ |
||
164 | public function send() |
||
249 | } |
||
250 |
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.