32 lines
663 B
PHP
32 lines
663 B
PHP
<?php
|
|
namespace App\Contract;
|
|
|
|
use App\Service\Auth as AuthService;
|
|
|
|
class Auth
|
|
{
|
|
protected static function newInstance()
|
|
{
|
|
return new AuthService();
|
|
}
|
|
protected $instance;
|
|
protected static function getInstance() {
|
|
if (self::$instance === null) {
|
|
self::$instance = self::newInstance();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
public static function __callStatic($name, $params)
|
|
{
|
|
if (!method_exists(Response::class, $name)) {
|
|
$instance = self::getInstance();
|
|
if (method_exists($instance, $name)) {
|
|
return call_user_func_array([$instance, $name], $params);
|
|
}
|
|
return null;
|
|
}
|
|
return call_user_func_array([self, $name], $params);
|
|
}
|
|
}
|
|
?>
|