Code Duplication    Length = 14-14 lines in 2 locations

src/controllers/AbstractController.php 1 location

@@ 102-115 (lines=14) @@
99
        return $this->_after;
100
    }
101
102
    public function normalizeTasks($tasks)
103
    {
104
        if (!$tasks) {
105
            return [];
106
        } elseif (!is_array($tasks)) {
107
            $tasks = [(string) $tasks => 1];
108
        }
109
        $res = [];
110
        foreach ($tasks as $dep => $enabled) {
111
            $res[(string) (is_int($dep) ? $enabled : $dep)] = (bool) (is_int($dep) ? 1 : $enabled);
112
        }
113
114
        return $res;
115
    }
116
117
    /**
118
     * Runs array of requests. Stops on failure and returns exit code.

src/controllers/CommonBehavior.php 1 location

@@ 51-64 (lines=14) @@
48
        }
49
    }
50
51
    public function normalizeTasks($tasks)
52
    {
53
        if (!$tasks) {
54
            return [];
55
        } elseif (!is_array($tasks)) {
56
            $tasks = [(string) $tasks => 1];
57
        }
58
        $res = [];
59
        foreach ($tasks as $dep => $enabled) {
60
            $res[(string) (is_int($dep) ? $enabled : $dep)] = (bool) (is_int($dep) ? 1 : $enabled);
61
        }
62
63
        return $res;
64
    }
65
66
    /**
67
     * Is response NOT Ok.