@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | use TYPO3\CMS\Extbase\Object\ObjectManager; |
17 | 17 | use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; |
18 | 18 | |
19 | -class SolrIndexingTest extends FunctionalTestCase |
|
20 | -{ |
|
19 | +class SolrIndexingTest extends FunctionalTestCase { |
|
21 | 20 | /** @var PersistenceManager */ |
22 | 21 | protected $persistenceManager; |
23 | 22 | |
@@ -51,8 +50,7 @@ discard block |
||
51 | 50 | /** |
52 | 51 | * @test |
53 | 52 | */ |
54 | - public function canCreateCore() |
|
55 | - { |
|
53 | + public function canCreateCore() { |
|
56 | 54 | $coreName = uniqid('testCore'); |
57 | 55 | $solr = Solr::getInstance($coreName); |
58 | 56 | $this->assertNull($solr->core); |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | /** |
68 | 66 | * @test |
69 | 67 | */ |
70 | - public function canIndexAndSearchDocument() |
|
71 | - { |
|
68 | + public function canIndexAndSearchDocument() { |
|
72 | 69 | $core = $this->createSolrCore(); |
73 | 70 | |
74 | 71 | $document = $this->documentRepository->findByUid(1001); |
@@ -108,8 +105,7 @@ discard block |
||
108 | 105 | /** |
109 | 106 | * @test |
110 | 107 | */ |
111 | - public function canSearchInCollections() |
|
112 | - { |
|
108 | + public function canSearchInCollections() { |
|
113 | 109 | $core = $this->createSolrCore(); |
114 | 110 | |
115 | 111 | $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.xml'); |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class CalendarController extends AbstractController |
|
30 | -{ |
|
29 | +class CalendarController extends AbstractController { |
|
31 | 30 | /** |
32 | 31 | * @var StructureRepository |
33 | 32 | */ |
@@ -36,8 +35,7 @@ discard block |
||
36 | 35 | /** |
37 | 36 | * @param StructureRepository $structureRepository |
38 | 37 | */ |
39 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
40 | - { |
|
38 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
41 | 39 | $this->structureRepository = $structureRepository; |
42 | 40 | } |
43 | 41 | |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return void |
56 | 54 | */ |
57 | - public function mainAction() |
|
58 | - { |
|
55 | + public function mainAction() { |
|
59 | 56 | // Set initial document (anchor or year file) if configured. |
60 | 57 | if (empty($this->requestData['id']) && !empty($this->settings['initialDocument'])) { |
61 | 58 | $this->requestData['id'] = $this->settings['initialDocument']; |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | * |
101 | 98 | * @return void |
102 | 99 | */ |
103 | - public function calendarAction() |
|
104 | - { |
|
100 | + public function calendarAction() { |
|
105 | 101 | // access arguments passed by the mainAction() |
106 | 102 | $mainrequestData = $this->request->getArguments(); |
107 | 103 | |
@@ -206,8 +202,7 @@ discard block |
||
206 | 202 | * |
207 | 203 | * @return void |
208 | 204 | */ |
209 | - public function yearsAction() |
|
210 | - { |
|
205 | + public function yearsAction() { |
|
211 | 206 | // access arguments passed by the mainAction() |
212 | 207 | $mainrequestData = $this->request->getArguments(); |
213 | 208 | |
@@ -262,8 +257,7 @@ discard block |
||
262 | 257 | * |
263 | 258 | * @return string Content for template subpart |
264 | 259 | */ |
265 | - protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12) |
|
266 | - { |
|
260 | + protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12) { |
|
267 | 261 | for ($i = $firstMonth; $i <= $lastMonth; $i++) { |
268 | 262 | $key = $year . '-' . $i; |
269 | 263 |
@@ -21,13 +21,11 @@ |
||
21 | 21 | * @subpackage dlf |
22 | 22 | * @access public |
23 | 23 | */ |
24 | -class View3DController extends AbstractController |
|
25 | -{ |
|
24 | +class View3DController extends AbstractController { |
|
26 | 25 | /** |
27 | 26 | * @return string|void |
28 | 27 | */ |
29 | - public function mainAction() |
|
30 | - { |
|
28 | + public function mainAction() { |
|
31 | 29 | $this->cObj = $this->configurationManager->getContentObject(); |
32 | 30 | // Load current document. |
33 | 31 | $this->loadDocument($this->requestData); |
@@ -35,8 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
39 | - { |
|
38 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
40 | 39 | $xml->registerXPathNamespace('audiomd', 'http://www.loc.gov/audioMD/'); |
41 | 40 | $xml->registerXPathNamespace('videomd', 'http://www.loc.gov/videoMD/'); |
42 | 41 |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | * @property-read string $toplevelId This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF) |
50 | 50 | * @abstract |
51 | 51 | */ |
52 | -abstract class Doc |
|
53 | -{ |
|
52 | +abstract class Doc { |
|
54 | 53 | /** |
55 | 54 | * This holds the logger |
56 | 55 | * |
@@ -326,8 +325,7 @@ discard block |
||
326 | 325 | * |
327 | 326 | * @return void |
328 | 327 | */ |
329 | - public static function clearRegistry() |
|
330 | - { |
|
328 | + public static function clearRegistry() { |
|
331 | 329 | // Reset registry array. |
332 | 330 | self::$registry = []; |
333 | 331 | } |
@@ -505,8 +503,7 @@ discard block |
||
505 | 503 | * |
506 | 504 | * @return int The physical page number |
507 | 505 | */ |
508 | - public function getPhysicalPage($logicalPage) |
|
509 | - { |
|
506 | + public function getPhysicalPage($logicalPage) { |
|
510 | 507 | if ( |
511 | 508 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
512 | 509 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -551,8 +548,7 @@ discard block |
||
551 | 548 | * |
552 | 549 | * @return string The OCR full text |
553 | 550 | */ |
554 | - protected function getFullTextFromXml($id) |
|
555 | - { |
|
551 | + protected function getFullTextFromXml($id) { |
|
556 | 552 | $fullText = ''; |
557 | 553 | // Load available text formats, ... |
558 | 554 | $this->loadFormats(); |
@@ -614,8 +610,7 @@ discard block |
||
614 | 610 | * |
615 | 611 | * @return string The format of the OCR full text |
616 | 612 | */ |
617 | - private function getTextFormat($fileContent) |
|
618 | - { |
|
613 | + private function getTextFormat($fileContent) { |
|
619 | 614 | $xml = Helper::getXmlFileAsString($fileContent); |
620 | 615 | |
621 | 616 | if ($xml !== false) { |
@@ -638,8 +633,7 @@ discard block |
||
638 | 633 | * |
639 | 634 | * @return string The title of the document itself or a parent document |
640 | 635 | */ |
641 | - public static function getTitle($uid, $recursive = false) |
|
642 | - { |
|
636 | + public static function getTitle($uid, $recursive = false) { |
|
643 | 637 | $title = ''; |
644 | 638 | // Sanitize input. |
645 | 639 | $uid = max(intval($uid), 0); |
@@ -691,8 +685,7 @@ discard block |
||
691 | 685 | * |
692 | 686 | * @return array The logical structure node's / resource's parsed metadata array |
693 | 687 | */ |
694 | - public function getTitledata($cPid = 0) |
|
695 | - { |
|
688 | + public function getTitledata($cPid = 0) { |
|
696 | 689 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
697 | 690 | // Add information from METS structural map to titledata array. |
698 | 691 | if ($this instanceof MetsDocument) { |
@@ -725,8 +718,7 @@ discard block |
||
725 | 718 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
726 | 719 | * or the actual depth. |
727 | 720 | */ |
728 | - protected function getTreeDepth($structure, $depth, $logId) |
|
729 | - { |
|
721 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
730 | 722 | foreach ($structure as $element) { |
731 | 723 | if ($element['id'] == $logId) { |
732 | 724 | return $depth; |
@@ -748,8 +740,7 @@ discard block |
||
748 | 740 | * @param string $logId: The id of the logical structure element whose depth is requested |
749 | 741 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
750 | 742 | */ |
751 | - public function getStructureDepth($logId) |
|
752 | - { |
|
743 | + public function getStructureDepth($logId) { |
|
753 | 744 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
754 | 745 | } |
755 | 746 | |
@@ -801,8 +792,7 @@ discard block |
||
801 | 792 | * |
802 | 793 | * @return bool true on success or false on failure |
803 | 794 | */ |
804 | - protected function load($location) |
|
805 | - { |
|
795 | + protected function load($location) { |
|
806 | 796 | // Load XML / JSON-LD file. |
807 | 797 | if (GeneralUtility::isValidUrl($location)) { |
808 | 798 | // the actual loading is format specific |
@@ -829,8 +819,7 @@ discard block |
||
829 | 819 | * |
830 | 820 | * @return void |
831 | 821 | */ |
832 | - protected function loadFormats() |
|
833 | - { |
|
822 | + protected function loadFormats() { |
|
834 | 823 | if (!$this->formatsLoaded) { |
835 | 824 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
836 | 825 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -870,8 +859,7 @@ discard block |
||
870 | 859 | * |
871 | 860 | * @return void |
872 | 861 | */ |
873 | - public function registerNamespaces(&$obj) |
|
874 | - { |
|
862 | + public function registerNamespaces(&$obj) { |
|
875 | 863 | // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions. |
876 | 864 | $this->loadFormats(); |
877 | 865 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -896,8 +884,7 @@ discard block |
||
896 | 884 | * |
897 | 885 | * @return int The PID of the metadata definitions |
898 | 886 | */ |
899 | - protected function _getCPid() |
|
900 | - { |
|
887 | + protected function _getCPid() { |
|
901 | 888 | return $this->cPid; |
902 | 889 | } |
903 | 890 | |
@@ -908,8 +895,7 @@ discard block |
||
908 | 895 | * |
909 | 896 | * @return bool Are there any fulltext files available? |
910 | 897 | */ |
911 | - protected function _getHasFulltext() |
|
912 | - { |
|
898 | + protected function _getHasFulltext() { |
|
913 | 899 | $this->ensureHasFulltextIsSet(); |
914 | 900 | return $this->hasFulltext; |
915 | 901 | } |
@@ -921,8 +907,7 @@ discard block |
||
921 | 907 | * |
922 | 908 | * @return string The location of the document |
923 | 909 | */ |
924 | - protected function _getLocation() |
|
925 | - { |
|
910 | + protected function _getLocation() { |
|
926 | 911 | return $this->location; |
927 | 912 | } |
928 | 913 | |
@@ -944,8 +929,7 @@ discard block |
||
944 | 929 | * |
945 | 930 | * @return array Array of metadata with their corresponding logical structure node ID as key |
946 | 931 | */ |
947 | - protected function _getMetadataArray() |
|
948 | - { |
|
932 | + protected function _getMetadataArray() { |
|
949 | 933 | // Set metadata definitions' PID. |
950 | 934 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
951 | 935 | if (!$cPid) { |
@@ -970,8 +954,7 @@ discard block |
||
970 | 954 | * |
971 | 955 | * @return int The total number of pages and/or tracks |
972 | 956 | */ |
973 | - protected function _getNumPages() |
|
974 | - { |
|
957 | + protected function _getNumPages() { |
|
975 | 958 | $this->_getPhysicalStructure(); |
976 | 959 | return $this->numPages; |
977 | 960 | } |
@@ -983,8 +966,7 @@ discard block |
||
983 | 966 | * |
984 | 967 | * @return int The UID of the parent document or zero if not applicable |
985 | 968 | */ |
986 | - protected function _getParentId() |
|
987 | - { |
|
969 | + protected function _getParentId() { |
|
988 | 970 | return $this->parentId; |
989 | 971 | } |
990 | 972 | |
@@ -1007,8 +989,7 @@ discard block |
||
1007 | 989 | * |
1008 | 990 | * @return array Array of elements' type, label and file representations ordered by "@ID" attribute / Canvas order |
1009 | 991 | */ |
1010 | - protected function _getPhysicalStructureInfo() |
|
1011 | - { |
|
992 | + protected function _getPhysicalStructureInfo() { |
|
1012 | 993 | // Is there no physical structure array yet? |
1013 | 994 | if (!$this->physicalStructureLoaded) { |
1014 | 995 | // Build physical structure array. |
@@ -1024,8 +1005,7 @@ discard block |
||
1024 | 1005 | * |
1025 | 1006 | * @return int The PID of the document or zero if not in database |
1026 | 1007 | */ |
1027 | - protected function _getPid() |
|
1028 | - { |
|
1008 | + protected function _getPid() { |
|
1029 | 1009 | return $this->pid; |
1030 | 1010 | } |
1031 | 1011 | |
@@ -1036,8 +1016,7 @@ discard block |
||
1036 | 1016 | * |
1037 | 1017 | * @return bool Is the document instantiated successfully? |
1038 | 1018 | */ |
1039 | - protected function _getReady() |
|
1040 | - { |
|
1019 | + protected function _getReady() { |
|
1041 | 1020 | return $this->ready; |
1042 | 1021 | } |
1043 | 1022 | |
@@ -1048,8 +1027,7 @@ discard block |
||
1048 | 1027 | * |
1049 | 1028 | * @return mixed The METS file's / IIIF manifest's record identifier |
1050 | 1029 | */ |
1051 | - protected function _getRecordId() |
|
1052 | - { |
|
1030 | + protected function _getRecordId() { |
|
1053 | 1031 | return $this->recordId; |
1054 | 1032 | } |
1055 | 1033 | |
@@ -1060,8 +1038,7 @@ discard block |
||
1060 | 1038 | * |
1061 | 1039 | * @return int The UID of the root document or zero if not applicable |
1062 | 1040 | */ |
1063 | - protected function _getRootId() |
|
1064 | - { |
|
1041 | + protected function _getRootId() { |
|
1065 | 1042 | if (!$this->rootIdLoaded) { |
1066 | 1043 | if ($this->parentId) { |
1067 | 1044 | $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]); |
@@ -1091,8 +1068,7 @@ discard block |
||
1091 | 1068 | * |
1092 | 1069 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
1093 | 1070 | */ |
1094 | - protected function _getTableOfContents() |
|
1095 | - { |
|
1071 | + protected function _getTableOfContents() { |
|
1096 | 1072 | // Is there no logical structure array yet? |
1097 | 1073 | if (!$this->tableOfContentsLoaded) { |
1098 | 1074 | // Get all logical structures. |
@@ -1133,8 +1109,7 @@ discard block |
||
1133 | 1109 | * |
1134 | 1110 | * @return mixed The UID or the URL of the document |
1135 | 1111 | */ |
1136 | - protected function _getUid() |
|
1137 | - { |
|
1112 | + protected function _getUid() { |
|
1138 | 1113 | return $this->uid; |
1139 | 1114 | } |
1140 | 1115 | |
@@ -1147,8 +1122,7 @@ discard block |
||
1147 | 1122 | * |
1148 | 1123 | * @return void |
1149 | 1124 | */ |
1150 | - protected function _setCPid($value) |
|
1151 | - { |
|
1125 | + protected function _setCPid($value) { |
|
1152 | 1126 | $this->cPid = max(intval($value), 0); |
1153 | 1127 | } |
1154 | 1128 | |
@@ -1165,8 +1139,7 @@ discard block |
||
1165 | 1139 | * |
1166 | 1140 | * @return void |
1167 | 1141 | */ |
1168 | - protected function __construct($location, $pid, $preloadedDocument) |
|
1169 | - { |
|
1142 | + protected function __construct($location, $pid, $preloadedDocument) { |
|
1170 | 1143 | $this->pid = $pid; |
1171 | 1144 | $this->setPreloadedDocument($preloadedDocument); |
1172 | 1145 | $this->init($location); |
@@ -1183,8 +1156,7 @@ discard block |
||
1183 | 1156 | * |
1184 | 1157 | * @return mixed Value of $this->$var |
1185 | 1158 | */ |
1186 | - public function __get($var) |
|
1187 | - { |
|
1159 | + public function __get($var) { |
|
1188 | 1160 | $method = '_get' . ucfirst($var); |
1189 | 1161 | if ( |
1190 | 1162 | !property_exists($this, $var) |
@@ -1206,8 +1178,7 @@ discard block |
||
1206 | 1178 | * |
1207 | 1179 | * @return bool true if variable is set and not empty, false otherwise |
1208 | 1180 | */ |
1209 | - public function __isset($var) |
|
1210 | - { |
|
1181 | + public function __isset($var) { |
|
1211 | 1182 | return !empty($this->__get($var)); |
1212 | 1183 | } |
1213 | 1184 | |
@@ -1221,8 +1192,7 @@ discard block |
||
1221 | 1192 | * |
1222 | 1193 | * @return void |
1223 | 1194 | */ |
1224 | - public function __set($var, $value) |
|
1225 | - { |
|
1195 | + public function __set($var, $value) { |
|
1226 | 1196 | $method = '_set' . ucfirst($var); |
1227 | 1197 | if ( |
1228 | 1198 | !property_exists($this, $var) |
@@ -1240,8 +1210,7 @@ discard block |
||
1240 | 1210 | * @param string $location |
1241 | 1211 | * @return Doc|false |
1242 | 1212 | */ |
1243 | - private static function getDocCache(string $location) |
|
1244 | - { |
|
1213 | + private static function getDocCache(string $location) { |
|
1245 | 1214 | $cacheIdentifier = md5($location); |
1246 | 1215 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1247 | 1216 | $cacheHit = $cache->get($cacheIdentifier); |
@@ -1256,8 +1225,7 @@ discard block |
||
1256 | 1225 | * @param Doc $doc |
1257 | 1226 | * @return void |
1258 | 1227 | */ |
1259 | - private static function setDocCache(string $location, Doc $doc) |
|
1260 | - { |
|
1228 | + private static function setDocCache(string $location, Doc $doc) { |
|
1261 | 1229 | $cacheIdentifier = md5($location); |
1262 | 1230 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1263 | 1231 |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | * @param array $searchParams |
34 | 34 | * @param QueryResult $listedMetadata |
35 | 35 | */ |
36 | - public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null) |
|
37 | - { |
|
36 | + public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null) { |
|
38 | 37 | $this->documentRepository = $documentRepository; |
39 | 38 | $this->collection = $collection; |
40 | 39 | $this->settings = $settings; |
@@ -42,13 +41,11 @@ discard block |
||
42 | 41 | $this->listedMetadata = $listedMetadata; |
43 | 42 | } |
44 | 43 | |
45 | - public function getNumLoadedDocuments() |
|
46 | - { |
|
44 | + public function getNumLoadedDocuments() { |
|
47 | 45 | return count($this->result['documents']); |
48 | 46 | } |
49 | 47 | |
50 | - public function count() |
|
51 | - { |
|
48 | + public function count() { |
|
52 | 49 | if ($this->result === null) { |
53 | 50 | return 0; |
54 | 51 | } |
@@ -56,39 +53,32 @@ discard block |
||
56 | 53 | return $this->result['numberOfToplevels']; |
57 | 54 | } |
58 | 55 | |
59 | - public function current() |
|
60 | - { |
|
56 | + public function current() { |
|
61 | 57 | return $this[$this->position]; |
62 | 58 | } |
63 | 59 | |
64 | - public function key() |
|
65 | - { |
|
60 | + public function key() { |
|
66 | 61 | return $this->position; |
67 | 62 | } |
68 | 63 | |
69 | - public function next() |
|
70 | - { |
|
64 | + public function next() { |
|
71 | 65 | $this->position++; |
72 | 66 | } |
73 | 67 | |
74 | - public function rewind() |
|
75 | - { |
|
68 | + public function rewind() { |
|
76 | 69 | $this->position = 0; |
77 | 70 | } |
78 | 71 | |
79 | - public function valid() |
|
80 | - { |
|
72 | + public function valid() { |
|
81 | 73 | return isset($this[$this->position]); |
82 | 74 | } |
83 | 75 | |
84 | - public function offsetExists($offset) |
|
85 | - { |
|
76 | + public function offsetExists($offset) { |
|
86 | 77 | $idx = $this->result['document_keys'][$offset]; |
87 | 78 | return isset($this->result['documents'][$idx]); |
88 | 79 | } |
89 | 80 | |
90 | - public function offsetGet($offset) |
|
91 | - { |
|
81 | + public function offsetGet($offset) { |
|
92 | 82 | $idx = $this->result['document_keys'][$offset]; |
93 | 83 | $document = $this->result['documents'][$idx] ?? null; |
94 | 84 | |
@@ -116,38 +106,31 @@ discard block |
||
116 | 106 | return $document; |
117 | 107 | } |
118 | 108 | |
119 | - public function offsetSet($offset, $value) |
|
120 | - { |
|
109 | + public function offsetSet($offset, $value) { |
|
121 | 110 | throw new \Exception("SolrSearch: Modifying result list is not supported"); |
122 | 111 | } |
123 | 112 | |
124 | - public function offsetUnset($offset) |
|
125 | - { |
|
113 | + public function offsetUnset($offset) { |
|
126 | 114 | throw new \Exception("SolrSearch: Modifying result list is not supported"); |
127 | 115 | } |
128 | 116 | |
129 | - public function getSolrResults() |
|
130 | - { |
|
117 | + public function getSolrResults() { |
|
131 | 118 | return $this->result['solrResults']; |
132 | 119 | } |
133 | 120 | |
134 | - public function getByUid($uid) |
|
135 | - { |
|
121 | + public function getByUid($uid) { |
|
136 | 122 | return $this->result['documents'][$uid]; |
137 | 123 | } |
138 | 124 | |
139 | - public function getQuery() |
|
140 | - { |
|
125 | + public function getQuery() { |
|
141 | 126 | return new SolrSearchQuery($this); |
142 | 127 | } |
143 | 128 | |
144 | - public function getFirst() |
|
145 | - { |
|
129 | + public function getFirst() { |
|
146 | 130 | return $this[0]; |
147 | 131 | } |
148 | 132 | |
149 | - public function toArray() |
|
150 | - { |
|
133 | + public function toArray() { |
|
151 | 134 | return array_values($this->result['documents']); |
152 | 135 | } |
153 | 136 | |
@@ -156,13 +139,11 @@ discard block |
||
156 | 139 | * |
157 | 140 | * This can be accessed in Fluid template using `.numFound`. |
158 | 141 | */ |
159 | - public function getNumFound() |
|
160 | - { |
|
142 | + public function getNumFound() { |
|
161 | 143 | return $this->result['numFound']; |
162 | 144 | } |
163 | 145 | |
164 | - public function prepare() |
|
165 | - { |
|
146 | + public function prepare() { |
|
166 | 147 | // Prepare query parameters. |
167 | 148 | $params = []; |
168 | 149 | $matches = []; |
@@ -285,8 +266,7 @@ discard block |
||
285 | 266 | $this->submit(0, 1, false); |
286 | 267 | } |
287 | 268 | |
288 | - public function submit($start, $rows, $processResults = true) |
|
289 | - { |
|
269 | + public function submit($start, $rows, $processResults = true) { |
|
290 | 270 | $params = $this->params; |
291 | 271 | $params['start'] = $start; |
292 | 272 | $params['rows'] = $rows; |
@@ -383,8 +363,7 @@ discard block |
||
383 | 363 | * @param int $queryParams |
384 | 364 | * @return array |
385 | 365 | */ |
386 | - protected function fetchToplevelMetadataFromSolr($queryParams) |
|
387 | - { |
|
366 | + protected function fetchToplevelMetadataFromSolr($queryParams) { |
|
388 | 367 | // Prepare query parameters. |
389 | 368 | $params = $queryParams; |
390 | 369 | $metadataArray = []; |
@@ -427,8 +406,7 @@ discard block |
||
427 | 406 | * |
428 | 407 | * @return array The Apache Solr Documents that were fetched |
429 | 408 | */ |
430 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
431 | - { |
|
409 | + protected function searchSolr($parameters = [], $enableCache = true) { |
|
432 | 410 | // Set query. |
433 | 411 | $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*'; |
434 | 412 | $parameters['filterquery'] = isset($parameters['filterquery']) ? $parameters['filterquery'] : []; |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class Helper |
|
36 | -{ |
|
35 | +class Helper { |
|
37 | 36 | /** |
38 | 37 | * The extension key |
39 | 38 | * |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | * |
82 | 81 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
83 | 82 | */ |
84 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
85 | - { |
|
83 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
86 | 84 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
87 | 85 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
88 | 86 | $flashMessage = GeneralUtility::makeInstance( |
@@ -107,8 +105,7 @@ discard block |
||
107 | 105 | * |
108 | 106 | * @return bool Is $id a valid GNL identifier of the given $type? |
109 | 107 | */ |
110 | - public static function checkIdentifier($id, $type) |
|
111 | - { |
|
108 | + public static function checkIdentifier($id, $type) { |
|
112 | 109 | $digits = substr($id, 0, 8); |
113 | 110 | $checksum = 0; |
114 | 111 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -172,8 +169,7 @@ discard block |
||
172 | 169 | * |
173 | 170 | * @return mixed The decrypted value or false on error |
174 | 171 | */ |
175 | - public static function decrypt($encrypted) |
|
176 | - { |
|
172 | + public static function decrypt($encrypted) { |
|
177 | 173 | if ( |
178 | 174 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
179 | 175 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -212,8 +208,7 @@ discard block |
||
212 | 208 | * |
213 | 209 | * @return \SimpleXMLElement|false |
214 | 210 | */ |
215 | - public static function getXmlFileAsString($content) |
|
216 | - { |
|
211 | + public static function getXmlFileAsString($content) { |
|
217 | 212 | // Don't make simplexml_load_string throw (when $content is an array |
218 | 213 | // or object) |
219 | 214 | if (!is_string($content)) { |
@@ -244,8 +239,7 @@ discard block |
||
244 | 239 | * |
245 | 240 | * @return void |
246 | 241 | */ |
247 | - public static function log($message, $severity = 0) |
|
248 | - { |
|
242 | + public static function log($message, $severity = 0) { |
|
249 | 243 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
250 | 244 | |
251 | 245 | switch ($severity) { |
@@ -275,8 +269,7 @@ discard block |
||
275 | 269 | * |
276 | 270 | * @return mixed Hashed string or false on error |
277 | 271 | */ |
278 | - public static function digest($string) |
|
279 | - { |
|
272 | + public static function digest($string) { |
|
280 | 273 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
281 | 274 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
282 | 275 | return false; |
@@ -295,8 +288,7 @@ discard block |
||
295 | 288 | * |
296 | 289 | * @return mixed Encrypted string or false on error |
297 | 290 | */ |
298 | - public static function encrypt($string) |
|
299 | - { |
|
291 | + public static function encrypt($string) { |
|
300 | 292 | if ( |
301 | 293 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
302 | 294 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -329,8 +321,7 @@ discard block |
||
329 | 321 | * |
330 | 322 | * @return string The unqualified class name |
331 | 323 | */ |
332 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
333 | - { |
|
324 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
334 | 325 | $nameParts = explode('\\', $qualifiedClassname); |
335 | 326 | return end($nameParts); |
336 | 327 | } |
@@ -344,8 +335,7 @@ discard block |
||
344 | 335 | * |
345 | 336 | * @return string The cleaned up string |
346 | 337 | */ |
347 | - public static function getCleanString($string) |
|
348 | - { |
|
338 | + public static function getCleanString($string) { |
|
349 | 339 | // Convert to lowercase. |
350 | 340 | $string = strtolower($string); |
351 | 341 | // Remove non-alphanumeric characters. |
@@ -366,8 +356,7 @@ discard block |
||
366 | 356 | * |
367 | 357 | * @return array Array of hook objects for the class |
368 | 358 | */ |
369 | - public static function getHookObjects($scriptRelPath) |
|
370 | - { |
|
359 | + public static function getHookObjects($scriptRelPath) { |
|
371 | 360 | $hookObjects = []; |
372 | 361 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
373 | 362 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -388,8 +377,7 @@ discard block |
||
388 | 377 | * |
389 | 378 | * @return string "index_name" for the given UID |
390 | 379 | */ |
391 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
392 | - { |
|
380 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
393 | 381 | // Sanitize input. |
394 | 382 | $uid = max(intval($uid), 0); |
395 | 383 | if ( |
@@ -447,8 +435,7 @@ discard block |
||
447 | 435 | * |
448 | 436 | * @return string Localized full name of language or unchanged input |
449 | 437 | */ |
450 | - public static function getLanguageName($code) |
|
451 | - { |
|
438 | + public static function getLanguageName($code) { |
|
452 | 439 | // Analyze code and set appropriate ISO table. |
453 | 440 | $isoCode = strtolower(trim($code)); |
454 | 441 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -475,8 +462,7 @@ discard block |
||
475 | 462 | * |
476 | 463 | * @return array |
477 | 464 | */ |
478 | - public static function getDocumentStructures($pid = -1) |
|
479 | - { |
|
465 | + public static function getDocumentStructures($pid = -1) { |
|
480 | 466 | // TODO: Against redundancy with getIndexNameFromUid |
481 | 467 | |
482 | 468 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
@@ -518,8 +504,7 @@ discard block |
||
518 | 504 | * |
519 | 505 | * @return string Uniform Resource Name as string |
520 | 506 | */ |
521 | - public static function getURN($base, $id) |
|
522 | - { |
|
507 | + public static function getURN($base, $id) { |
|
523 | 508 | $concordance = [ |
524 | 509 | '0' => 1, |
525 | 510 | '1' => 2, |
@@ -586,8 +571,7 @@ discard block |
||
586 | 571 | * |
587 | 572 | * @return bool Is $id a valid PPN? |
588 | 573 | */ |
589 | - public static function isPPN($id) |
|
590 | - { |
|
574 | + public static function isPPN($id) { |
|
591 | 575 | return self::checkIdentifier($id, 'PPN'); |
592 | 576 | } |
593 | 577 | |
@@ -598,8 +582,7 @@ discard block |
||
598 | 582 | * |
599 | 583 | * @return bool |
600 | 584 | */ |
601 | - public static function isValidHttpUrl($url) |
|
602 | - { |
|
585 | + public static function isValidHttpUrl($url) { |
|
603 | 586 | if (!GeneralUtility::isValidUrl($url)) { |
604 | 587 | return false; |
605 | 588 | } |
@@ -625,8 +608,7 @@ discard block |
||
625 | 608 | * |
626 | 609 | * @return array Merged array |
627 | 610 | */ |
628 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
629 | - { |
|
611 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
630 | 612 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
631 | 613 | return $original; |
632 | 614 | } |
@@ -640,8 +622,7 @@ discard block |
||
640 | 622 | * |
641 | 623 | * @return string All flash messages in the queue rendered as HTML. |
642 | 624 | */ |
643 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
644 | - { |
|
625 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
645 | 626 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
646 | 627 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
647 | 628 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -661,8 +642,7 @@ discard block |
||
661 | 642 | * |
662 | 643 | * @return string Localized label for $index_name |
663 | 644 | */ |
664 | - public static function translate($index_name, $table, $pid) |
|
665 | - { |
|
645 | + public static function translate($index_name, $table, $pid) { |
|
666 | 646 | // Load labels into static variable for future use. |
667 | 647 | static $labels = []; |
668 | 648 | // Sanitize input. |
@@ -790,8 +770,7 @@ discard block |
||
790 | 770 | * |
791 | 771 | * @return string Additional WHERE expression |
792 | 772 | */ |
793 | - public static function whereExpression($table, $showHidden = false) |
|
794 | - { |
|
773 | + public static function whereExpression($table, $showHidden = false) { |
|
795 | 774 | if (\TYPO3_MODE === 'FE') { |
796 | 775 | // Should we ignore the record's hidden flag? |
797 | 776 | $ignoreHide = 0; |
@@ -823,8 +802,7 @@ discard block |
||
823 | 802 | * |
824 | 803 | * @access private |
825 | 804 | */ |
826 | - private function __construct() |
|
827 | - { |
|
805 | + private function __construct() { |
|
828 | 806 | // This is a static class, thus no instances should be created. |
829 | 807 | } |
830 | 808 | |
@@ -850,8 +828,7 @@ discard block |
||
850 | 828 | * |
851 | 829 | * @access public |
852 | 830 | */ |
853 | - public static function polyfillExtbaseClassesForTYPO3v9() |
|
854 | - { |
|
831 | + public static function polyfillExtbaseClassesForTYPO3v9() { |
|
855 | 832 | $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
856 | 833 | |
857 | 834 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
@@ -888,8 +865,7 @@ discard block |
||
888 | 865 | * |
889 | 866 | * @return string|bool |
890 | 867 | */ |
891 | - public static function getUrl(string $url) |
|
892 | - { |
|
868 | + public static function getUrl(string $url) { |
|
893 | 869 | if (!Helper::isValidHttpUrl($url)) { |
894 | 870 | return false; |
895 | 871 | } |
@@ -10,10 +10,8 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``). |
12 | 12 | */ |
13 | -class SolrSearchQuery implements QueryInterface |
|
14 | -{ |
|
15 | - public function __construct($solrSearch) |
|
16 | - { |
|
13 | +class SolrSearchQuery implements QueryInterface { |
|
14 | + public function __construct($solrSearch) { |
|
17 | 15 | $this->solrSearch = $solrSearch; |
18 | 16 | |
19 | 17 | $this->offset = 0; |
@@ -22,8 +20,7 @@ discard block |
||
22 | 20 | |
23 | 21 | public function getSource() {} |
24 | 22 | |
25 | - public function execute($returnRawQueryResult = false) |
|
26 | - { |
|
23 | + public function execute($returnRawQueryResult = false) { |
|
27 | 24 | $this->solrSearch->submit($this->offset, $this->limit); |
28 | 25 | |
29 | 26 | // solrSearch now only contains the results in range, indexed in [0, n) |
@@ -37,14 +34,12 @@ discard block |
||
37 | 34 | |
38 | 35 | public function setOrderings(array $orderings) {} |
39 | 36 | |
40 | - public function setLimit($limit) |
|
41 | - { |
|
37 | + public function setLimit($limit) { |
|
42 | 38 | $this->limit = $limit; |
43 | 39 | return $this; |
44 | 40 | } |
45 | 41 | |
46 | - public function setOffset($offset) |
|
47 | - { |
|
42 | + public function setOffset($offset) { |
|
48 | 43 | $this->offset = $offset; |
49 | 44 | return $this; |
50 | 45 | } |
@@ -65,20 +60,17 @@ discard block |
||
65 | 60 | public function setQuerySettings(QuerySettingsInterface $querySettings) {} |
66 | 61 | public function getQuerySettings() {} |
67 | 62 | |
68 | - public function count() |
|
69 | - { |
|
63 | + public function count() { |
|
70 | 64 | // TODO? |
71 | 65 | } |
72 | 66 | |
73 | 67 | public function getOrderings() {} |
74 | 68 | |
75 | - public function getLimit() |
|
76 | - { |
|
69 | + public function getLimit() { |
|
77 | 70 | return $this->limit; |
78 | 71 | } |
79 | 72 | |
80 | - public function getOffset() |
|
81 | - { |
|
73 | + public function getOffset() { |
|
82 | 74 | return $this->offset; |
83 | 75 | } |
84 | 76 |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
50 | 50 | */ |
51 | - public function findOneByParameters($parameters) |
|
52 | - { |
|
51 | + public function findOneByParameters($parameters) { |
|
53 | 52 | $doc = null; |
54 | 53 | $document = null; |
55 | 54 | |
@@ -93,8 +92,7 @@ discard block |
||
93 | 92 | * |
94 | 93 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
95 | 94 | */ |
96 | - public function findOldestDocument() |
|
97 | - { |
|
95 | + public function findOldestDocument() { |
|
98 | 96 | $query = $this->createQuery(); |
99 | 97 | |
100 | 98 | $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]); |
@@ -108,8 +106,7 @@ discard block |
||
108 | 106 | * @param \Kitodo\Dlf\Domain\Model\Structure $structure |
109 | 107 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
110 | 108 | */ |
111 | - public function getChildrenOfYearAnchor($partOf, $structure) |
|
112 | - { |
|
109 | + public function getChildrenOfYearAnchor($partOf, $structure) { |
|
113 | 110 | $query = $this->createQuery(); |
114 | 111 | |
115 | 112 | $query->matching($query->equals('structure', $structure)); |
@@ -130,8 +127,7 @@ discard block |
||
130 | 127 | * |
131 | 128 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
132 | 129 | */ |
133 | - public function findOneByIdAndSettings($uid, $settings = []) |
|
134 | - { |
|
130 | + public function findOneByIdAndSettings($uid, $settings = []) { |
|
135 | 131 | $settings = ['documentSets' => $uid]; |
136 | 132 | |
137 | 133 | return $this->findDocumentsBySettings($settings)->getFirst(); |
@@ -144,8 +140,7 @@ discard block |
||
144 | 140 | * |
145 | 141 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
146 | 142 | */ |
147 | - public function findDocumentsBySettings($settings = []) |
|
148 | - { |
|
143 | + public function findDocumentsBySettings($settings = []) { |
|
149 | 144 | $query = $this->createQuery(); |
150 | 145 | |
151 | 146 | $constraints = []; |
@@ -175,8 +170,7 @@ discard block |
||
175 | 170 | * |
176 | 171 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
177 | 172 | */ |
178 | - public function findAllByCollectionsLimited($collections, $limit = 50) |
|
179 | - { |
|
173 | + public function findAllByCollectionsLimited($collections, $limit = 50) { |
|
180 | 174 | $query = $this->createQuery(); |
181 | 175 | |
182 | 176 | // order by start_date -> start_time... |
@@ -213,8 +207,7 @@ discard block |
||
213 | 207 | * |
214 | 208 | * @return array |
215 | 209 | */ |
216 | - public function getStatisticsForSelectedCollection($settings) |
|
217 | - { |
|
210 | + public function getStatisticsForSelectedCollection($settings) { |
|
218 | 211 | if ($settings['collections']) { |
219 | 212 | // Include only selected collections. |
220 | 213 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -348,8 +341,7 @@ discard block |
||
348 | 341 | * |
349 | 342 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
350 | 343 | */ |
351 | - public function getTableOfContentsFromDb($uid, $pid, $settings) |
|
352 | - { |
|
344 | + public function getTableOfContentsFromDb($uid, $pid, $settings) { |
|
353 | 345 | // Build table of contents from database. |
354 | 346 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
355 | 347 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -397,8 +389,7 @@ discard block |
||
397 | 389 | * |
398 | 390 | * @return array The found document object |
399 | 391 | */ |
400 | - public function getOaiRecord($settings, $parameters) |
|
401 | - { |
|
392 | + public function getOaiRecord($settings, $parameters) { |
|
402 | 393 | $where = ''; |
403 | 394 | |
404 | 395 | if (!$settings['show_userdefined']) { |
@@ -438,8 +429,7 @@ discard block |
||
438 | 429 | * |
439 | 430 | * @return array The found document objects |
440 | 431 | */ |
441 | - public function getOaiDocumentList($settings, $documentsToProcess) |
|
442 | - { |
|
432 | + public function getOaiDocumentList($settings, $documentsToProcess) { |
|
443 | 433 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
444 | 434 | ->getConnectionForTable('tx_dlf_documents'); |
445 | 435 | |
@@ -474,8 +464,7 @@ discard block |
||
474 | 464 | * |
475 | 465 | * @return array |
476 | 466 | */ |
477 | - public function findAllByUids($uids, $checkPartof = false) |
|
478 | - { |
|
467 | + public function findAllByUids($uids, $checkPartof = false) { |
|
479 | 468 | // get all documents from db we are talking about |
480 | 469 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
481 | 470 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -524,8 +513,7 @@ discard block |
||
524 | 513 | * |
525 | 514 | * @return array |
526 | 515 | */ |
527 | - public function findChildrenOfEach(array $uids) |
|
528 | - { |
|
516 | + public function findChildrenOfEach(array $uids) { |
|
529 | 517 | $allDocuments = $this->findAllByUids($uids, true); |
530 | 518 | |
531 | 519 | $result = []; |
@@ -546,8 +534,7 @@ discard block |
||
546 | 534 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
547 | 535 | * @return array |
548 | 536 | */ |
549 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
550 | - { |
|
537 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) { |
|
551 | 538 | // set settings global inside this repository |
552 | 539 | // (may be necessary when SolrSearch calls back) |
553 | 540 | $this->settings = $settings; |