1 | <?php |
||
13 | class SwaggerRequester |
||
14 | { |
||
15 | protected $method = 'get'; |
||
16 | protected $path = '/'; |
||
17 | protected $requestHeader = []; |
||
18 | protected $query = []; |
||
19 | protected $requestBody = null; |
||
20 | /** |
||
21 | * @var SwaggerSchema |
||
22 | */ |
||
23 | protected $swaggerSchema = null; |
||
24 | |||
25 | protected $statusExpected = 200; |
||
26 | protected $assertHeader = []; |
||
27 | |||
28 | /** |
||
29 | * @var ClientInterface |
||
30 | */ |
||
31 | protected $guzzleHttpClient; |
||
32 | |||
33 | public function __construct() |
||
37 | |||
38 | /** |
||
39 | * @param SwaggerSchema $schema |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function withSwaggerSchema($schema) |
||
48 | |||
49 | /** |
||
50 | * @return bool |
||
51 | */ |
||
52 | public function hasSwaggerSchema() |
||
56 | |||
57 | /** |
||
58 | * @param string $method |
||
59 | * @return SwaggerRequester |
||
60 | */ |
||
61 | public function withMethod($method) |
||
67 | |||
68 | /** |
||
69 | * @param string $path |
||
70 | * @return SwaggerRequester |
||
71 | */ |
||
72 | public function withPath($path) |
||
78 | |||
79 | /** |
||
80 | * @param array $requestHeader |
||
81 | * @return SwaggerRequester |
||
82 | */ |
||
83 | public function withRequestHeader($requestHeader) |
||
94 | |||
95 | /** |
||
96 | * @param array $query |
||
97 | * @return SwaggerRequester |
||
98 | */ |
||
99 | public function withQuery($query) |
||
110 | |||
111 | /** |
||
112 | * @param null $requestBody |
||
113 | * @return SwaggerRequester |
||
114 | */ |
||
115 | public function withRequestBody($requestBody) |
||
121 | |||
122 | public function assertResponseCode($code) |
||
128 | |||
129 | public function assertHeaderContains($header, $contains) |
||
135 | |||
136 | /** |
||
137 | * @return mixed |
||
138 | * @throws Exception\DefinitionNotFoundException |
||
139 | * @throws Exception\GenericSwaggerException |
||
140 | * @throws Exception\HttpMethodNotFoundException |
||
141 | * @throws Exception\InvalidDefinitionException |
||
142 | * @throws Exception\InvalidRequestException |
||
143 | * @throws Exception\PathNotFoundException |
||
144 | * @throws Exception\RequiredArgumentNotFound |
||
145 | * @throws NotMatchedException |
||
146 | * @throws StatusCodeNotMatchedException |
||
147 | * @throws GuzzleException |
||
148 | */ |
||
149 | public function send() |
||
234 | } |
||
235 |
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.