GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.0 ( 5276e1...94e02b )
by Vermeulen
01:25
created

CtrlRouterLink.php$0 ➔ getCtrlRouterInfos()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BFW\Core\AppSystems;
4
5
class CtrlRouterLink extends AbstractSystem
6
{
7
    /**
8
     * @var object $ctrlRouterInfos Infos from router for controller
9
     * system
10
     */
11
    protected $ctrlRouterInfos;
12
    
13
    /**
14
     * Initialize the ctrlRouterInfos property
15
     * Create the new runTasks ctrlRouterLink, add him to subjectList and send
16
     * the notify to inform the adding.
17
     */
18
    public function __construct()
19
    {
20
        //Others properties can be dynamically added by modules
21
        $this->ctrlRouterInfos = new class {
22
            public $isFound = false;
23
            public $forWho = null;
24
            public $target = null;
25
            public $datas = null;
26
        };
27
        
28
        $ctrlRouterTask = new \BFW\RunTasks(
29
            $this->obtainCtrlRouterLinkTasks(),
30
            'ctrlRouterLink'
31
        );
32
        
33
        $subjectList = \BFW\Application::getInstance()->getSubjectList();
34
        $subjectList->addSubject($ctrlRouterTask, 'ctrlRouterLink');
35
        
36
        $runTasks = $subjectList->getSubjectByName('ApplicationTasks');
37
        $runTasks->sendNotify('bfw_ctrlRouterLink_subject_added');
38
    }
39
    
40
    /**
41
     * {@inheritdoc}
42
     * 
43
     * @return object
44
     */
45
    public function __invoke()
46
    {
47
        return $this->ctrlRouterInfos;
48
    }
49
    
50
    /**
51
     * Getter accessor for property ctrlRouterInfos
52
     * 
53
     * @return object
54
     */
55
    public function getCtrlRouterInfos()
56
    {
57
        return $this->ctrlRouterInfos;
58
    }
59
    
60
    /**
61
     * List all tasks runned by ctrlRouterLink
62
     * 
63
     * @return array
64
     */
65
    protected function obtainCtrlRouterLinkTasks(): array
66
    {
67
        return [
68
            'searchRoute'     => \BFW\RunTasks::generateStepItem(
69
                $this->ctrlRouterInfos
70
            ),
71
            'checkRouteFound' => \BFW\RunTasks::generateStepItem(
72
                null,
73
                function() {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
74
                    if ($this->ctrlRouterInfos->isFound === false) {
75
                        http_response_code(404);
76
                    }
77
                }
78
            ),
79
            'execRoute'       => \BFW\RunTasks::generateStepItem(
80
                $this->ctrlRouterInfos
81
            )
82
        ];
83
    }
84
    
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function toRun(): bool
89
    {
90
        return true;
91
    }
92
    
93
    /**
94
     * {@inheritdoc}
95
     * Execute the ctrlRouter tasks
96
     */
97
    public function run()
98
    {
99
        $this->runCtrlRouterLink();
100
        $this->runStatus = true;
101
    }
102
    
103
    /**
104
     * Execute the ctrlRouter task to find the route and the controller.
105
     * If nothing is found (context object), return an 404 error.
106
     * Not executed in cli.
107
     * 
108
     * @return void
109
     */
110
    protected function runCtrlRouterLink()
111
    {
112
        if (PHP_SAPI === 'cli') {
113
            return;
114
        }
115
        
116
        \BFW\Application::getInstance()
117
            ->getSubjectList()
118
            ->getSubjectByName('ctrlRouterLink')
119
            ->run();
120
    }
121
}
122