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