12345678910111213141516171819 |
- <?php
- class LoginRoute implements IRoute {
- public static function getInstance() {
- return new LoginRoute(new HeaderWrapper(), new Form(), Authorizer::getInstance());
- }
- private $header;
- private $form;
- private $authorizer;
- private function __construct(HeaderWrapper $header, Form $form, Authorizer $authorizer) {
- $this->header = $header;
- $this->form = $form;
- $this->authorizer = $authorizer;
- }
- public function run(Url $url) {
- $this->authorizer->logInUser($this->form->get("email"), $this->form->get("password"));
- $destinationUrl = $this->form->get("current");
- $this->header->location($destinationUrl);
- }
- }
|