Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | 1 | final static function __callStatic($name, $args) |
|
27 | { |
||
28 | 1 | $class = get_called_class(); |
|
29 | 1 | $constantName = "$class::$name"; |
|
30 | 1 | if (isset(self::$cache[$constantName])) { |
|
31 | 1 | return self::$cache[$constantName]; |
|
32 | } else { |
||
33 | 1 | $const = constant($constantName); |
|
34 | 1 | return self::$cache[$constantName] = new $class($const); |
|
35 | } |
||
36 | } |
||
37 | |||
48 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.