Controller   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 43
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A after() 0 2 1
A boot() 0 2 1
A before() 0 2 1
1
<?php
2
3
namespace Ffcms\Core\Arch;
4
5
use Ffcms\Core\App;
6
use Ffcms\Core\Debug\DebugMeasure;
7
use Ffcms\Core\Interfaces\iController;
8
9
/**
10
 * Class Controller. Classic carcase of controller in MVC architecture.
11
 * @package Ffcms\Core\Arch
12
 */
13
class Controller implements iController
14
{
15
    use DebugMeasure;
16
17
    /** @var string */
18
    public $lang = 'en';
19
20
    /** @var \Ffcms\Core\Network\Request */
21
    public $request;
22
    /** @var \Ffcms\Core\Network\Response */
23
    public $response;
24
    /** @var View */
25
    public $view;
26
27
    /**
28
     * Controller constructor. Set controller access data - request, response, view
29
     */
30
    public function __construct()
31
    {
32
        if (App::$Debug) {
33
            App::$Debug->startMeasure(get_class($this));
34
            App::$Debug->bar->getCollector('messages')->info('Use controller: ' . get_class($this));
0 ignored issues
show
Bug introduced by
The method info() does not exist on DebugBar\DataCollector\DataCollectorInterface. It seems like you code against a sub-type of DebugBar\DataCollector\DataCollectorInterface such as DebugBar\DataCollector\MessagesCollector or DebugBar\Bridge\PropelCollector. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
            App::$Debug->bar->getCollector('messages')->/** @scrutinizer ignore-call */ info('Use controller: ' . get_class($this));
Loading history...
35
        }
36
        $this->lang = App::$Request->getLanguage();
37
        $this->request = App::$Request;
38
        $this->response = App::$Response;
39
        $this->view = App::$View;
40
        $this->before();
41
    }
42
43
    /** Before action call method */
44
    public function before()
45
    {
46
    }
47
    
48
    /** Global bootable method */
49
    public static function boot(): void
50
    {
51
    }
52
53
    /** After action called method */
54
    public function after()
55
    {
56
    }
57
}
58