Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
18 | private static function exploreAtPath(array &$arr, $path, callable $callback, array &$prosArr = null) |
||
19 | { |
||
20 | if ($prosArr === null) { |
||
21 | $prosArr = &$arr; |
||
22 | if (is_string($path) && $path == '') { |
||
23 | $callback($prosArr); |
||
24 | return; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | $explodedPath = explode(self::$pathSeparator, $path); |
||
29 | $nextPath = array_shift($explodedPath); |
||
30 | |||
31 | if (count($explodedPath) > 0) { |
||
32 | static::exploreAtPath( |
||
33 | $arr, |
||
34 | implode(self::$pathSeparator, $explodedPath), |
||
35 | $callback, |
||
36 | $prosArr[$nextPath] |
||
37 | ); |
||
38 | } else { |
||
39 | $callback($prosArr[$nextPath]); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: