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.
Passed
Branch 3.0 (cbdaa6)
by Vermeulen
04:11
created

ModuleManager::setAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BFW\Install;
4
5
use Exception;
6
use BFW\Install\ModuleManager\Actions;
7
use bultonFr\Utils\Cli\BasicMsg;
8
9
class ModuleManager
10
{
11
    /**
12
     * The action to do on modules
13
     *
14
     * @var string
15
     */
16
    protected $action = '';
17
18
    /**
19
     * Declare if the system should reinstall the module or not
20
     *
21
     * @var bool
22
     */
23
    protected $reinstall = false;
24
25
    /**
26
     * Declare if we do the action for all module, or just one
27
     *
28
     * @var bool
29
     */
30
    protected $allModules = false;
31
32
    /**
33
     * Declare if we do the action for a specific module
34
     *
35
     * @var string
36
     */
37
    protected $specificModule = '';
38
39
    /**
40
     * Getter for property action
41
     *
42
     * @return string
43
     */
44
    public function getAction(): string
45
    {
46
        return $this->action;
47
    }
48
49
    /**
50
     * Setter for property action
51
     *
52
     * @param string $action The action to do on modules
53
     *
54
     * @return self
55
     */
56
    public function setAction(string $action): self
57
    {
58
        $this->action = $action;
59
60
        return $this;
61
    }
62
63
    /**
64
     * Getter for property reinstall
65
     *
66
     * @return bool
67
     */
68
    public function getReinstall(): bool
69
    {
70
        return $this->reinstall;
71
    }
72
73
    /**
74
     * Setter for property reinstall
75
     *
76
     * @param bool $reinstall If we do a complete reinstall of the module
77
     *
78
     * @return self
79
     */
80
    public function setReinstall(bool $reinstall): self
81
    {
82
        $this->reinstall = $reinstall;
83
84
        return $this;
85
    }
86
87
    /**
88
     * Getter for property allModule
89
     *
90
     * @return bool
91
     */
92
    public function getAllModules(): bool
93
    {
94
        return $this->allModules;
95
    }
96
97
    /**
98
     * Setter for property allModule
99
     *
100
     * @param bool $allModules If we do action for all modules
101
     *
102
     * @return self
103
     */
104
    public function setAllModules(bool $allModules): self
105
    {
106
        $this->allModules = $allModules;
107
108
        return $this;
109
    }
110
111
    /**
112
     * Getter for property specificModule
113
     *
114
     * @return string
115
     */
116
    public function getSpecificModule(): string
117
    {
118
        return $this->specificModule;
119
    }
120
121
    /**
122
     * Setter for property specificModule
123
     *
124
     * @param string $specificModule The module name
125
     *
126
     * @return self
127
     */
128
    public function setSpecificModule(string $specificModule): self
129
    {
130
        $this->specificModule = $specificModule;
131
132
        return $this;
133
    }
134
135
    /**
136
     * Instanciate the Actions class and call the method doAction on it to
137
     * execute the current action tasks.
138
     *
139
     * @return void
140
     */
141
    public function doAction()
142
    {
143
        try {
144
            $actionClass = $this->obtainActionClass();
145
            $actionClass->doAction();
146
        } catch (Exception $e) {
147
            $msg = 'Error #'.$e->getCode().' : '.$e->getMessage();
148
            BasicMsg::displayMsgNL($msg, 'red', 'bold');
149
        }
150
    }
151
152
    /**
153
     * Return the Action class to use for do asked actions
154
     *
155
     * @return \BFW\Install\ModuleManager\Actions
156
     */
157
    protected function obtainActionClass(): Actions
158
    {
159
        return new Actions($this);
160
    }
161
}
162