| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function getMock(array $responseCollection) |
||
| 17 | { |
||
| 18 | $plugin = new MockPlugin(); |
||
| 19 | foreach ($responseCollection as $response) { |
||
| 20 | if ($response instanceof Psr7Response) { |
||
| 21 | $response = new Response($response->getStatusCode(), $response->getHeaders(), $response->getBody()); |
||
| 22 | } |
||
| 23 | $plugin->addResponse($response); |
||
| 24 | } |
||
| 25 | |||
| 26 | $client = GuzzleFactory::createClient(''); |
||
| 27 | $client->addSubscriber($plugin); |
||
|
|
|||
| 28 | |||
| 29 | return $client; |
||
| 30 | } |
||
| 31 | } |
||
| 32 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: