| Total Complexity | 4 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Priority |
||
| 11 | { |
||
| 12 | private const MIN_VALUE = -1024; |
||
| 13 | private const MAX_VALUE = 1024; |
||
| 14 | |||
| 15 | public int $value; |
||
| 16 | |||
| 17 | private function __construct(int $value) |
||
| 18 | { |
||
| 19 | if ($value < self::MIN_VALUE || $value > self::MAX_VALUE) { |
||
| 20 | throw new \InvalidArgumentException('Priority value must be between ' . self::MIN_VALUE . ' and ' . self::MAX_VALUE); |
||
| 21 | } |
||
| 22 | |||
| 23 | $this->value = $value; |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function fromInt(int $value): self |
||
| 29 | } |
||
| 30 | } |
||
| 31 |