Code Duplication    Length = 21-21 lines in 3 locations

lib/Service/FilesService.php 3 locations

@@ 853-873 (lines=21) @@
850
	 *
851
	 * @throws NotPermittedException
852
	 */
853
	private function extractContentFromFilePDF(FilesDocument $document, File $file) {
854
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
855
			!== self::MIMETYPE_PDF) {
856
			return;
857
		}
858
859
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF);
860
		if (!$this->isSourceIndexable($document)) {
861
			return;
862
		}
863
864
		if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') {
865
			$document->setContent('');
866
867
			return;
868
		}
869
870
		$document->setContent(
871
			base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64
872
		);
873
	}
874
875
876
	/**
@@ 882-902 (lines=21) @@
879
	 *
880
	 * @throws NotPermittedException
881
	 */
882
	private function extractContentFromFileZip(FilesDocument $document, File $file) {
883
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
884
			!== self::MIMETYPE_ZIP) {
885
			return;
886
		}
887
888
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_ZIP);
889
		if (!$this->isSourceIndexable($document)) {
890
			return;
891
		}
892
893
		if ($this->configService->getAppValue(ConfigService::FILES_ZIP) !== '1') {
894
			$document->setContent('');
895
896
			return;
897
		}
898
899
		$document->setContent(
900
			base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64
901
		);
902
	}
903
904
905
	/**
@@ 911-931 (lines=21) @@
908
	 *
909
	 * @throws NotPermittedException
910
	 */
911
	private function extractContentFromFileOffice(FilesDocument $document, File $file) {
912
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
913
			!== self::MIMETYPE_OFFICE) {
914
			return;
915
		}
916
917
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE);
918
		if (!$this->isSourceIndexable($document)) {
919
			return;
920
		}
921
922
		if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') {
923
			$document->setContent('');
924
925
			return;
926
		}
927
928
		$document->setContent(
929
			base64_encode($file->getContent()), IndexDocument::ENCODED_BASE64
930
		);
931
	}
932
933
934
	/**