Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
55 | public static function fromResponse(ResponseInterface $response): self |
||
56 | { |
||
57 | $body = $response->getBody(); |
||
58 | |||
59 | $matches = []; |
||
60 | $result = preg_match('/^([0-9]+) FETCH \((.*?)\)\s*$/s', $body, $matches); |
||
61 | if ($result !== 1) { |
||
62 | throw new \InvalidArgumentException('Not a fetch command'); |
||
63 | } |
||
64 | |||
65 | return new self((int)$matches[1], ItemList::fromString($matches[2])); |
||
66 | } |
||
67 | |||
68 | } |