Code Duplication    Length = 11-13 lines in 3 locations

src/controllers/AbstractController.php 2 locations

@@ 122-134 (lines=13) @@
119
     * @param null|string|array $requests
120
     * @return int|Response exit code
121
     */
122
    public function runRequests($requests)
123
    {
124
        foreach ($this->normalizeTasks($requests) as $request => $enabled) {
125
            if ($enabled) {
126
                $res = $this->runRequest($request);
127
                if (static::isNotOk($res)) {
128
                    return $res;
129
                }
130
            }
131
        }
132
133
        return 0;
134
    }
135
136
    public function runRequest($request)
137
    {
@@ 167-179 (lines=13) @@
164
     * @param null|string|array $actions
165
     * @return int|Response exit code
166
     */
167
    public function runActions($actions)
168
    {
169
        foreach ($this->normalizeTasks($actions) as $action => $enabled) {
170
            if ($enabled) {
171
                $res = $this->runAction($action);
172
                if (static::isNotOk($res)) {
173
                    return $res;
174
                }
175
            }
176
        }
177
178
        return 0;
179
    }
180
181
    public function runAction($id, $params = [])
182
    {

src/controllers/CommonBehavior.php 1 location

@@ 39-49 (lines=11) @@
36
        $this->runRequests($event->sender->after);
37
    }
38
39
    public function runRequests($requests)
40
    {
41
        foreach ($this->normalizeTasks($requests) as $request => $enabled) {
42
            if ($enabled) {
43
                $response = $this->runRequest($request);
44
                if ($this->isNotOk($response)) {
45
                    return $response;
46
                }
47
            }
48
        }
49
    }
50
51
    public function normalizeTasks($tasks)
52
    {