Code Duplication    Length = 8-11 lines in 2 locations

src/Path/Path.php 2 locations

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