| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Severity |
||
| 10 | { |
||
| 11 | public const WARNING = 'warning'; |
||
| 12 | public const ERROR = 'error'; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $severity; |
||
| 18 | |||
| 19 | public static function fromStringOrNull(?string $severity): self |
||
| 20 | { |
||
| 21 | if (null === $severity) { |
||
| 22 | return new self(self::ERROR); |
||
| 23 | } |
||
| 24 | |||
| 25 | return new self($severity); |
||
| 26 | } |
||
| 27 | |||
| 28 | public static function error(): self |
||
| 31 | } |
||
| 32 | |||
| 33 | private function __construct(string $severity) |
||
| 34 | { |
||
| 35 | Assert::true(self::isValueValid($severity), "Invalid severity: $severity"); |
||
| 36 | $this->severity = $severity; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getSeverity(): string |
||
| 42 | } |
||
| 43 | |||
| 44 | public static function isValueValid(string $severity): bool |
||
| 47 | } |
||
| 48 | } |
||
| 49 |