Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class App extends Controller |
||
17 | { |
||
18 | /** |
||
19 | * main constructor. |
||
20 | * |
||
21 | * @param Router $router |
||
22 | */ |
||
23 | public function __construct(Router $router) |
||
24 | { |
||
25 | parent::__construct($router); |
||
26 | |||
27 | if (!isset($_SESSION['login']) || $_SESSION['login'] != true) { |
||
28 | $this->router->redirect('website.login'); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return void |
||
34 | */ |
||
35 | public function home(): void |
||
36 | { |
||
37 | $action = $this->router->route('app.logout'); |
||
38 | $html = "Bem vindo, deseja <a title='Logout' href='{$action}'>sair</a>?"; |
||
39 | echo $html; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return void |
||
44 | */ |
||
45 | public function logout(): void |
||
52 | ); |
||
53 | } |
||
54 | } |
||
57 |