| Conditions | 11 | 
| Paths | 11 | 
| Total Lines | 26 | 
| Code Lines | 23 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 21 | 
| CRAP Score | 11.0113 | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 60 | 141 | public function toLogLevelValue(string $level)  | 
            |
| 61 |     { | 
            ||
| 62 | 141 |         switch (strtolower($level)) { | 
            |
| 63 | 141 | case 'debug':  | 
            |
| 64 | 28 | return 1;  | 
            |
| 65 | 113 | case 'info':  | 
            |
| 66 | 25 | return 2;  | 
            |
| 67 | 88 | case 'notice': // PSR-3  | 
            |
| 68 | 11 | return 3;  | 
            |
| 69 | 77 | case 'warn':  | 
            |
| 70 | 66 | case 'warning': // PSR-3  | 
            |
| 71 | 22 | return 4;  | 
            |
| 72 | 55 | case 'error':  | 
            |
| 73 | 11 | return 5;  | 
            |
| 74 | 44 | case 'critical': // PSR-3  | 
            |
| 75 | 11 | return 6;  | 
            |
| 76 | 33 | case 'alert': // PSR-3  | 
            |
| 77 | 11 | return 7;  | 
            |
| 78 | 22 | case 'emergency': // PSR-3  | 
            |
| 79 | 11 | return 8;  | 
            |
| 80 | 11 | case 'fatal':  | 
            |
| 81 | 11 | return 9;  | 
            |
| 82 | default:  | 
            ||
| 83 |                 throw new LoggerException("Undefined log level: $level"); | 
            ||
| 84 | }  | 
            ||
| 85 | }  | 
            ||
| 86 | }  | 
            ||
| 87 |