Lines
0.00%
0 / 11
Methods
0.00%
0 / 3
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| configurable | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| severity | 0.00% | 0 / 9 | 0.00% | 0 / 1 | 90 | ||
| isBelow | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| 7 | enum LogLevel: string | |
| 8 | { | |
| 9 | case Debug = 'debug'; | |
| 10 | case Info = 'info'; | |
| 11 | case Notice = 'notice'; | |
| 12 | case Warning = 'warning'; | |
| 13 | case Error = 'error'; | |
| 14 | case Critical = 'critical'; | |
| 15 | case Alert = 'alert'; | |
| 16 | case Emergency = 'emergency'; | |
| 17 | ||
| 18 | /** @return list<self> */ | |
| 19 | public static function configurable(): array | |
| 20 | { | |
| 21 | return [self::Debug, self::Info, self::Notice, self::Warning, self::Error]; | |
| 22 | } | |
| 23 | ||
| 24 | public function severity(): int | |
| 25 | { | |
| 26 | return match ($this) { | |
| 27 | self::Debug => 0, | |
| 28 | self::Info => 1, | |
| 29 | self::Notice => 2, | |
| 30 | self::Warning => 3, | |
| 31 | self::Error => 4, | |
| 32 | self::Critical => 5, | |
| 33 | self::Alert => 6, | |
| 34 | self::Emergency => 7, | |
| 35 | }; | |
| 36 | } | |
| 37 | ||
| 38 | public function isBelow(self $threshold): bool | |
| 39 | { | |
| 40 | return $this->severity() < $threshold->severity(); | |
| 41 | } | |
| 42 | } |