Total Complexity | 8 |
Total Lines | 48 |
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 | public static function warning(): self |
||
36 | } |
||
37 | |||
38 | private function __construct(string $severity) |
||
39 | { |
||
40 | Assert::true(self::isValueValid($severity), "Invalid severity: $severity"); |
||
41 | $this->severity = $severity; |
||
42 | } |
||
43 | |||
44 | public function getSeverity(): string |
||
47 | } |
||
48 | |||
49 | public static function isValueValid(string $severity): bool |
||
52 | } |
||
53 | |||
54 | public function isWarning(): bool |
||
59 |