Code Duplication    Length = 14-15 lines in 2 locations

src/File.php 2 locations

@@ 155-168 (lines=14) @@
152
     *
153
     * @return File
154
     */
155
    public function upOne()
156
    {
157
        $dir = $this->getDir();
158
        $pattern = $this->getPattern();
159
160
        if ($this->find($pattern)->in($dir)->has() === false) {
161
            $dir = dirname($dir);
162
            $this->file_list = $this->find($pattern)->in($dir)->get();
163
        } else {
164
            $this->file_list = $this->find($pattern)->in($dir)->get();
165
        }
166
167
        return $this;
168
    }
169
170
    /**
171
     * Recursively searches parent directories.
@@ 177-191 (lines=15) @@
174
     *
175
     * @return File
176
     */
177
    public function up()
178
    {
179
        $dir = $this->getDir();
180
        $pattern = $this->getPattern();
181
182
        if ($this->find($pattern)->in($dir)->has() === false) {
183
            $dir = dirname($dir);
184
185
            $this->file_list = $this->find($pattern)->in($dir)->up()->get();
186
        } else {
187
            $this->file_list = $this->find($pattern)->in($dir)->get();
188
        }
189
190
        return $this;
191
    }
192
193
    /**
194
     * Return specified amount of files