Code Duplication    Length = 6-6 lines in 3 locations

cloudcontrol/library/storage/JsonStorage.php 3 locations

@@ 264-269 (lines=6) @@
261
				// Check folder duplicate child
262
				$containerFolder = $this->getDocumentFolderBySlug($postValues['path']);
263
				if (isset($containerFolder->content)) {
264
					foreach ($containerFolder->content as $document) {
265
						if ($document->slug == $documentFolderObject->slug && $document->type == 'document') {
266
							// TODO make it so it doesnt throw an exception, but instead shows a warning
267
							throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
268
						}
269
					}
270
				}
271
				$containerFolder->content[] = $documentFolderObject;
272
			}
@@ 382-387 (lines=6) @@
379
			$documentFolderObject = $this->createDocumentFolderFromPostValues($postValues);
380
			if ($postValues['path'] == '' || $postValues['path'] == '/') {
381
				// Check folder duplicate child
382
				foreach ($this->repository->documents as $document) {
383
					if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') {
384
						// TODO make it so it doesnt throw an exception, but instead shows a warning
385
						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
386
					}
387
				}
388
				$this->repository->documents[] = $documentFolderObject;
389
			} else {
390
				$documentContainer = $this->getDocumentContainerByPath($postValues['path']);
@@ 403-408 (lines=6) @@
400
401
				}
402
				// Check folder duplicate child
403
				foreach ($containerFolder->content as $document) {
404
					if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') {
405
						// TODO make it so it doesnt throw an exception, but instead shows a warning
406
						throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']);
407
					}
408
				}
409
				$folder->content[] = $documentFolderObject;
410
			}
411
			$this->save();