Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
60 | public static function fromString(ItemInterface $item, string $partial): self |
||
61 | { |
||
62 | $result = preg_match('/^<([0-9]+)\.([0-9]+)$/', $partial, $matches); |
||
63 | |||
64 | if ($result !== 1) { |
||
65 | throw new \InvalidArgumentException('String is not a partial'); |
||
66 | } |
||
67 | |||
68 | return new self($item, (int)$matches[1], (int)$matches[2]); |
||
69 | } |
||
70 | } |