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