12345678910111213141516171819202122232425 |
- <?php
- class HomeRoute implements IRoute {
- public static function getInstance() {
- return new HomeRoute(new View(), Authorizer::getInstance(), new HeaderWrapper());
- }
- private $view;
- private $authorizer;
- private $header;
- private function __construct(View $view, Authorizer $authorizer, HeaderWrapper $header) {
- $this->view = $view;
- $this->authorizer = $authorizer;
- $this->header = $header;
- }
- public function run(Url $url) {
- if($this->authorizer->isLoggedIn()) {
- $this->header->location("/dashboard");
- }
- $viewData = array(
- "url" => $url,
- "isLoggedIn" => false,
- "title" => "Browser Game"
- );
- return $this->view->render("homeView.php", $viewData);
- }
- }
|