diff --git a/HttpServer/Controller.php b/HttpServer/Controller.php index e45baa84..9d2044f5 100644 --- a/HttpServer/Controller.php +++ b/HttpServer/Controller.php @@ -15,6 +15,7 @@ use Snowflake\Snowflake; * Class WebController * @package Snowflake\Snowflake\Web * @property BaseGoto $goto + * @property \Snowflake\Application $app */ class Controller extends Application { @@ -30,6 +31,21 @@ class Controller extends Application /** @var Request */ public $request; + + public $goto; + + + public $app; + + + public function __construct($config = []) + { + $this->app = Snowflake::app(); + $this->goto = $this->app->goto; + + parent::__construct($config); + } + /** * @param HttpParams $input */ @@ -97,16 +113,11 @@ class Controller extends Application */ public function __get($name) { - $method = 'get' . ucfirst($name); - if (method_exists($this, $method)) { - return $this->$method(); + if (property_exists($this, $name)) { + return $this->$name; + } else if (method_exists($this, $name)) { + return $this->$name(); } - - $app = Snowflake::app(); - if ($app->has($name)) { - return $app->get($name); - } - return parent::__get($name); }