src/Imposter/Stub/Response/IsResponse.php 1 location
|
@@ 171-173 (lines=3) @@
|
168 |
|
*/ |
169 |
|
public function setMode($mode) |
170 |
|
{ |
171 |
|
if (!in_array($mode, [self::MODE_TEXT, self::MODE_BINARY])) { |
172 |
|
throw new \InvalidArgumentException("Unable to set IsResponse mode; Invalid mode: '$mode'"); |
173 |
|
} |
174 |
|
$this->mode = $mode; |
175 |
|
} |
176 |
|
|
src/Imposter/Stub/Stub.php 1 location
|
@@ 195-197 (lines=3) @@
|
192 |
|
*/ |
193 |
|
public function getResponseOfType($type, $nth = 0) |
194 |
|
{ |
195 |
|
if (!in_array($type, [IResponse::TYPE_IS, IResponse::TYPE_PROXY, IResponse::TYPE_INJECT])) { |
196 |
|
throw new \InvalidArgumentException("Unknown response type: '$type'"); |
197 |
|
} |
198 |
|
$matches_found = 0; |
199 |
|
foreach ($this->responses as $response) { |
200 |
|
if ($response->getType() === $type && $matches_found++ === $nth) { |