Test Failed
Push — main ( ac1cad...7178bf )
by Rafael
50:59
created

Controller::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/* Copyright (C) 2024      Rafael San José      <[email protected]>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
namespace Alxarafe\Base;
20
21
/**
22
 * Class Controller. Controller is the general purpose controller and requires the user to be authenticated.
23
 *
24
 * @package Alxarafe\Base
25
 */
26
abstract class Controller extends ViewController
27
{
28
    public function __construct()
29
    {
30
        parent::__construct();
31
    }
32
33
    private function isLogged()
34
    {
35
        return true;
36
    }
37
38
    public function doLogin()
39
    {
40
        dump($_POST);
41
        die('Ahora haría un login');
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
42
    }
43
44
    public function index(bool $executeActions = true): bool
45
    {
46
        $executeActions = $executeActions && $this->isLogged();
47
        if (!$executeActions) {
48
            $this->template = 'auth/login';
49
        }
50
        return parent::index($executeActions);
51
    }
52
}
53