Code Duplication    Length = 7-9 lines in 3 locations

lib/Controller/WopiController.php 3 locations

@@ 286-294 (lines=9) @@
283
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
284
				$suggested = iconv('utf-7', 'utf-8', $suggested);
285
286
				if ($suggested[0] === '.') {
287
					$path = dirname($file->getPath()) . '/New File' . $suggested;
288
				}
289
				else if ($suggested[0] !== '/') {
290
					$path = dirname($file->getPath()) . '/' . $suggested;
291
				}
292
				else {
293
					$path = $userFolder->getPath() . $suggested;
294
				}
295
296
				if ($path === '') {
297
					return new JSONResponse([
@@ 399-405 (lines=7) @@
396
397
				$suggested = iconv('utf-7', 'utf-8', $suggested) . '.' . $file->getExtension();
398
399
				if ($suggested[0] === '.') {
400
					$path = dirname($file->getPath()) . '/New File' . $suggested;
401
				}
402
				else if ($suggested[0] !== '/') {
403
					$path = dirname($file->getPath()) . '/' . $suggested;
404
				}
405
				else {
406
					$path = $userFolder->getPath() . $suggested;
407
				}
408
@@ 432-438 (lines=7) @@
429
				$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
430
				$suggested = iconv('utf-7', 'utf-8', $suggested);
431
432
				if ($suggested[0] === '.') {
433
					$path = dirname($file->getPath()) . '/New File' . $suggested;
434
				} else if ($suggested[0] !== '/') {
435
					$path = dirname($file->getPath()) . '/' . $suggested;
436
				} else {
437
					$path = $userFolder->getPath() . $suggested;
438
				}
439
440
				if ($path === '') {
441
					return new JSONResponse([