I have the following PHP Class:
class Init {
private static $instance = NULL;
public function __construct(){
}
public static function __callStatic($name, $arguments){
if (is_null(self::$instance)) {
$class = '\\' . __NAMESPACE__ . '\Drivers\\' . $name;
$reflection = new \ReflectionClass($class);
self::$instance = $reflection->newInstanceArgs($arguments);
return self::$instance;
} else {
return self::$instance;
}
}
}
Is there any other way to call the instantiated class, with the arguments array in that order, without using Reflection ? I've tried call_user_func_array() but it seems it doesn't work.
Thank you very much for your help
ReflectionClassis not ok whilecall_user_func_arrayis ok?