Code Duplication    Length = 10-11 lines in 2 locations

cloudcontrol/library/storage/JsonStorage.php 2 locations

@@ 241-251 (lines=11) @@
238
			$this->repository->saveDocument($documentObject);
239
		}
240
241
		public function addDocument($postValues)
242
		{
243
			$documentObject = DocumentFactory::createDocumentFromPostValues($postValues, $this);
244
			if ($postValues['path'] === '/') {
245
				$documentObject->path = $postValues['path'] . $documentObject->slug;
246
			} else {
247
				$documentObject->path = $postValues['path'] . '/' . $documentObject->slug;
248
			}
249
250
			$this->repository->saveDocument($documentObject);
251
		}
252
253
		public function deleteDocumentBySlug($slug)
254
		{
@@ 266-275 (lines=10) @@
263
		 *
264
		 * @throws \Exception
265
		 */
266
		public function addDocumentFolder($postValues)
267
		{
268
			$documentFolderObject = DocumentFolderFactory::createDocumentFolderFromPostValues($postValues);
269
			if ($postValues['path'] === '/') {
270
				$documentFolderObject->path = $postValues['path'] . $documentFolderObject->slug;
271
			} else {
272
				$documentFolderObject->path = $postValues['path'] . '/' . $documentFolderObject->slug;
273
			}
274
			$this->repository->saveDocument($documentFolderObject);
275
		}
276
277
		/**
278
		 * Delete a folder by its compound slug