| Conditions | 5 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | protected function getPath($argument_name) |
||
| 41 | { |
||
| 42 | $raw_path = $this->io->getArgument($argument_name); |
||
| 43 | |||
| 44 | if ( !$raw_path ) { |
||
| 45 | return ''; |
||
| 46 | } |
||
| 47 | |||
| 48 | $path = realpath($raw_path); |
||
| 49 | |||
| 50 | if ( !$path || !file_exists($path) || !is_dir($path) ) { |
||
| 51 | throw new \InvalidArgumentException('The "' . $raw_path . '" path is invalid.'); |
||
| 52 | } |
||
| 53 | |||
| 54 | return $path; |
||
| 55 | } |
||
| 56 | |||
| 58 |
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.