| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 7 |
| Ratio | 43.75 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 45 | public static function getHandler($name = 'file', $path = false, $create = false, $mode = null) |
|
| 41 | { |
||
| 42 | 45 | $handler = null; |
|
|
|
|||
| 43 | 45 | $name = strtolower(trim($name)); |
|
| 44 | 45 | $class = 'Xoops' . ucfirst($name) . 'Handler'; |
|
| 45 | 45 | if (in_array($name, array('file', 'folder'))) { |
|
| 46 | 45 | $handler = new $class($path, $create, $mode); |
|
| 47 | View Code Duplication | } else { |
|
| 48 | 1 | trigger_error( |
|
| 49 | 1 | 'Class ' . $class . ' not exist in File ' . __FILE__ . ' at Line ' . __LINE__, |
|
| 50 | 1 | E_USER_WARNING |
|
| 51 | ); |
||
| 52 | 1 | return false; |
|
| 53 | } |
||
| 54 | 45 | return $handler; |
|
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.