| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 66 | 3 | public static function fromString(string $response): self |
|
| 67 | { |
||
| 68 | 3 | $matches = []; |
|
| 69 | 3 | $result = preg_match('/^([0-9]+) FETCH ((\()?.*?(\))?)\s*$/s', $response, $matches); |
|
| 70 | 3 | if ($result !== 1) { |
|
| 71 | 1 | throw new \InvalidArgumentException('Not a fetch command'); |
|
| 72 | } |
||
| 73 | |||
| 74 | 2 | return new self((int)$matches[1], ItemList::fromString($matches[2])); |
|
| 75 | } |
||
| 76 | |||
| 77 | } |