改名
This commit is contained in:
@@ -9,13 +9,13 @@ use HttpServer\Http\HttpParams;
|
|||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Snowflake\Abstracts\BaseGoto;
|
use Snowflake\Abstracts\BaseGoto;
|
||||||
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class WebController
|
* Class WebController
|
||||||
* @package Snowflake\Snowflake\Web
|
* @package Snowflake\Snowflake\Web
|
||||||
* @property BaseGoto $goto
|
* @property BaseGoto $goto
|
||||||
* @property \Snowflake\Application $app
|
|
||||||
*/
|
*/
|
||||||
class Controller extends Application
|
class Controller extends Application
|
||||||
{
|
{
|
||||||
@@ -32,16 +32,12 @@ class Controller extends Application
|
|||||||
public Request $request;
|
public Request $request;
|
||||||
|
|
||||||
|
|
||||||
public BaseGoto $goto;
|
/**
|
||||||
|
* Controller constructor.
|
||||||
|
* @param array $config
|
||||||
public $app;
|
*/
|
||||||
|
|
||||||
|
|
||||||
public function __construct($config = [])
|
public function __construct($config = [])
|
||||||
{
|
{
|
||||||
$this->app = Snowflake::app();
|
|
||||||
$this->goto = $this->app->goto;
|
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,4 +102,25 @@ class Controller extends Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $methods
|
||||||
|
* @return mixed
|
||||||
|
* @throws ComponentException
|
||||||
|
*/
|
||||||
|
public function __get($methods)
|
||||||
|
{
|
||||||
|
// TODO: Change the autogenerated stub
|
||||||
|
if (property_exists($this, $methods)) {
|
||||||
|
return $this->$methods;
|
||||||
|
}
|
||||||
|
|
||||||
|
$method = 'get' . ucfirst($methods);
|
||||||
|
if (method_exists($this, $method)) {
|
||||||
|
return $this->{$method}();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Snowflake::app()->get($methods);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user