Code Duplication    Length = 8-11 lines in 2 locations

src/Path/Path.php 2 locations

@@ 147-154 (lines=8) @@
144
145
                if (is_dir($path . '/' . $file)) {
146
                    // add dir
147
                    if ($mode === 'dir') {
148
                        // continue if no regex filter match
149
                        if ($filter && !preg_match($filter, $file)) {
150
                            continue;
151
                        }
152
153
                        $files[] = $prefix . $file;
154
                    }
155
156
                    // continue if not recursive
157
                    if (!$recursive) {
@@ 167-177 (lines=11) @@
164
                        $this->_list($path . '/' . $file, $prefix . $file . '/', $mode, $recursive, $filter)
165
                    );
166
167
                } else {
168
                    // add file
169
                    if ($mode === 'file') {
170
                        // continue if no regex filter match
171
                        if ($filter && !preg_match($filter, $file)) {
172
                            continue;
173
                        }
174
175
                        $files[] = $prefix.$file;
176
                    }
177
                }
178
            }
179
        }
180