Conditions | 4 |
Paths | 5 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public static function getRelativeBaseUrl($scriptName, $phpSelf, $filename): string |
||
42 | { |
||
43 | // Backtrack up the SCRIPT_FILENAME to find the portion |
||
44 | // matching PHP_SELF. |
||
45 | $baseUrl = '/'; |
||
46 | $basename = basename($filename); |
||
47 | if ($basename) { |
||
48 | $path = ($phpSelf ? trim($phpSelf, '/') : ''); |
||
49 | $basePos = strpos($path, $basename) ?: 0; |
||
50 | $baseUrl .= substr($path, 0, $basePos); |
||
51 | } |
||
52 | |||
53 | return $baseUrl; |
||
54 | } |
||
55 | } |
||
56 |
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.