Code Duplication    Length = 19-23 lines in 2 locations

cloudcontrol/library/storage/storage/ImagesStorage.php 1 location

@@ 65-87 (lines=23) @@
62
	 * Delete image by name
63
	 * @param $filename
64
	 */
65
	public function deleteImageByName($filename)
66
	{
67
		$destinationPath = realpath(__DIR__ . '/../../../www/images/');
68
69
		$images = $this->getImages();
70
71
		foreach ($images as $key => $image) {
72
			if ($image->file == $filename) {
73
				foreach ($image->set as $imageSetFilename) {
74
					$destination = $destinationPath . '/' . $imageSetFilename;
75
					if (file_exists($destination)) {
76
						unlink($destination);
77
					} else {
78
						dump($destination);
79
					}
80
				}
81
				unset($images[$key]);
82
			}
83
		}
84
85
		$this->repository->images = $images;
86
		$this->save();
87
	}
88
89
	/**
90
	 * @param $filename

cloudcontrol/library/storage/storage/FilesStorage.php 1 location

@@ 74-92 (lines=19) @@
71
	 *
72
	 * @throws \Exception
73
	 */
74
	public function deleteFileByName($filename)
75
	{
76
		$destinationPath = realpath(__DIR__ . '/../../../www/files/');
77
		$destination = $destinationPath . '/' . $filename;
78
79
		if (file_exists($destination)) {
80
			$files = $this->getFiles();
81
			foreach ($files as $key => $file) {
82
				if ($file->file == $filename) {
83
					unlink($destination);
84
					unset($files[$key]);
85
				}
86
			}
87
88
			$files = array_values($files);
89
			$this->repository->files = $files;
90
			$this->save();
91
		}
92
	}
93
94
	/**
95
	 * @param $a