@@ -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 | |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
| 51 | 51 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
| 52 | 52 | */ |
| 53 | -final class MetsDocument extends Doc |
|
| 54 | -{ |
|
| 53 | +final class MetsDocument extends Doc { |
|
| 55 | 54 | /** |
| 56 | 55 | * Subsections / tags that may occur within `<mets:amdSec>`. |
| 57 | 56 | * |
@@ -176,8 +175,7 @@ discard block |
||
| 176 | 175 | * |
| 177 | 176 | * @return void |
| 178 | 177 | */ |
| 179 | - public function addMetadataFromMets(&$metadata, $id) |
|
| 180 | - { |
|
| 178 | + public function addMetadataFromMets(&$metadata, $id) { |
|
| 181 | 179 | $details = $this->getLogicalStructure($id); |
| 182 | 180 | if (!empty($details)) { |
| 183 | 181 | $metadata['mets_order'][0] = $details['order']; |
@@ -191,8 +189,7 @@ discard block |
||
| 191 | 189 | * {@inheritDoc} |
| 192 | 190 | * @see \Kitodo\Dlf\Common\Doc::establishRecordId() |
| 193 | 191 | */ |
| 194 | - protected function establishRecordId($pid) |
|
| 195 | - { |
|
| 192 | + protected function establishRecordId($pid) { |
|
| 196 | 193 | // Check for METS object @ID. |
| 197 | 194 | if (!empty($this->mets['OBJID'])) { |
| 198 | 195 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -212,8 +209,7 @@ discard block |
||
| 212 | 209 | * {@inheritDoc} |
| 213 | 210 | * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation() |
| 214 | 211 | */ |
| 215 | - public function getDownloadLocation($id) |
|
| 216 | - { |
|
| 212 | + public function getDownloadLocation($id) { |
|
| 217 | 213 | $fileMimeType = $this->getFileMimeType($id); |
| 218 | 214 | $fileLocation = $this->getFileLocation($id); |
| 219 | 215 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -238,8 +234,7 @@ discard block |
||
| 238 | 234 | * {@inheritDoc} |
| 239 | 235 | * @see \Kitodo\Dlf\Common\Doc::getFileLocation() |
| 240 | 236 | */ |
| 241 | - public function getFileLocation($id) |
|
| 242 | - { |
|
| 237 | + public function getFileLocation($id) { |
|
| 243 | 238 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
| 244 | 239 | if ( |
| 245 | 240 | !empty($id) |
@@ -256,8 +251,7 @@ discard block |
||
| 256 | 251 | * {@inheritDoc} |
| 257 | 252 | * @see \Kitodo\Dlf\Common\Doc::getFileMimeType() |
| 258 | 253 | */ |
| 259 | - public function getFileMimeType($id) |
|
| 260 | - { |
|
| 254 | + public function getFileMimeType($id) { |
|
| 261 | 255 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
| 262 | 256 | if ( |
| 263 | 257 | !empty($id) |
@@ -274,8 +268,7 @@ discard block |
||
| 274 | 268 | * {@inheritDoc} |
| 275 | 269 | * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure() |
| 276 | 270 | */ |
| 277 | - public function getLogicalStructure($id, $recursive = false) |
|
| 278 | - { |
|
| 271 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 279 | 272 | $details = []; |
| 280 | 273 | // Is the requested logical unit already loaded? |
| 281 | 274 | if ( |
@@ -315,8 +308,7 @@ discard block |
||
| 315 | 308 | * |
| 316 | 309 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 317 | 310 | */ |
| 318 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
| 319 | - { |
|
| 311 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
| 320 | 312 | // Get attributes. |
| 321 | 313 | foreach ($structure->attributes() as $attribute => $value) { |
| 322 | 314 | $attributes[$attribute] = (string) $value; |
@@ -415,8 +407,7 @@ discard block |
||
| 415 | 407 | * {@inheritDoc} |
| 416 | 408 | * @see \Kitodo\Dlf\Common\Doc::getMetadata() |
| 417 | 409 | */ |
| 418 | - public function getMetadata($id, $cPid = 0) |
|
| 419 | - { |
|
| 410 | + public function getMetadata($id, $cPid = 0) { |
|
| 420 | 411 | // Make sure $cPid is a non-negative integer. |
| 421 | 412 | $cPid = max(intval($cPid), 0); |
| 422 | 413 | // If $cPid is not given, try to get it elsewhere. |
@@ -659,8 +650,7 @@ discard block |
||
| 659 | 650 | * @param string $id: The "@ID" attribute of the file node |
| 660 | 651 | * @return void |
| 661 | 652 | */ |
| 662 | - protected function getMetadataIds($id) |
|
| 663 | - { |
|
| 653 | + protected function getMetadataIds($id) { |
|
| 664 | 654 | // Load amdSecChildIds concordance |
| 665 | 655 | $this->_getMdSec(); |
| 666 | 656 | $this->_getFileInfos(); |
@@ -707,8 +697,7 @@ discard block |
||
| 707 | 697 | * {@inheritDoc} |
| 708 | 698 | * @see \Kitodo\Dlf\Common\Doc::getFullText() |
| 709 | 699 | */ |
| 710 | - public function getFullText($id) |
|
| 711 | - { |
|
| 700 | + public function getFullText($id) { |
|
| 712 | 701 | $fullText = ''; |
| 713 | 702 | |
| 714 | 703 | // Load fileGrps and check for full text files. |
@@ -723,8 +712,7 @@ discard block |
||
| 723 | 712 | * {@inheritDoc} |
| 724 | 713 | * @see Doc::getStructureDepth() |
| 725 | 714 | */ |
| 726 | - public function getStructureDepth($logId) |
|
| 727 | - { |
|
| 715 | + public function getStructureDepth($logId) { |
|
| 728 | 716 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 729 | 717 | if (!empty($ancestors)) { |
| 730 | 718 | return count($ancestors); |
@@ -737,8 +725,7 @@ discard block |
||
| 737 | 725 | * {@inheritDoc} |
| 738 | 726 | * @see \Kitodo\Dlf\Common\Doc::init() |
| 739 | 727 | */ |
| 740 | - protected function init($location) |
|
| 741 | - { |
|
| 728 | + protected function init($location) { |
|
| 742 | 729 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this)); |
| 743 | 730 | // Get METS node from XML file. |
| 744 | 731 | $this->registerNamespaces($this->xml); |
@@ -762,8 +749,7 @@ discard block |
||
| 762 | 749 | * {@inheritDoc} |
| 763 | 750 | * @see \Kitodo\Dlf\Common\Doc::loadLocation() |
| 764 | 751 | */ |
| 765 | - protected function loadLocation($location) |
|
| 766 | - { |
|
| 752 | + protected function loadLocation($location) { |
|
| 767 | 753 | $fileResource = Helper::getUrl($location); |
| 768 | 754 | if ($fileResource !== false) { |
| 769 | 755 | $xml = Helper::getXmlFileAsString($fileResource); |
@@ -781,8 +767,7 @@ discard block |
||
| 781 | 767 | * {@inheritDoc} |
| 782 | 768 | * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet() |
| 783 | 769 | */ |
| 784 | - protected function ensureHasFulltextIsSet() |
|
| 785 | - { |
|
| 770 | + protected function ensureHasFulltextIsSet() { |
|
| 786 | 771 | // Are the fileGrps already loaded? |
| 787 | 772 | if (!$this->fileGrpsLoaded) { |
| 788 | 773 | $this->_getFileGrps(); |
@@ -793,8 +778,7 @@ discard block |
||
| 793 | 778 | * {@inheritDoc} |
| 794 | 779 | * @see Doc::setPreloadedDocument() |
| 795 | 780 | */ |
| 796 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 797 | - { |
|
| 781 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 798 | 782 | |
| 799 | 783 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
| 800 | 784 | $this->xml = $preloadedDocument; |
@@ -807,8 +791,7 @@ discard block |
||
| 807 | 791 | * {@inheritDoc} |
| 808 | 792 | * @see Doc::getDocument() |
| 809 | 793 | */ |
| 810 | - protected function getDocument() |
|
| 811 | - { |
|
| 794 | + protected function getDocument() { |
|
| 812 | 795 | return $this->mets; |
| 813 | 796 | } |
| 814 | 797 | |
@@ -819,8 +802,7 @@ discard block |
||
| 819 | 802 | * |
| 820 | 803 | * @return array Array of metadata sections with their IDs as array key |
| 821 | 804 | */ |
| 822 | - protected function _getMdSec() |
|
| 823 | - { |
|
| 805 | + protected function _getMdSec() { |
|
| 824 | 806 | if (!$this->mdSecLoaded) { |
| 825 | 807 | $this->loadFormats(); |
| 826 | 808 | |
@@ -862,8 +844,7 @@ discard block |
||
| 862 | 844 | return $this->mdSec; |
| 863 | 845 | } |
| 864 | 846 | |
| 865 | - protected function _getDmdSec() |
|
| 866 | - { |
|
| 847 | + protected function _getDmdSec() { |
|
| 867 | 848 | $this->_getMdSec(); |
| 868 | 849 | return $this->dmdSec; |
| 869 | 850 | } |
@@ -877,8 +858,7 @@ discard block |
||
| 877 | 858 | * |
| 878 | 859 | * @return array|null The processed metadata section |
| 879 | 860 | */ |
| 880 | - protected function processMdSec($element) |
|
| 881 | - { |
|
| 861 | + protected function processMdSec($element) { |
|
| 882 | 862 | $mdId = (string) $element->attributes()->ID; |
| 883 | 863 | if (empty($mdId)) { |
| 884 | 864 | return null; |
@@ -918,8 +898,7 @@ discard block |
||
| 918 | 898 | * |
| 919 | 899 | * @return array Array of file use groups with file IDs |
| 920 | 900 | */ |
| 921 | - protected function _getFileGrps() |
|
| 922 | - { |
|
| 901 | + protected function _getFileGrps() { |
|
| 923 | 902 | if (!$this->fileGrpsLoaded) { |
| 924 | 903 | // Get configured USE attributes. |
| 925 | 904 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -971,8 +950,7 @@ discard block |
||
| 971 | 950 | * @access protected |
| 972 | 951 | * @return array |
| 973 | 952 | */ |
| 974 | - protected function _getFileInfos() |
|
| 975 | - { |
|
| 953 | + protected function _getFileInfos() { |
|
| 976 | 954 | $this->_getFileGrps(); |
| 977 | 955 | return $this->fileInfos; |
| 978 | 956 | } |
@@ -981,8 +959,7 @@ discard block |
||
| 981 | 959 | * {@inheritDoc} |
| 982 | 960 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
| 983 | 961 | */ |
| 984 | - protected function prepareMetadataArray($cPid) |
|
| 985 | - { |
|
| 962 | + protected function prepareMetadataArray($cPid) { |
|
| 986 | 963 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
| 987 | 964 | // Get all logical structure nodes with metadata. |
| 988 | 965 | if (!empty($ids)) { |
@@ -1000,8 +977,7 @@ discard block |
||
| 1000 | 977 | * |
| 1001 | 978 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
| 1002 | 979 | */ |
| 1003 | - protected function _getMets() |
|
| 1004 | - { |
|
| 980 | + protected function _getMets() { |
|
| 1005 | 981 | return $this->mets; |
| 1006 | 982 | } |
| 1007 | 983 | |
@@ -1009,8 +985,7 @@ discard block |
||
| 1009 | 985 | * {@inheritDoc} |
| 1010 | 986 | * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure() |
| 1011 | 987 | */ |
| 1012 | - protected function _getPhysicalStructure() |
|
| 1013 | - { |
|
| 988 | + protected function _getPhysicalStructure() { |
|
| 1014 | 989 | // Is there no physical structure array yet? |
| 1015 | 990 | if (!$this->physicalStructureLoaded) { |
| 1016 | 991 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -1072,8 +1047,7 @@ discard block |
||
| 1072 | 1047 | * {@inheritDoc} |
| 1073 | 1048 | * @see \Kitodo\Dlf\Common\Doc::_getSmLinks() |
| 1074 | 1049 | */ |
| 1075 | - protected function _getSmLinks() |
|
| 1076 | - { |
|
| 1050 | + protected function _getSmLinks() { |
|
| 1077 | 1051 | if (!$this->smLinksLoaded) { |
| 1078 | 1052 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
| 1079 | 1053 | if (!empty($smLinks)) { |
@@ -1091,8 +1065,7 @@ discard block |
||
| 1091 | 1065 | * {@inheritDoc} |
| 1092 | 1066 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
| 1093 | 1067 | */ |
| 1094 | - protected function _getThumbnail($forceReload = false) |
|
| 1095 | - { |
|
| 1068 | + protected function _getThumbnail($forceReload = false) { |
|
| 1096 | 1069 | if ( |
| 1097 | 1070 | !$this->thumbnailLoaded |
| 1098 | 1071 | || $forceReload |
@@ -1171,8 +1144,7 @@ discard block |
||
| 1171 | 1144 | * {@inheritDoc} |
| 1172 | 1145 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
| 1173 | 1146 | */ |
| 1174 | - protected function _getToplevelId() |
|
| 1175 | - { |
|
| 1147 | + protected function _getToplevelId() { |
|
| 1176 | 1148 | if (empty($this->toplevelId)) { |
| 1177 | 1149 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
| 1178 | 1150 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1201,8 +1173,7 @@ discard block |
||
| 1201 | 1173 | * |
| 1202 | 1174 | * @return string|null |
| 1203 | 1175 | */ |
| 1204 | - public function _getParentHref() |
|
| 1205 | - { |
|
| 1176 | + public function _getParentHref() { |
|
| 1206 | 1177 | if ($this->parentHref === null) { |
| 1207 | 1178 | $this->parentHref = ''; |
| 1208 | 1179 | |
@@ -1224,8 +1195,7 @@ discard block |
||
| 1224 | 1195 | * |
| 1225 | 1196 | * @return array Properties to be serialized |
| 1226 | 1197 | */ |
| 1227 | - public function __sleep() |
|
| 1228 | - { |
|
| 1198 | + public function __sleep() { |
|
| 1229 | 1199 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
| 1230 | 1200 | $this->asXML = $this->xml->asXML(); |
| 1231 | 1201 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1238,8 +1208,7 @@ discard block |
||
| 1238 | 1208 | * |
| 1239 | 1209 | * @return string String representing the METS object |
| 1240 | 1210 | */ |
| 1241 | - public function __toString() |
|
| 1242 | - { |
|
| 1211 | + public function __toString() { |
|
| 1243 | 1212 | $xml = new \DOMDocument('1.0', 'utf-8'); |
| 1244 | 1213 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
| 1245 | 1214 | $xml->formatOutput = true; |
@@ -1254,8 +1223,7 @@ discard block |
||
| 1254 | 1223 | * |
| 1255 | 1224 | * @return void |
| 1256 | 1225 | */ |
| 1257 | - public function __wakeup() |
|
| 1258 | - { |
|
| 1226 | + public function __wakeup() { |
|
| 1259 | 1227 | $xml = Helper::getXmlFileAsString($this->asXML); |
| 1260 | 1228 | if ($xml !== false) { |
| 1261 | 1229 | $this->asXML = ''; |
@@ -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 | |