| Conditions | 5 | 
| Paths | 9 | 
| Total Lines | 24 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 13 | 
| CRAP Score | 5 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 30 | 15 | public function store(string $message, string $level): StorageInterface  | 
            |
| 31 |     { | 
            ||
| 32 | 15 | $flag = 0;  | 
            |
| 33 | 15 | $logFile = $this->params['log_path'] . DIRECTORY_SEPARATOR . $level . '.log';  | 
            |
| 34 | |||
| 35 | 15 |         if (!\file_exists($this->params['log_path'])) { | 
            |
| 36 | 13 | $bool = @\mkdir($this->params['log_path']);  | 
            |
| 37 | |||
| 38 | 13 |             if (!$bool) { | 
            |
| 39 | 1 |                 throw new LogException('Unable to create log directory: ' . $this->params['log_path']); | 
            |
| 40 | }  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | 14 |         if (\file_exists($logFile)) { | 
            |
| 44 | 3 | $flag = FILE_APPEND;  | 
            |
| 45 | }  | 
            ||
| 46 | |||
| 47 | 14 | $bool = @\file_put_contents($logFile, $message, $flag | LOCK_EX);  | 
            |
| 48 | |||
| 49 | 14 |         if (!$bool) { | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 50 | 1 |             throw new LogException('Unable to save log file: ' . $logFile); | 
            |
| 51 | }  | 
            ||
| 52 | |||
| 53 | 13 | return $this;  | 
            |
| 54 | }  | 
            ||
| 56 | 
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: