| Total Complexity | 3 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class LogLevel |
||
| 8 | { |
||
| 9 | public const LEVEL_DEBUG = 1; |
||
| 10 | public const LEVEL_INFO = 2; |
||
| 11 | public const LEVEL_NOTICE = 4; |
||
| 12 | public const LEVEL_WARNING = 8; |
||
| 13 | public const LEVEL_ERROR = 16; |
||
| 14 | public const LEVEL_CRITICAL = 32; |
||
| 15 | public const LEVEL_ALERT = 64; |
||
| 16 | public const LEVEL_EMERGENCY = 128; |
||
| 17 | |||
| 18 | private $mappings = [ |
||
| 19 | self::LEVEL_DEBUG => 'debug', |
||
| 20 | self::LEVEL_INFO => 'info', |
||
| 21 | self::LEVEL_NOTICE => 'notice', |
||
| 22 | self::LEVEL_WARNING => 'warning', |
||
| 23 | self::LEVEL_ERROR => 'error', |
||
| 24 | self::LEVEL_CRITICAL => 'critical', |
||
| 25 | self::LEVEL_ALERT => 'alert', |
||
| 26 | self::LEVEL_EMERGENCY => 'emergency', |
||
| 27 | ]; |
||
| 28 | |||
| 29 | private $level; |
||
| 30 | |||
| 31 | 7 | public function __construct(int $level) |
|
| 32 | { |
||
| 33 | 7 | $this->level = $level; |
|
| 34 | 7 | } |
|
| 35 | |||
| 36 | 6 | public function shouldLogFor(LogLevel $right): bool |
|
| 37 | { |
||
| 38 | 6 | return $this->level <= $right->level; |
|
| 39 | } |
||
| 40 | |||
| 41 | 5 | public function toString(): string |
|
| 44 | } |
||
| 45 | } |
||
| 46 |