Code Duplication    Length = 8-11 lines in 2 locations

src/Path/Path.php 2 locations

@@ 119-126 (lines=8) @@
116
117
                if (is_dir($path . '/' . $file)) {
118
                    // add dir
119
                    if ($mode === 'dir') {
120
                        // continue if no regex filter match
121
                        if ($filter && !preg_match($filter, $file)) {
122
                            continue;
123
                        }
124
125
                        $files[] = $prefix . $file;
126
                    }
127
128
                    // continue if not recursive
129
                    if (!$recursive) {
@@ 139-149 (lines=11) @@
136
                        $this->_list($path . '/' . $file, $prefix . $file . '/', $mode, $recursive, $filter)
137
                    );
138
139
                } else {
140
                    // add file
141
                    if ($mode === 'file') {
142
                        // continue if no regex filter match
143
                        if ($filter && !preg_match($filter, $file)) {
144
                            continue;
145
                        }
146
147
                        $files[] = $prefix.$file;
148
                    }
149
                }
150
            }
151
        }
152