ProfileRoute.php 571 B

123456789101112131415161718192021
  1. <?php
  2. class ProfileRoute implements IRoute {
  3. public static function getInstance() {
  4. return new ProfileRoute(new View(), Authorizer::getInstance());
  5. }
  6. private $view;
  7. private $authorizer;
  8. private function __construct(View $view, Authorizer $authorizer) {
  9. $this->view = $view;
  10. $this->authorizer = $authorizer;
  11. }
  12. public function run(Url $url) {
  13. $this->authorizer->rejectIfNotAuthorized();
  14. $viewData = array(
  15. "url" => $url,
  16. "isLoggedIn" => true,
  17. "title" => "Browser Game - Profile"
  18. );
  19. return $this->view->render("profile.php", $viewData);
  20. }
  21. }