HomeRoute.php 690 B

123456789101112131415161718192021222324
  1. <?php
  2. class HomeRoute implements IRoute {
  3. public static function getInstance() {
  4. return new HomeRoute(new View(), Authorizer::getInstance(), new HeaderWrapper());
  5. }
  6. private $view;
  7. private $authorizer;
  8. private $header;
  9. private function __construct(View $view, Authorizer $authorizer, HeaderWrapper $header) {
  10. $this->view = $view;
  11. $this->authorizer = $authorizer;
  12. $this->header = $header;
  13. }
  14. public function run(Url $url) {
  15. $isLoggedIn = $this->authorizer->isLoggedIn();
  16. $viewData = array(
  17. "url" => $url,
  18. "isLoggedIn" => $isLoggedIn,
  19. "title" => "The Eye of Midas",
  20. "loginTarget" => "/dashboard"
  21. );
  22. return $this->view->render("home.php", $viewData);
  23. }
  24. }