@@ -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->setPreloadedDocument($preloadedDocument); |
1171 | 1144 | $this->init($location); |
1172 | 1145 | $this->establishRecordId($pid); |
@@ -1182,8 +1155,7 @@ discard block |
||
1182 | 1155 | * |
1183 | 1156 | * @return mixed Value of $this->$var |
1184 | 1157 | */ |
1185 | - public function __get($var) |
|
1186 | - { |
|
1158 | + public function __get($var) { |
|
1187 | 1159 | $method = '_get' . ucfirst($var); |
1188 | 1160 | if ( |
1189 | 1161 | !property_exists($this, $var) |
@@ -1205,8 +1177,7 @@ discard block |
||
1205 | 1177 | * |
1206 | 1178 | * @return bool true if variable is set and not empty, false otherwise |
1207 | 1179 | */ |
1208 | - public function __isset($var) |
|
1209 | - { |
|
1180 | + public function __isset($var) { |
|
1210 | 1181 | return !empty($this->__get($var)); |
1211 | 1182 | } |
1212 | 1183 | |
@@ -1220,8 +1191,7 @@ discard block |
||
1220 | 1191 | * |
1221 | 1192 | * @return void |
1222 | 1193 | */ |
1223 | - public function __set($var, $value) |
|
1224 | - { |
|
1194 | + public function __set($var, $value) { |
|
1225 | 1195 | $method = '_set' . ucfirst($var); |
1226 | 1196 | if ( |
1227 | 1197 | !property_exists($this, $var) |
@@ -1239,8 +1209,7 @@ discard block |
||
1239 | 1209 | * @param string $location |
1240 | 1210 | * @return Doc|false |
1241 | 1211 | */ |
1242 | - private static function getDocCache(string $location) |
|
1243 | - { |
|
1212 | + private static function getDocCache(string $location) { |
|
1244 | 1213 | $cacheIdentifier = md5($location); |
1245 | 1214 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1246 | 1215 | $cacheHit = $cache->get($cacheIdentifier); |
@@ -1255,8 +1224,7 @@ discard block |
||
1255 | 1224 | * @param Doc $doc |
1256 | 1225 | * @return void |
1257 | 1226 | */ |
1258 | - private static function setDocCache(string $location, Doc $doc) |
|
1259 | - { |
|
1227 | + private static function setDocCache(string $location, Doc $doc) { |
|
1260 | 1228 | $cacheIdentifier = md5($location); |
1261 | 1229 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1262 | 1230 |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | * @property-read string $thumbnail This holds the document's thumbnail location |
57 | 57 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
58 | 58 | */ |
59 | -final class IiifManifest extends Doc |
|
60 | -{ |
|
59 | +final class IiifManifest extends Doc { |
|
61 | 60 | /** |
62 | 61 | * This holds the manifest file as string for serialization purposes |
63 | 62 | * @see __sleep() / __wakeup() |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | * {@inheritDoc} |
119 | 118 | * @see Doc::establishRecordId() |
120 | 119 | */ |
121 | - protected function establishRecordId($pid) |
|
122 | - { |
|
120 | + protected function establishRecordId($pid) { |
|
123 | 121 | if ($this->iiif !== null) { |
124 | 122 | /* |
125 | 123 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -174,8 +172,7 @@ discard block |
||
174 | 172 | * {@inheritDoc} |
175 | 173 | * @see Doc::getDocument() |
176 | 174 | */ |
177 | - protected function getDocument() |
|
178 | - { |
|
175 | + protected function getDocument() { |
|
179 | 176 | return $this->iiif; |
180 | 177 | } |
181 | 178 | |
@@ -188,8 +185,7 @@ discard block |
||
188 | 185 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
189 | 186 | * the resource is a Presentation API 2 / 3 resource |
190 | 187 | */ |
191 | - public function getIiifVersion() |
|
192 | - { |
|
188 | + public function getIiifVersion() { |
|
193 | 189 | if (!isset($this->iiifVersion)) { |
194 | 190 | if ($this->iiif instanceof AbstractIiifResource1) { |
195 | 191 | $this->iiifVersion = 'IIIF1'; |
@@ -230,8 +226,7 @@ discard block |
||
230 | 226 | * |
231 | 227 | * @return array|string |
232 | 228 | */ |
233 | - protected function getUseGroups($use) |
|
234 | - { |
|
229 | + protected function getUseGroups($use) { |
|
235 | 230 | if (!$this->useGrpsLoaded) { |
236 | 231 | // Get configured USE attributes. |
237 | 232 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -259,8 +254,7 @@ discard block |
||
259 | 254 | * {@inheritDoc} |
260 | 255 | * @see Doc::_getPhysicalStructure() |
261 | 256 | */ |
262 | - protected function _getPhysicalStructure() |
|
263 | - { |
|
257 | + protected function _getPhysicalStructure() { |
|
264 | 258 | // Is there no physical structure array yet? |
265 | 259 | if (!$this->physicalStructureLoaded) { |
266 | 260 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -373,8 +367,7 @@ discard block |
||
373 | 367 | * {@inheritDoc} |
374 | 368 | * @see Doc::getDownloadLocation() |
375 | 369 | */ |
376 | - public function getDownloadLocation($id) |
|
377 | - { |
|
370 | + public function getDownloadLocation($id) { |
|
378 | 371 | $fileLocation = $this->getFileLocation($id); |
379 | 372 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
380 | 373 | if ($resource instanceof AbstractImageService) { |
@@ -387,8 +380,7 @@ discard block |
||
387 | 380 | * {@inheritDoc} |
388 | 381 | * @see Doc::getFileLocation() |
389 | 382 | */ |
390 | - public function getFileLocation($id) |
|
391 | - { |
|
383 | + public function getFileLocation($id) { |
|
392 | 384 | if ($id == null) { |
393 | 385 | return null; |
394 | 386 | } |
@@ -412,8 +404,7 @@ discard block |
||
412 | 404 | * {@inheritDoc} |
413 | 405 | * @see Doc::getFileMimeType() |
414 | 406 | */ |
415 | - public function getFileMimeType($id) |
|
416 | - { |
|
407 | + public function getFileMimeType($id) { |
|
417 | 408 | $fileResource = $this->iiif->getContainedResourceById($id); |
418 | 409 | if ($fileResource instanceof CanvasInterface) { |
419 | 410 | $format = "application/vnd.kitodo.iiif"; |
@@ -438,8 +429,7 @@ discard block |
||
438 | 429 | * {@inheritDoc} |
439 | 430 | * @see Doc::getLogicalStructure() |
440 | 431 | */ |
441 | - public function getLogicalStructure($id, $recursive = false) |
|
442 | - { |
|
432 | + public function getLogicalStructure($id, $recursive = false) { |
|
443 | 433 | $details = []; |
444 | 434 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
445 | 435 | return $this->logicalUnits[$id]; |
@@ -474,8 +464,7 @@ discard block |
||
474 | 464 | * @param array $processedStructures: IIIF resources that already have been processed |
475 | 465 | * @return array Logical structure array |
476 | 466 | */ |
477 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
478 | - { |
|
467 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
479 | 468 | $details = []; |
480 | 469 | $details['id'] = $resource->getId(); |
481 | 470 | $details['dmdId'] = ''; |
@@ -567,8 +556,7 @@ discard block |
||
567 | 556 | * |
568 | 557 | * @todo This method is still in experimental; the method signature may change. |
569 | 558 | */ |
570 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
571 | - { |
|
559 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
572 | 560 | if (!empty($this->originalMetadataArray[$id])) { |
573 | 561 | return $this->originalMetadataArray[$id]; |
574 | 562 | } |
@@ -610,8 +598,7 @@ discard block |
||
610 | 598 | * {@inheritDoc} |
611 | 599 | * @see Doc::getMetadata() |
612 | 600 | */ |
613 | - public function getMetadata($id, $cPid = 0) |
|
614 | - { |
|
601 | + public function getMetadata($id, $cPid = 0) { |
|
615 | 602 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
616 | 603 | return $this->metadataArray[$id]; |
617 | 604 | } |
@@ -718,8 +705,7 @@ discard block |
||
718 | 705 | * {@inheritDoc} |
719 | 706 | * @see Doc::_getSmLinks() |
720 | 707 | */ |
721 | - protected function _getSmLinks() |
|
722 | - { |
|
708 | + protected function _getSmLinks() { |
|
723 | 709 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
724 | 710 | if (!empty($this->iiif->getDefaultCanvases())) { |
725 | 711 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -743,8 +729,7 @@ discard block |
||
743 | 729 | * |
744 | 730 | * @param RangeInterface $range: Current range whose canvases shall be linked |
745 | 731 | */ |
746 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
747 | - { |
|
732 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
748 | 733 | // map range's canvases including all child ranges' canvases |
749 | 734 | if (!$range->isTopRange()) { |
750 | 735 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -767,8 +752,7 @@ discard block |
||
767 | 752 | * @param CanvasInterface $canvas |
768 | 753 | * @param IiifResourceInterface $resource |
769 | 754 | */ |
770 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
771 | - { |
|
755 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
772 | 756 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
773 | 757 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
774 | 758 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -780,8 +764,7 @@ discard block |
||
780 | 764 | * @see Doc::getFullText() |
781 | 765 | */ |
782 | 766 | //TODO: rewrite it to get full OCR |
783 | - public function getFullText($id) |
|
784 | - { |
|
767 | + public function getFullText($id) { |
|
785 | 768 | $rawText = ''; |
786 | 769 | // Get text from raw text array if available. |
787 | 770 | if (!empty($this->rawTextArray[$id])) { |
@@ -838,8 +821,7 @@ discard block |
||
838 | 821 | * |
839 | 822 | * @return IiifResourceInterface |
840 | 823 | */ |
841 | - public function getIiif() |
|
842 | - { |
|
824 | + public function getIiif() { |
|
843 | 825 | return $this->iiif; |
844 | 826 | } |
845 | 827 | |
@@ -847,8 +829,7 @@ discard block |
||
847 | 829 | * {@inheritDoc} |
848 | 830 | * @see Doc::init() |
849 | 831 | */ |
850 | - protected function init($location) |
|
851 | - { |
|
832 | + protected function init($location) { |
|
852 | 833 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
853 | 834 | } |
854 | 835 | |
@@ -856,8 +837,7 @@ discard block |
||
856 | 837 | * {@inheritDoc} |
857 | 838 | * @see Doc::loadLocation() |
858 | 839 | */ |
859 | - protected function loadLocation($location) |
|
860 | - { |
|
840 | + protected function loadLocation($location) { |
|
861 | 841 | $fileResource = GeneralUtility::getUrl($location); |
862 | 842 | if ($fileResource !== false) { |
863 | 843 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -880,8 +860,7 @@ discard block |
||
880 | 860 | * {@inheritDoc} |
881 | 861 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
882 | 862 | */ |
883 | - protected function prepareMetadataArray($cPid) |
|
884 | - { |
|
863 | + protected function prepareMetadataArray($cPid) { |
|
885 | 864 | $id = $this->iiif->getId(); |
886 | 865 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
887 | 866 | } |
@@ -890,8 +869,7 @@ discard block |
||
890 | 869 | * {@inheritDoc} |
891 | 870 | * @see Doc::setPreloadedDocument() |
892 | 871 | */ |
893 | - protected function setPreloadedDocument($preloadedDocument) |
|
894 | - { |
|
872 | + protected function setPreloadedDocument($preloadedDocument) { |
|
895 | 873 | if ($preloadedDocument instanceof ManifestInterface) { |
896 | 874 | $this->iiif = $preloadedDocument; |
897 | 875 | return true; |
@@ -903,8 +881,7 @@ discard block |
||
903 | 881 | * {@inheritDoc} |
904 | 882 | * @see Docu::ensureHasFulltextIsSet() |
905 | 883 | */ |
906 | - protected function ensureHasFulltextIsSet() |
|
907 | - { |
|
884 | + protected function ensureHasFulltextIsSet() { |
|
908 | 885 | /* |
909 | 886 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
910 | 887 | * Example: |
@@ -950,8 +927,7 @@ discard block |
||
950 | 927 | * {@inheritDoc} |
951 | 928 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
952 | 929 | */ |
953 | - protected function _getThumbnail($forceReload = false) |
|
954 | - { |
|
930 | + protected function _getThumbnail($forceReload = false) { |
|
955 | 931 | return $this->iiif->getThumbnailUrl(); |
956 | 932 | } |
957 | 933 | |
@@ -959,8 +935,7 @@ discard block |
||
959 | 935 | * {@inheritDoc} |
960 | 936 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
961 | 937 | */ |
962 | - protected function _getToplevelId() |
|
963 | - { |
|
938 | + protected function _getToplevelId() { |
|
964 | 939 | if (empty($this->toplevelId)) { |
965 | 940 | if (isset($this->iiif)) { |
966 | 941 | $this->toplevelId = $this->iiif->getId(); |
@@ -977,8 +952,7 @@ discard block |
||
977 | 952 | * |
978 | 953 | * @return void |
979 | 954 | */ |
980 | - public function __wakeup() |
|
981 | - { |
|
955 | + public function __wakeup() { |
|
982 | 956 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
983 | 957 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
984 | 958 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -998,8 +972,7 @@ discard block |
||
998 | 972 | * |
999 | 973 | * @return string[] |
1000 | 974 | */ |
1001 | - public function __sleep() |
|
1002 | - { |
|
975 | + public function __sleep() { |
|
1003 | 976 | // TODO implement serializiation in IIIF library |
1004 | 977 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
1005 | 978 | $this->asJson = json_encode($jsonArray); |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected $httpClient; |
65 | 65 | |
66 | - public function __construct() |
|
67 | - { |
|
66 | + public function __construct() { |
|
68 | 67 | parent::__construct(); |
69 | 68 | |
70 | 69 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | $this->addSiteConfig('dlf-testing', $this->baseUrl); |
92 | 91 | } |
93 | 92 | |
94 | - protected function getDlfConfiguration() |
|
95 | - { |
|
93 | + protected function getDlfConfiguration() { |
|
96 | 94 | return [ |
97 | 95 | 'solrFieldAutocomplete' => 'autocomplete', |
98 | 96 | 'solrFieldCollection' => 'collection', |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | ]; |
125 | 123 | } |
126 | 124 | |
127 | - protected function addSiteConfig($identifier, $baseUrl) |
|
128 | - { |
|
125 | + protected function addSiteConfig($identifier, $baseUrl) { |
|
129 | 126 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
130 | 127 | $siteConfig['base'] = $baseUrl; |
131 | 128 | $siteConfig['languages'][0]['base'] = $baseUrl; |
@@ -135,8 +132,7 @@ discard block |
||
135 | 132 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
136 | 133 | } |
137 | 134 | |
138 | - protected function initializeRepository(string $className, int $storagePid) |
|
139 | - { |
|
135 | + protected function initializeRepository(string $className, int $storagePid) { |
|
140 | 136 | $repository = $this->objectManager->get($className); |
141 | 137 | |
142 | 138 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class Generator |
|
36 | -{ |
|
35 | +class Generator { |
|
37 | 36 | /** |
38 | 37 | * @var ObjectManager |
39 | 38 | */ |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | */ |
50 | 49 | protected $dataMapper; |
51 | 50 | |
52 | - public function __construct() |
|
53 | - { |
|
51 | + public function __construct() { |
|
54 | 52 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
55 | 53 | $this->languageService = $this->objectManager->get(LanguageService::class); |
56 | 54 | $this->dataMapper = $this->objectManager->get(DataMapper::class); |
@@ -167,8 +165,7 @@ discard block |
||
167 | 165 | return $result; |
168 | 166 | } |
169 | 167 | |
170 | - protected function parseDocComment($docComment) |
|
171 | - { |
|
168 | + protected function parseDocComment($docComment) { |
|
172 | 169 | // TODO: Consider using phpDocumentor (though that splits the docblock into summary and description) |
173 | 170 | |
174 | 171 | // Adopted from DocCommentParser in TYPO3 v9 |
@@ -193,8 +190,7 @@ discard block |
||
193 | 190 | /** |
194 | 191 | * Transform table structure into .rst page. |
195 | 192 | */ |
196 | - public function generatePage(array $tables) |
|
197 | - { |
|
193 | + public function generatePage(array $tables) { |
|
198 | 194 | $page = new RstSection(); |
199 | 195 | $page->setHeader('Database Tables'); |
200 | 196 | $page->addText(<<<RST |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
27 | 27 | */ |
28 | - public function findBySettings($settings = []) |
|
29 | - { |
|
28 | + public function findBySettings($settings = []) { |
|
30 | 29 | $query = $this->createQuery(); |
31 | 30 | |
32 | 31 | $constraints = []; |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
37 | 37 | */ |
38 | - public function findAllByUids($uids) |
|
39 | - { |
|
38 | + public function findAllByUids($uids) { |
|
40 | 39 | $query = $this->createQuery(); |
41 | 40 | |
42 | 41 | $constraints = []; |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | return $query->execute(); |
50 | 49 | } |
51 | 50 | |
52 | - public function getCollectionForMetadata($pages) |
|
53 | - { |
|
51 | + public function getCollectionForMetadata($pages) { |
|
54 | 52 | // Get list of collections to show. |
55 | 53 | $query = $this->createQuery(); |
56 | 54 | |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | * |
67 | 65 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
68 | 66 | */ |
69 | - public function findCollectionsBySettings($settings = []) |
|
70 | - { |
|
67 | + public function findCollectionsBySettings($settings = []) { |
|
71 | 68 | $query = $this->createQuery(); |
72 | 69 | |
73 | 70 | $constraints = []; |
@@ -104,8 +101,7 @@ discard block |
||
104 | 101 | return $query->execute(); |
105 | 102 | } |
106 | 103 | |
107 | - public function getIndexNameForSolr($settings, $set) |
|
108 | - { |
|
104 | + public function getIndexNameForSolr($settings, $set) { |
|
109 | 105 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
110 | 106 | ->getQueryBuilderForTable('tx_dlf_collections'); |
111 | 107 |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function deleteExpiredTokens($expireTime) |
|
29 | - { |
|
28 | + public function deleteExpiredTokens($expireTime) { |
|
30 | 29 | $query = $this->createQuery(); |
31 | 30 | |
32 | 31 | $constraints = []; |
@@ -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 | |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | } |
91 | 90 | |
92 | 91 | |
93 | - public function findByUidAndPartOf($uid, $partOf) |
|
94 | - { |
|
92 | + public function findByUidAndPartOf($uid, $partOf) { |
|
95 | 93 | $query = $this->createQuery(); |
96 | 94 | |
97 | 95 | $query->matching($query->equals('uid', $uid)); |
@@ -105,8 +103,7 @@ discard block |
||
105 | 103 | * |
106 | 104 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
107 | 105 | */ |
108 | - public function findOldestDocument() |
|
109 | - { |
|
106 | + public function findOldestDocument() { |
|
110 | 107 | $query = $this->createQuery(); |
111 | 108 | |
112 | 109 | $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]); |
@@ -120,8 +117,7 @@ discard block |
||
120 | 117 | * @param \Kitodo\Dlf\Domain\Model\Structure $structure |
121 | 118 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
122 | 119 | */ |
123 | - public function getChildrenOfYearAnchor($partOf, $structure) |
|
124 | - { |
|
120 | + public function getChildrenOfYearAnchor($partOf, $structure) { |
|
125 | 121 | $query = $this->createQuery(); |
126 | 122 | |
127 | 123 | $query->matching($query->equals('structure', $structure)); |
@@ -142,8 +138,7 @@ discard block |
||
142 | 138 | * |
143 | 139 | * @return \Kitodo\Dlf\Domain\Model\Document|null |
144 | 140 | */ |
145 | - public function findOneByIdAndSettings($uid, $settings = []) |
|
146 | - { |
|
141 | + public function findOneByIdAndSettings($uid, $settings = []) { |
|
147 | 142 | $settings = ['documentSets' => $uid]; |
148 | 143 | |
149 | 144 | return $this->findDocumentsBySettings($settings)->getFirst(); |
@@ -156,8 +151,7 @@ discard block |
||
156 | 151 | * |
157 | 152 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
158 | 153 | */ |
159 | - public function findDocumentsBySettings($settings = []) |
|
160 | - { |
|
154 | + public function findDocumentsBySettings($settings = []) { |
|
161 | 155 | $query = $this->createQuery(); |
162 | 156 | |
163 | 157 | $constraints = []; |
@@ -187,8 +181,7 @@ discard block |
||
187 | 181 | * |
188 | 182 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
189 | 183 | */ |
190 | - public function findAllByCollectionsLimited($collections, $limit = 50) |
|
191 | - { |
|
184 | + public function findAllByCollectionsLimited($collections, $limit = 50) { |
|
192 | 185 | $query = $this->createQuery(); |
193 | 186 | |
194 | 187 | // order by start_date -> start_time... |
@@ -223,8 +216,7 @@ discard block |
||
223 | 216 | * |
224 | 217 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
225 | 218 | */ |
226 | - public function findAllTitles($settings = []) |
|
227 | - { |
|
219 | + public function findAllTitles($settings = []) { |
|
228 | 220 | $query = $this->createQuery(); |
229 | 221 | |
230 | 222 | $constraints = []; |
@@ -252,8 +244,7 @@ discard block |
||
252 | 244 | * |
253 | 245 | * @return int |
254 | 246 | */ |
255 | - public function countAllTitles($settings = []) |
|
256 | - { |
|
247 | + public function countAllTitles($settings = []) { |
|
257 | 248 | return $this->findAllTitles($settings)->count(); |
258 | 249 | } |
259 | 250 | |
@@ -266,8 +257,7 @@ discard block |
||
266 | 257 | * |
267 | 258 | * @return int |
268 | 259 | */ |
269 | - public function countAllVolumes($settings = []) |
|
270 | - { |
|
260 | + public function countAllVolumes($settings = []) { |
|
271 | 261 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
272 | 262 | ->getQueryBuilderForTable('tx_dlf_documents'); |
273 | 263 | $subQueryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -295,8 +285,7 @@ discard block |
||
295 | 285 | return $countVolumes; |
296 | 286 | } |
297 | 287 | |
298 | - public function getStatisticsForSelectedCollection($settings) |
|
299 | - { |
|
288 | + public function getStatisticsForSelectedCollection($settings) { |
|
300 | 289 | // Include only selected collections. |
301 | 290 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
302 | 291 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -386,8 +375,7 @@ discard block |
||
386 | 375 | return ['titles' => $countTitles, 'volumes' => $countVolumes]; |
387 | 376 | } |
388 | 377 | |
389 | - public function getTableOfContentsFromDb($uid, $pid, $settings) |
|
390 | - { |
|
378 | + public function getTableOfContentsFromDb($uid, $pid, $settings) { |
|
391 | 379 | // Build table of contents from database. |
392 | 380 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
393 | 381 | ->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -435,8 +423,7 @@ discard block |
||
435 | 423 | * |
436 | 424 | * @return array The found document object |
437 | 425 | */ |
438 | - public function getOaiRecord($settings, $parameters) |
|
439 | - { |
|
426 | + public function getOaiRecord($settings, $parameters) { |
|
440 | 427 | $where = ''; |
441 | 428 | |
442 | 429 | if (!$settings['show_userdefined']) { |
@@ -476,8 +463,7 @@ discard block |
||
476 | 463 | * |
477 | 464 | * @return array The found document objects |
478 | 465 | */ |
479 | - public function getOaiDocumentList($settings, $documentsToProcess) |
|
480 | - { |
|
466 | + public function getOaiDocumentList($settings, $documentsToProcess) { |
|
481 | 467 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
482 | 468 | ->getConnectionForTable('tx_dlf_documents'); |
483 | 469 | |
@@ -511,8 +497,7 @@ discard block |
||
511 | 497 | * |
512 | 498 | * @return array |
513 | 499 | */ |
514 | - private function findAllByUids($uids) |
|
515 | - { |
|
500 | + private function findAllByUids($uids) { |
|
516 | 501 | // get all documents from db we are talking about |
517 | 502 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
518 | 503 | $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents'); |
@@ -556,8 +541,7 @@ discard block |
||
556 | 541 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
557 | 542 | * @return array |
558 | 543 | */ |
559 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
560 | - { |
|
544 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) { |
|
561 | 545 | // set settings global inside this repository |
562 | 546 | $this->settings = $settings; |
563 | 547 | |
@@ -766,8 +750,7 @@ discard block |
||
766 | 750 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
767 | 751 | * @return array |
768 | 752 | */ |
769 | - public function fetchMetadataFromSolr($uid, $listedMetadata = []) |
|
770 | - { |
|
753 | + public function fetchMetadataFromSolr($uid, $listedMetadata = []) { |
|
771 | 754 | // Prepare query parameters. |
772 | 755 | $params = []; |
773 | 756 | $metadataArray = []; |
@@ -816,8 +799,7 @@ discard block |
||
816 | 799 | * |
817 | 800 | * @return array The Apache Solr Documents that were fetched |
818 | 801 | */ |
819 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
820 | - { |
|
802 | + protected function searchSolr($parameters = [], $enableCache = true) { |
|
821 | 803 | // Set additional query parameters. |
822 | 804 | $parameters['start'] = 0; |
823 | 805 | // Set query. |
@@ -18,8 +18,7 @@ |
||
18 | 18 | class MailRepository extends \TYPO3\CMS\Extbase\Persistence\Repository |
19 | 19 | { |
20 | 20 | |
21 | - public function findAllWithPid($pid) |
|
22 | - { |
|
21 | + public function findAllWithPid($pid) { |
|
23 | 22 | /** @var Typo3QuerySettings $querySettings */ |
24 | 23 | $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class); |
25 | 24 |