LoginRoute.php 625 B

12345678910111213141516171819
  1. <?php
  2. class LoginRoute implements IRoute {
  3. public static function getInstance() {
  4. return new LoginRoute(new HeaderWrapper(), new Form(), Authorizer::getInstance());
  5. }
  6. private $header;
  7. private $form;
  8. private $authorizer;
  9. private function __construct(HeaderWrapper $header, Form $form, Authorizer $authorizer) {
  10. $this->header = $header;
  11. $this->form = $form;
  12. $this->authorizer = $authorizer;
  13. }
  14. public function run(Url $url) {
  15. $this->authorizer->logInUser($this->form->get("email"), $this->form->get("password"));
  16. $destinationUrl = $this->form->get("current");
  17. $this->header->location($destinationUrl);
  18. }
  19. }