| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 80 | public static function fromString($version) |
|
| 35 | { |
||
| 36 | 80 | $versionPattern = '/^(\d+)\.(\d+)$/'; |
|
| 37 | 80 | if (preg_match($versionPattern, $version, $matches) !== 1) { |
|
| 38 | 6 | throw new \InvalidArgumentException('Invalid version format.'); |
|
| 39 | } |
||
| 40 | 74 | return new self((int)$matches[1], (int)$matches[2]); |
|
| 41 | } |
||
| 42 | |||
| 87 |