1 | <?php |
||
15 | * Concrete implentation of Adapter interface |
||
16 | */ |
||
17 | final class GuzzleAdapter implements AdapterInterface |
||
18 | { |
||
19 | /** |
||
20 | * Collection of Promise\PromiseInterface instances with keys matching what was given from start(). |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | private $promises = []; |
||
25 | |||
26 | /** |
||
27 | * Collection of Api\Response with keys matching what was given from start(). |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $responses = []; |
||
32 | |||
33 | /** |
||
34 | * Collection of \Exception with keys matching what was given from start(). |
||
35 | * |
||
36 | * @var ArrayObject |
||
37 | */ |
||
38 | private $exceptions; |
||
39 | |||
40 | /** |
||
41 | * @var GuzzleClientInterface |
||
42 | */ |
||
43 | private $client; |
||
44 | |||
45 | public function __construct(GuzzleClientInterface $client = null) |
||
55 | |||
56 | /** |
||
57 | * @see AdapterInterface::start() |
||
58 | */ |
||
59 | public function start(RequestInterface $request) : string |
||
65 | |||
66 | /** |
||
67 | * @see Adapter::end() |
||
68 | * |
||
69 | * @throws \InvalidArgumentException |
||
70 | */ |
||
71 | public function end(string $endHandle) : ResponseInterface |
||
110 | |||
111 | /** |
||
112 | * Helper method to execute all guzzle promises. |
||
113 | * |
||
114 | * @param array $promises |
||
115 | * @param array $exceptions |
||
116 | * |
||
117 | * @return array Array of fulfilled PSR7 responses. |
||
118 | */ |
||
119 | private function fulfillPromises(array $promises, ArrayObject $exceptions) : array |
||
138 | } |
||
139 |
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.