1 | <?php |
||
2 | /** |
||
3 | * Automation tool mixed with code generator for easier continuous development |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/hidev |
||
6 | * @package hidev |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hidev\base; |
||
12 | |||
13 | use hidev\console\CommonBehavior; |
||
14 | use hidev\helpers\Helper; |
||
15 | |||
16 | /** |
||
17 | * Basic controller. |
||
18 | */ |
||
19 | abstract class Controller extends \yii\console\Controller |
||
20 | { |
||
21 | use GettersTrait; |
||
22 | |||
23 | public $layout = false; |
||
24 | |||
25 | protected $_before = []; |
||
26 | protected $_after = []; |
||
27 | |||
28 | 1 | public function behaviors() |
|
29 | { |
||
30 | return [ |
||
31 | 1 | CommonBehavior::class, |
|
32 | ]; |
||
33 | } |
||
34 | |||
35 | 1 | public function setBefore($requests) |
|
36 | { |
||
37 | 1 | $this->_before = array_merge($this->getBefore(), $this->normalizeTasks($requests)); |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
38 | 1 | } |
|
39 | |||
40 | 1 | public function getBefore() |
|
41 | { |
||
42 | 1 | return $this->_before; |
|
43 | } |
||
44 | |||
45 | public function setAfter($requests) |
||
46 | { |
||
47 | $this->_after = array_merge($this->getAfter(), $this->normalizeTasks($requests)); |
||
48 | } |
||
49 | |||
50 | public function getAfter() |
||
51 | { |
||
52 | return $this->_after; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Runs list of actions. |
||
57 | * @param null|string|array $actions |
||
58 | * @return int|Response exit code |
||
0 ignored issues
–
show
The type
hidev\base\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
59 | */ |
||
60 | public function runActions($actions) |
||
61 | { |
||
62 | foreach ($this->normalizeTasks($actions) as $action => $enabled) { |
||
63 | if ($enabled) { |
||
64 | $res = $this->runAction($action); |
||
65 | if (!Helper::isResponseOk($res)) { |
||
66 | return $res; |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 | |||
71 | return 0; |
||
72 | } |
||
73 | } |
||
74 |