Passed
Push — Auth ( c6ffd2...76831f )
by Stone
02:02
created

Home::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Controllers\Admin;
4
5
6
7
use Core\Container;
8
9
class Home extends \Core\AdminController
10
{
11
    protected $siteConfig;
12
13
    public function __construct(Container $container)
14
    {
15
        $this->loadModules[] = 'SiteConfig';
16
        parent::__construct($container);
17
    }
18
19
    /**
20
     * The front page of the admin section
21
     * @throws \ReflectionException
22
     * @throws \Twig_Error_Loader
23
     * @throws \Twig_Error_Runtime
24
     * @throws \Twig_Error_Syntax
25
     */
26
    public function index()
27
    {
28
        if(!$this->auth->isUser()){
29
            $this->alertBox->setAlert("You must be connected to access the admin interface", 'warning');
30
            $this->container->getResponse()->redirect();
31
        }
32
33
        $this->renderView('Admin/Home');
34
35
    }
36
}