Code Duplication    Length = 4-5 lines in 2 locations

src/View/Helper/LessHelper.php 2 locations

@@ 177-181 (lines=5) @@
174
            dump($path);
175
            dump($plgPath);
176
            dump(preg_match('(' . quotemeta($plgPath) . ')', $path));
177
            if (preg_match('(' . quotemeta($plgPath) . ')', $path)) {
178
                $path = str_replace($plgPath, '', $path);
179
                dump($path);
180
                return [true, $path];
181
            }
182
        }
183
184
        foreach (Configure::read('plugins') as $name => $plgPath) {
@@ 186-189 (lines=4) @@
183
184
        foreach (Configure::read('plugins') as $name => $plgPath) {
185
            $plgPath = FS::clean($plgPath, '/');
186
            if (preg_match('(' . quotemeta($plgPath) . ')', $path)) {
187
                $path = Str::low($name) . '/' . str_replace($plgPath, '', $path);
188
                return [true, $path];
189
            }
190
        }
191
192
        return [$isPlugin, $path];