Code Duplication    Length = 12-13 lines in 2 locations

cloudcontrol/library/storage/JsonStorage.php 2 locations

@@ 862-873 (lines=12) @@
859
		 *
860
		 * @throws \Exception
861
		 */
862
		public function deleteDocumentTypeBySlug($slug)
863
		{
864
			$documentTypes = $this->repository->documentTypes;
865
			foreach ($documentTypes as $key => $documentTypeObject) {
866
				if ($documentTypeObject->slug == $slug) {
867
					unset($documentTypes[$key]);
868
				}
869
			}
870
			$documentTypes = array_values($documentTypes);
871
			$this->repository->documentTypes = $documentTypes;
872
			$this->save();
873
		}
874
875
		/**
876
		 * Get document type by its slug
@@ 912-924 (lines=13) @@
909
		 *
910
		 * @throws \Exception
911
		 */
912
		public function saveDocumentType($slug, $postValues)
913
		{
914
			$documentTypeObject = $this->createDocumentTypeFromPostValues($postValues);
915
			
916
			$documentTypes = $this->repository->documentTypes;
917
			foreach ($documentTypes as $key => $documentType) {
918
				if ($documentType->slug == $slug) {
919
					$documentTypes[$key] = $documentTypeObject;
920
				}
921
			}
922
			$this->repository->documentTypes = $documentTypes;
923
			$this->save();
924
		}
925
		
926
		/*
927
		 *