Code Duplication    Length = 14-14 lines in 2 locations

lib/Service/FileService.php 2 locations

@@ 189-202 (lines=14) @@
186
            // '/' => '' || '/Test/' => 'Test'
187
            $filePath = substr_replace($filePath, '', $pos, strlen('/'));
188
        }
189
        if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
190
            // PDFs:
191
            if ($replace) {
192
                if($filePath === '/') {
193
                    $filePath = '';
194
                }
195
                return $filePath . '/'. $fileName . '.pdf';
196
            } else {
197
                return $this->fileUtil->buildNotExistingFilename($filePath, $fileName . '.pdf');
198
            }
199
        } else {
200
            // IMAGES:
201
            return $this->fileUtil->buildNotExistingFilename($filePath, $fileName . '.pdf');
202
        }
203
    }
204
205
    /**
@@ 231-244 (lines=14) @@
228
            // '/Test' => '// 'Test' || '/' => ''
229
            $filePath = substr_replace($filePath, '', $pos, strlen('/'));
230
        }
231
        if ($fileInfo->getMimetype() === OcrConstants::MIME_TYPE_PDF) {
232
            // PDFs:
233
            if ($replace) {
234
                if($filePath === '/') {
235
                    $filePath = '';
236
                }
237
                return $filePath . '/' . $fileName . '.pdf';
238
            } else {
239
                return $this->fileUtil->buildNotExistingFilename($filePath, $fileName . '.pdf');
240
            }
241
        } else {
242
            // IMAGES:
243
            return $this->fileUtil->buildNotExistingFilename($filePath, $fileName . '.pdf');
244
        }
245
    }
246
247
    /**