123456789101112131415161718192021222324 |
- <?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) {
- $isLoggedIn = $this->authorizer->isLoggedIn();
- $viewData = array(
- "url" => $url,
- "isLoggedIn" => $isLoggedIn,
- "title" => "The Eye of Midas",
- "loginTarget" => "/dashboard"
- );
- return $this->view->render("home.php", $viewData);
- }
- }
|