Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
24 | 4 | public function createInstance($type, $contract) |
|
25 | { |
||
26 | 4 | if (!isset($this->allowedTypes[$type])) { |
|
27 | 1 | throw new \InvalidArgumentException("Cannot create response object; Invalid response type: '$type'"); |
|
28 | } |
||
29 | |||
30 | /** @var IResponse $class */ |
||
31 | 3 | $class = $this->allowedTypes[$type]; |
|
32 | 3 | return $class::createFromContract($contract); |
|
33 | } |
||
34 | } |