Passed
Push — master ( 2955c9...ee5866 )
by Fran
05:26
created

Admin::getMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 2
cp 0
crap 2
1
<?php
2
3
namespace PSFS\controller\base;
4
5
use PSFS\base\config\LoginForm;
6
use PSFS\base\Router;
7
use PSFS\base\Template;
8
use PSFS\base\types\AuthAdminController;
9
10
/**
11
 * Class Admin
12
 * @package PSFS\controller
13
 * @domain ROOT
14
 */
15
class Admin extends AuthAdminController{
16
17
    const DOMAIN = 'ROOT';
18
19
    /**
20
     * @Inyectable
21
     * @var \PSFS\base\config\Config Configuration service
22
     */
23
    protected $config;
24
    /**
25
     * @Inyectable
26
     * @var \PSFS\services\AdminServices Admin service
27
     */
28
    protected $srv;
29
30
    /**
31
     * Wrapper de asignación de los menus
32
     * @return array
33
     */
34
    protected function getMenu() {
35
        return Router::getInstance()->getAdminRoutes();
36
    }
37
38
    /**
39
     * Método estático de login de administrador
40
     * @param string $route
0 ignored issues
show
Documentation introduced by
Should the type for parameter $route not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
41
     * @return string HTML
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
42
     * @throws \PSFS\base\exception\FormException
43
     */
44
    public static function staticAdminLogon($route = null) {
45
        $form = new LoginForm();
46
        $form->setData(array("route" => $route));
47
        $form->build();
48
        $tpl = Template::getInstance();
49
        $tpl->setPublicZone(true);
50
        return $tpl->render("login.html.twig", array(
51
            'form' => $form,
52
        ));
53
    }
54
55
    /**
56
     * Método que gestiona el menú de administración
57
     * @GET
58
     * @route /admin
59
     * @visible false
60
     * @return string|null
61
     */
62
    public function index() {
63
        return $this->render("index.html.twig");
64
    }
65
66
}
67