| Total Complexity | 6 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class Semver |
||
| 9 | { |
||
| 10 | use ScriptsPath; |
||
| 11 | |||
| 12 | private string $version; |
||
| 13 | |||
| 14 | public function __construct(string $version) |
||
| 15 | { |
||
| 16 | $this->version = $version; |
||
| 17 | } |
||
| 18 | |||
| 19 | public static function for(string $version): Semver |
||
| 20 | { |
||
| 21 | return new self($version); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function major(): string |
||
| 25 | { |
||
| 26 | return $this->runSemver('major'); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function minor(): string |
||
| 30 | { |
||
| 31 | return $this->runSemver('minor'); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function patch(): string |
||
| 35 | { |
||
| 36 | return $this->runSemver('patch'); |
||
| 37 | } |
||
| 38 | |||
| 39 | private function runSemver(string $type): string |
||
| 49 | } |
||
| 50 | } |
||
| 51 |