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