Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | protected function getPath($argument_name) |
||
41 | { |
||
42 | $raw_path = $this->io->getArgument($argument_name); |
||
43 | $path = realpath($raw_path); |
||
44 | |||
45 | if ( !$path || !file_exists($path) || !is_dir($path) ) { |
||
46 | throw new \InvalidArgumentException('The "' . $raw_path . '" path is invalid.'); |
||
47 | } |
||
48 | |||
49 | return $path; |
||
50 | } |
||
51 | |||
53 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.