Test Failed
Push — master ( 79af4d...00f9a5 )
by Fran
02:26
created

Admin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 43
ccs 4
cts 8
cp 0.5
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 3 1
A staticAdminLogon() 0 9 3
1
<?php
2
3
namespace PSFS\controller\base;
4
5
use PSFS\base\exception\UserAuthException;
6
use PSFS\base\types\AuthAdminController;
7
use PSFS\controller\UserController;
8
use PSFS\services\AdminServices;
9
10
/**
11
 * Class Admin
12
 * @package PSFS\controller
13
 * @domain ROOT
14
 */
15
abstract class Admin extends AuthAdminController
16
{
17
    const DOMAIN = 'ROOT';
18
19
    /**
20
     * @Injectable
21
     * @var \PSFS\base\config\Config Configuration service
22
     */
23
    protected $config;
24
    /**
25
     * @Injectable
26
     * @var \PSFS\services\AdminServices Admin service
27
     */
28
    protected $srv;
29
30
    /**
31
     * Método estático de login de administrador
32
     * @return string HTML
33
     * @throws UserAuthException
34
     * @throws \PSFS\base\exception\GeneratorException
35
     */
36 1
    public static function staticAdminLogon()
37
    {
38 1
        if (self::isTest()) {
39
            throw new UserAuthException();
40
        }
41 1
        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
42
            return AdminServices::getInstance()->setAdminHeaders();
43
        } else {
44 1
            return UserController::showAdminManager();
45
        }
46
    }
47
48
    /**
49
     * Método que gestiona el menú de administración
50
     * @GET
51
     * @route /admin
52
     * @visible false
53
     * @return string|null
54
     */
55
    public function index()
56
    {
57
        return $this->render("index.html.twig");
58
    }
59
60
}
61