Code Duplication    Length = 21-21 lines in 3 locations

lib/Service/FilesService.php 3 locations

@@ 939-959 (lines=21) @@
936
	 *
937
	 * @throws NotPermittedException
938
	 */
939
	private function extractContentFromFilePDF(FilesDocument $document, File $file) {
940
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
941
			!== self::MIMETYPE_PDF) {
942
			return;
943
		}
944
945
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_PDF);
946
		if (!$this->isSourceIndexable($document)) {
947
			return;
948
		}
949
950
		if ($this->configService->getAppValue(ConfigService::FILES_PDF) !== '1') {
951
			$document->setContent('');
952
953
			return;
954
		}
955
956
		$document->setContent(
957
			base64_encode($file->getContent()), IIndexDocument::ENCODED_BASE64
958
		);
959
	}
960
961
962
	/**
@@ 968-988 (lines=21) @@
965
	 *
966
	 * @throws NotPermittedException
967
	 */
968
	private function extractContentFromFileZip(FilesDocument $document, File $file) {
969
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
970
			!== self::MIMETYPE_ZIP) {
971
			return;
972
		}
973
974
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_ZIP);
975
		if (!$this->isSourceIndexable($document)) {
976
			return;
977
		}
978
979
		if ($this->configService->getAppValue(ConfigService::FILES_ZIP) !== '1') {
980
			$document->setContent('');
981
982
			return;
983
		}
984
985
		$document->setContent(
986
			base64_encode($file->getContent()), IIndexDocument::ENCODED_BASE64
987
		);
988
	}
989
990
991
	/**
@@ 997-1017 (lines=21) @@
994
	 *
995
	 * @throws NotPermittedException
996
	 */
997
	private function extractContentFromFileOffice(FilesDocument $document, File $file) {
998
		if ($this->parseMimeType($document->getMimeType(), $file->getExtension())
999
			!== self::MIMETYPE_OFFICE) {
1000
			return;
1001
		}
1002
1003
		$this->configService->setDocumentIndexOption($document, ConfigService::FILES_OFFICE);
1004
		if (!$this->isSourceIndexable($document)) {
1005
			return;
1006
		}
1007
1008
		if ($this->configService->getAppValue(ConfigService::FILES_OFFICE) !== '1') {
1009
			$document->setContent('');
1010
1011
			return;
1012
		}
1013
1014
		$document->setContent(
1015
			base64_encode($file->getContent()), IIndexDocument::ENCODED_BASE64
1016
		);
1017
	}
1018
1019
1020
	/**