@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $fileMimeType = $this->getFileMimeType($id); |
218 | 218 | $fileLocation = $this->getFileLocation($id); |
219 | 219 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
220 | - $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation . 'info.json' : $fileLocation . '/info.json'); |
|
220 | + $fileLocation = (strrpos($fileLocation, 'info.json') === strlen($fileLocation) - 9) ? $fileLocation : (strrpos($fileLocation, '/') === strlen($fileLocation) ? $fileLocation.'info.json' : $fileLocation.'/info.json'); |
|
221 | 221 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
222 | 222 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
223 | 223 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | return $service->getImageUrl(); |
228 | 228 | } |
229 | 229 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
230 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
230 | + $baseURL = $fileLocation.(strpos($fileLocation, '?') === false ? '?' : ''); |
|
231 | 231 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
232 | - return $baseURL . '&CVT=jpeg'; |
|
232 | + return $baseURL.'&CVT=jpeg'; |
|
233 | 233 | } |
234 | 234 | return $fileLocation; |
235 | 235 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function getFileLocation($id) |
242 | 242 | { |
243 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
243 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
244 | 244 | if ( |
245 | 245 | !empty($id) |
246 | 246 | && !empty($location) |
247 | 247 | ) { |
248 | 248 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
249 | 249 | } else { |
250 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
250 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
251 | 251 | return ''; |
252 | 252 | } |
253 | 253 | } |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function getFileMimeType($id) |
260 | 260 | { |
261 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
261 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
262 | 262 | if ( |
263 | 263 | !empty($id) |
264 | 264 | && !empty($mimetype) |
265 | 265 | ) { |
266 | 266 | return (string) $mimetype[0]; |
267 | 267 | } else { |
268 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
268 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
269 | 269 | return ''; |
270 | 270 | } |
271 | 271 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | return $this->logicalUnits[$id]; |
287 | 287 | } elseif (!empty($id)) { |
288 | 288 | // Get specified logical unit. |
289 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
289 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
290 | 290 | } else { |
291 | 291 | // Get all logical units at top level. |
292 | 292 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // Retain current PID. |
428 | 428 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
429 | 429 | } elseif (!$cPid) { |
430 | - $this->logger->warning('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
430 | + $this->logger->warning('Invalid PID '.$cPid.' for metadata definitions'); |
|
431 | 431 | return []; |
432 | 432 | } |
433 | 433 | // Get metadata from parsed metadata array if available. |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | if (!empty($this->logicalUnits[$id])) { |
479 | 479 | $metadata['type'] = [$this->logicalUnits[$id]['type']]; |
480 | 480 | } else { |
481 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
481 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
482 | 482 | if (!empty($struct)) { |
483 | 483 | $metadata['type'] = [(string) $struct[0]]; |
484 | 484 | } |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | ) { |
504 | 504 | $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata); |
505 | 505 | } else { |
506 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
506 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } else { |
510 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
510 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
511 | 511 | // Continue searching for supported metadata with next @DMDID. |
512 | 512 | continue; |
513 | 513 | } |
@@ -623,13 +623,13 @@ discard block |
||
623 | 623 | $values instanceof \DOMNodeList |
624 | 624 | && $values->length > 0 |
625 | 625 | ) { |
626 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
626 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
627 | 627 | } elseif (!($values instanceof \DOMNodeList)) { |
628 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values); |
|
628 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values); |
|
629 | 629 | } |
630 | 630 | } |
631 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
632 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
631 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
632 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | if (isset($this->fileInfos[$id]) || isset($hasMetadataSection['dmdSec'])) { |
646 | 646 | return $metadata; |
647 | 647 | } else { |
648 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
648 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
649 | 649 | return []; |
650 | 650 | } |
651 | 651 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
671 | 671 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
672 | 672 | } else { |
673 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
673 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
674 | 674 | if ($mdSec) { |
675 | 675 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
676 | 676 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
701 | - return array_filter($allMdIds, function ($element) { |
|
701 | + return array_filter($allMdIds, function($element) { |
|
702 | 702 | return !empty($element); |
703 | 703 | }); |
704 | 704 | } |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | */ |
726 | 726 | public function getStructureDepth($logId) |
727 | 727 | { |
728 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
728 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
729 | 729 | if (!empty($ancestors)) { |
730 | 730 | return count($ancestors); |
731 | 731 | } else { |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | $this->registerNamespaces($this->mets); |
750 | 750 | } else { |
751 | 751 | if (!empty($location)) { |
752 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
752 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
753 | 753 | } else if (!empty($this->recordId)) { |
754 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
754 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
755 | 755 | } else { |
756 | 756 | $this->logger->error('No METS part found in current document.'); |
757 | 757 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | return true; |
774 | 774 | } |
775 | 775 | } |
776 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
776 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
777 | 777 | return false; |
778 | 778 | } |
779 | 779 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | if ($type = $element->xpath('./mets:mdWrap[not(@MDTYPE="OTHER")]/@MDTYPE')) { |
889 | 889 | if (!empty($this->formats[(string) $type[0]])) { |
890 | 890 | $type = (string) $type[0]; |
891 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
891 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
892 | 892 | } |
893 | 893 | } elseif ($type = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"]/@OTHERMDTYPE')) { |
894 | 894 | if (!empty($this->formats[(string) $type[0]])) { |
895 | 895 | $type = (string) $type[0]; |
896 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
896 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | // Retain current PID. |
1101 | 1101 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1102 | 1102 | if (!$cPid) { |
1103 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
1103 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
1104 | 1104 | $this->thumbnailLoaded = true; |
1105 | 1105 | return $this->thumbnail; |
1106 | 1106 | } |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | if (!empty($resArray['thumbnail'])) { |
1138 | 1138 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
1139 | 1139 | // Check if this document has a structure element of the desired type. |
1140 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
1140 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
1141 | 1141 | if (!empty($strctIds)) { |
1142 | 1142 | $strctId = (string) $strctIds[0]; |
1143 | 1143 | } |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | } else { |
1163 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
1163 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
1164 | 1164 | } |
1165 | 1165 | $this->thumbnailLoaded = true; |
1166 | 1166 | } |
@@ -1207,7 +1207,7 @@ discard block |
||
1207 | 1207 | $this->parentHref = ''; |
1208 | 1208 | |
1209 | 1209 | // Get the closest ancestor of the current document which has a MPTR child. |
1210 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1210 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
1211 | 1211 | if (!empty($parentMptr)) { |
1212 | 1212 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
1213 | 1213 | } |
@@ -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 = ''; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @var bool |
96 | 96 | * @access protected |
97 | 97 | */ |
98 | - protected $mdSecLoaded = false; |
|
98 | + protected $mdSecLoaded = FALSE; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Subset of $mdSec storing only the dmdSec entries; kept for compatibility. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @var bool |
130 | 130 | * @access protected |
131 | 131 | */ |
132 | - protected $fileGrpsLoaded = false; |
|
132 | + protected $fileGrpsLoaded = FALSE; |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Additional information about files (e.g., ADMID), indexed by ID. |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
224 | 224 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
225 | 225 | $service = IiifHelper::loadIiifResource($fileLocation); |
226 | - if ($service !== null && $service instanceof AbstractImageService) { |
|
226 | + if ($service !== NULL && $service instanceof AbstractImageService) { |
|
227 | 227 | return $service->getImageUrl(); |
228 | 228 | } |
229 | 229 | } elseif ($fileMimeType === 'application/vnd.netfpx') { |
230 | - $baseURL = $fileLocation . (strpos($fileLocation, '?') === false ? '?' : ''); |
|
230 | + $baseURL = $fileLocation . (strpos($fileLocation, '?') === FALSE ? '?' : ''); |
|
231 | 231 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
232 | 232 | return $baseURL . '&CVT=jpeg'; |
233 | 233 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * {@inheritDoc} |
275 | 275 | * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure() |
276 | 276 | */ |
277 | - public function getLogicalStructure($id, $recursive = false) |
|
277 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
278 | 278 | { |
279 | 279 | $details = []; |
280 | 280 | // Is the requested logical unit already loaded? |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
317 | 317 | */ |
318 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
318 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = FALSE) |
|
319 | 319 | { |
320 | 320 | // Get attributes. |
321 | 321 | foreach ($structure->attributes() as $attribute => $value) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
362 | 362 | ) { |
363 | 363 | // Link logical structure to the first corresponding physical page/track. |
364 | - $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true)), 1); |
|
364 | + $details['points'] = max(intval(array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE)), 1); |
|
365 | 365 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
366 | 366 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
367 | 367 | if (!empty($this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['files'][$fileGrpThumb])) { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $details['children'] = []; |
406 | 406 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
407 | 407 | // Repeat for all children. |
408 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
408 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | return $details; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | } |
635 | 635 | } |
636 | 636 | |
637 | - $hasMetadataSection[$mdSectionType] = true; |
|
637 | + $hasMetadataSection[$mdSectionType] = TRUE; |
|
638 | 638 | } |
639 | 639 | // Set title to empty string if not present. |
640 | 640 | if (empty($metadata['title'][0])) { |
@@ -765,16 +765,16 @@ discard block |
||
765 | 765 | protected function loadLocation($location) |
766 | 766 | { |
767 | 767 | $fileResource = Helper::getUrl($location); |
768 | - if ($fileResource !== false) { |
|
768 | + if ($fileResource !== FALSE) { |
|
769 | 769 | $xml = Helper::getXmlFileAsString($fileResource); |
770 | 770 | // Set some basic properties. |
771 | - if ($xml !== false) { |
|
771 | + if ($xml !== FALSE) { |
|
772 | 772 | $this->xml = $xml; |
773 | - return true; |
|
773 | + return TRUE; |
|
774 | 774 | } |
775 | 775 | } |
776 | 776 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
777 | - return false; |
|
777 | + return FALSE; |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -798,9 +798,9 @@ discard block |
||
798 | 798 | |
799 | 799 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
800 | 800 | $this->xml = $preloadedDocument; |
801 | - return true; |
|
801 | + return TRUE; |
|
802 | 802 | } |
803 | - return false; |
|
803 | + return FALSE; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) { |
828 | 828 | $dmdSec = $this->processMdSec($dmdSecTag); |
829 | 829 | |
830 | - if ($dmdSec !== null) { |
|
830 | + if ($dmdSec !== NULL) { |
|
831 | 831 | $this->mdSec[$dmdSec['id']] = $dmdSec; |
832 | 832 | $this->dmdSec[$dmdSec['id']] = $dmdSec; |
833 | 833 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)? |
845 | 845 | $mdSec = $this->processMdSec($mdSecTag); |
846 | 846 | |
847 | - if ($mdSec !== null) { |
|
847 | + if ($mdSec !== NULL) { |
|
848 | 848 | $this->mdSec[$mdSec['id']] = $mdSec; |
849 | 849 | |
850 | 850 | $childIds[] = $mdSec['id']; |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | } |
858 | 858 | } |
859 | 859 | |
860 | - $this->mdSecLoaded = true; |
|
860 | + $this->mdSecLoaded = TRUE; |
|
861 | 861 | } |
862 | 862 | return $this->mdSec; |
863 | 863 | } |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | { |
882 | 882 | $mdId = (string) $element->attributes()->ID; |
883 | 883 | if (empty($mdId)) { |
884 | - return null; |
|
884 | + return NULL; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | $this->registerNamespaces($element); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | } |
899 | 899 | |
900 | 900 | if (empty($xml)) { |
901 | - return null; |
|
901 | + return NULL; |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | $this->registerNamespaces($xml[0]); |
@@ -959,9 +959,9 @@ discard block |
||
959 | 959 | !empty($extConf['fileGrpFulltext']) |
960 | 960 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
961 | 961 | ) { |
962 | - $this->hasFulltext = true; |
|
962 | + $this->hasFulltext = TRUE; |
|
963 | 963 | } |
964 | - $this->fileGrpsLoaded = true; |
|
964 | + $this->fileGrpsLoaded = TRUE; |
|
965 | 965 | } |
966 | 966 | return $this->fileGrps; |
967 | 967 | } |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $this->physicalStructure = array_merge($physSeq, $elements); |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | - $this->physicalStructureLoaded = true; |
|
1066 | + $this->physicalStructureLoaded = TRUE; |
|
1067 | 1067 | } |
1068 | 1068 | return $this->physicalStructure; |
1069 | 1069 | } |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
1083 | 1083 | } |
1084 | 1084 | } |
1085 | - $this->smLinksLoaded = true; |
|
1085 | + $this->smLinksLoaded = TRUE; |
|
1086 | 1086 | } |
1087 | 1087 | return $this->smLinks; |
1088 | 1088 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | * {@inheritDoc} |
1092 | 1092 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
1093 | 1093 | */ |
1094 | - protected function _getThumbnail($forceReload = false) |
|
1094 | + protected function _getThumbnail($forceReload = FALSE) |
|
1095 | 1095 | { |
1096 | 1096 | if ( |
1097 | 1097 | !$this->thumbnailLoaded |
@@ -1101,14 +1101,14 @@ discard block |
||
1101 | 1101 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
1102 | 1102 | if (!$cPid) { |
1103 | 1103 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
1104 | - $this->thumbnailLoaded = true; |
|
1104 | + $this->thumbnailLoaded = TRUE; |
|
1105 | 1105 | return $this->thumbnail; |
1106 | 1106 | } |
1107 | 1107 | // Load extension configuration. |
1108 | 1108 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
1109 | 1109 | if (empty($extConf['fileGrpThumbs'])) { |
1110 | 1110 | $this->logger->warning('No fileGrp for thumbnails specified'); |
1111 | - $this->thumbnailLoaded = true; |
|
1111 | + $this->thumbnailLoaded = TRUE; |
|
1112 | 1112 | return $this->thumbnail; |
1113 | 1113 | } |
1114 | 1114 | $strctId = $this->_getToplevelId(); |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | } else { |
1163 | 1163 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
1164 | 1164 | } |
1165 | - $this->thumbnailLoaded = true; |
|
1165 | + $this->thumbnailLoaded = TRUE; |
|
1166 | 1166 | } |
1167 | 1167 | return $this->thumbnail; |
1168 | 1168 | } |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | */ |
1204 | 1204 | public function _getParentHref() |
1205 | 1205 | { |
1206 | - if ($this->parentHref === null) { |
|
1206 | + if ($this->parentHref === NULL) { |
|
1207 | 1207 | $this->parentHref = ''; |
1208 | 1208 | |
1209 | 1209 | // Get the closest ancestor of the current document which has a MPTR child. |
@@ -1241,8 +1241,8 @@ discard block |
||
1241 | 1241 | public function __toString() |
1242 | 1242 | { |
1243 | 1243 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1244 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
1245 | - $xml->formatOutput = true; |
|
1244 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
1245 | + $xml->formatOutput = TRUE; |
|
1246 | 1246 | return $xml->saveXML(); |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | public function __wakeup() |
1258 | 1258 | { |
1259 | 1259 | $xml = Helper::getXmlFileAsString($this->asXML); |
1260 | - if ($xml !== false) { |
|
1260 | + if ($xml !== FALSE) { |
|
1261 | 1261 | $this->asXML = ''; |
1262 | 1262 | $this->xml = $xml; |
1263 | 1263 | // Rebuild the unserializable properties. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // in which case metadata of toplevel entry isn't yet filled. |
98 | 98 | if (empty($document['metadata'])) { |
99 | 99 | $document['metadata'] = $this->fetchToplevelMetadataFromSolr([ |
100 | - 'query' => 'uid:' . $document['uid'], |
|
100 | + 'query' => 'uid:'.$document['uid'], |
|
101 | 101 | 'start' => 0, |
102 | 102 | 'rows' => 1, |
103 | 103 | 'sort' => ['score' => 'desc'], |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if (empty($document['title']) && $document['partOf'] > 0) { |
109 | 109 | $superiorTitle = Doc::getTitle($document['partOf'], true); |
110 | 110 | if (!empty($superiorTitle)) { |
111 | - $document['title'] = '[' . $superiorTitle . ']'; |
|
111 | + $document['title'] = '['.$superiorTitle.']'; |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | // Set search query. |
172 | 172 | if ( |
173 | 173 | (!empty($this->searchParams['fulltext'])) |
174 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
174 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
175 | 175 | ) { |
176 | 176 | // If the query already is a fulltext query e.g using the facets |
177 | 177 | $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1]; |
178 | 178 | // Search in fulltext field if applicable. Query must not be empty! |
179 | 179 | if (!empty($this->searchParams['query'])) { |
180 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
|
180 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')'; |
|
181 | 181 | } |
182 | 182 | $params['fulltext'] = true; |
183 | 183 | } else { |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | in_array($this->searchParams['extOperator'][$i], $allowedOperators) |
201 | 201 | ) { |
202 | 202 | if (!empty($query)) { |
203 | - $query .= ' ' . $this->searchParams['extOperator'][$i] . ' '; |
|
203 | + $query .= ' '.$this->searchParams['extOperator'][$i].' '; |
|
204 | 204 | } |
205 | - $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')'; |
|
205 | + $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')'; |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
@@ -222,22 +222,22 @@ discard block |
||
222 | 222 | ) { |
223 | 223 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
224 | 224 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
225 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
226 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
227 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from=' |
|
228 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
229 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR ' |
|
230 | - . $fields['uid'] . ':' . $this->searchParams['documentId']; |
|
225 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
226 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
227 | + . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from=' |
|
228 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
229 | + . $fields['uid'].':'.$this->searchParams['documentId'].' OR ' |
|
230 | + . $fields['uid'].':'.$this->searchParams['documentId']; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // if a collection is given, we prepare the collection query string |
234 | 234 | if ($this->collection) { |
235 | 235 | if ($this->collection instanceof Collection) { |
236 | - $collectionsQueryString = '"' . $this->collection->getIndexName() . '"'; |
|
236 | + $collectionsQueryString = '"'.$this->collection->getIndexName().'"'; |
|
237 | 237 | } else { |
238 | 238 | $collectionsQueryString = ''; |
239 | 239 | foreach ($this->collection as $index => $collectionEntry) { |
240 | - $collectionsQueryString .= ($index > 0 ? ' OR ' : '') . '"' . $collectionEntry->getIndexName() . '"'; |
|
240 | + $collectionsQueryString .= ($index > 0 ? ' OR ' : '').'"'.$collectionEntry->getIndexName().'"'; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $params['filterquery'][]['query'] = 'toplevel:true'; |
246 | 246 | $params['filterquery'][]['query'] = 'partof:0'; |
247 | 247 | } |
248 | - $params['filterquery'][]['query'] = 'collection_faceting:(' . $collectionsQueryString . ')'; |
|
248 | + $params['filterquery'][]['query'] = 'collection_faceting:('.$collectionsQueryString.')'; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // Set some query parameters. |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | if ($this->listedMetadata) { |
273 | 273 | foreach ($this->listedMetadata as $metadata) { |
274 | 274 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
275 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
276 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
275 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
276 | + $params['fields'] .= ','.$listMetadataRecord; |
|
277 | 277 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
278 | 278 | } |
279 | 279 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $children = $childrenOf[$doc['uid']] ?? []; |
352 | 352 | if (!empty($children)) { |
353 | 353 | $metadataOf = $this->fetchToplevelMetadataFromSolr([ |
354 | - 'query' => 'partof:' . $doc['uid'], |
|
354 | + 'query' => 'partof:'.$doc['uid'], |
|
355 | 355 | 'start' => 0, |
356 | 356 | 'rows' => 100, |
357 | 357 | ]); |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | if ($this->listedMetadata) { |
399 | 399 | foreach ($this->listedMetadata as $metadata) { |
400 | 400 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
401 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
402 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
401 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
402 | + $params['fields'] .= ','.$listMetadataRecord; |
|
403 | 403 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
404 | 404 | } |
405 | 405 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $cache = null; |
450 | 450 | // Calculate cache identifier. |
451 | 451 | if ($enableCache === true) { |
452 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
452 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
453 | 453 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
454 | 454 | } |
455 | 455 | $resultSet = [ |
@@ -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'] : []; |
@@ -33,7 +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) |
|
36 | + public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = NULL) |
|
37 | 37 | { |
38 | 38 | $this->documentRepository = $documentRepository; |
39 | 39 | $this->collection = $collection; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function count() |
51 | 51 | { |
52 | - if ($this->result === null) { |
|
52 | + if ($this->result === NULL) { |
|
53 | 53 | return 0; |
54 | 54 | } |
55 | 55 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | public function offsetGet($offset) |
91 | 91 | { |
92 | 92 | $idx = $this->result['document_keys'][$offset]; |
93 | - $document = $this->result['documents'][$idx] ?? null; |
|
93 | + $document = $this->result['documents'][$idx] ?? NULL; |
|
94 | 94 | |
95 | - if ($document !== null) { |
|
95 | + if ($document !== NULL) { |
|
96 | 96 | // It may happen that a Solr group only includes non-toplevel results, |
97 | 97 | // in which case metadata of toplevel entry isn't yet filled. |
98 | 98 | if (empty($document['metadata'])) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | // get title of parent/grandparent/... if empty |
108 | 108 | if (empty($document['title']) && $document['partOf'] > 0) { |
109 | - $superiorTitle = Doc::getTitle($document['partOf'], true); |
|
109 | + $superiorTitle = Doc::getTitle($document['partOf'], TRUE); |
|
110 | 110 | if (!empty($superiorTitle)) { |
111 | 111 | $document['title'] = '[' . $superiorTitle . ']'; |
112 | 112 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if (!empty($this->searchParams['query'])) { |
180 | 180 | $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
181 | 181 | } |
182 | - $params['fulltext'] = true; |
|
182 | + $params['fulltext'] = TRUE; |
|
183 | 183 | } else { |
184 | 184 | // Retain given search field if valid. |
185 | 185 | if (!empty($this->searchParams['query'])) { |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | $this->params = $params; |
283 | 283 | |
284 | 284 | // Send off query to get total number of search results in advance |
285 | - $this->submit(0, 1, false); |
|
285 | + $this->submit(0, 1, FALSE); |
|
286 | 286 | } |
287 | 287 | |
288 | - public function submit($start, $rows, $processResults = true) |
|
288 | + public function submit($start, $rows, $processResults = TRUE) |
|
289 | 289 | { |
290 | 290 | $params = $this->params; |
291 | 291 | $params['start'] = $start; |
292 | 292 | $params['rows'] = $rows; |
293 | 293 | |
294 | 294 | // Perform search. |
295 | - $result = $this->searchSolr($params, true); |
|
295 | + $result = $this->searchSolr($params, TRUE); |
|
296 | 296 | |
297 | 297 | // Initialize values |
298 | 298 | $documents = []; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $documents[$doc['uid']] = $allDocuments[$doc['uid']]; |
317 | 317 | } |
318 | 318 | if ($documents[$doc['uid']]) { |
319 | - if ($doc['toplevel'] === false) { |
|
319 | + if ($doc['toplevel'] === FALSE) { |
|
320 | 320 | // this maybe a chapter, article, ..., year |
321 | 321 | if ($doc['type'] === 'year') { |
322 | 322 | continue; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | $documents[$doc['uid']]['searchResults'][] = $searchResult; |
342 | 342 | } |
343 | - } else if ($doc['toplevel'] === true) { |
|
343 | + } else if ($doc['toplevel'] === TRUE) { |
|
344 | 344 | foreach ($params['listMetadataRecords'] as $indexName => $solrField) { |
345 | 345 | if (isset($doc['metadata'][$indexName])) { |
346 | 346 | $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName]; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
409 | 409 | |
410 | 410 | // Perform search. |
411 | - $result = $this->searchSolr($params, true); |
|
411 | + $result = $this->searchSolr($params, TRUE); |
|
412 | 412 | |
413 | 413 | foreach ($result['documents'] as $doc) { |
414 | 414 | $metadataArray[$doc['uid']] = $doc['metadata']; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @return array The Apache Solr Documents that were fetched |
429 | 429 | */ |
430 | - protected function searchSolr($parameters = [], $enableCache = true) |
|
430 | + protected function searchSolr($parameters = [], $enableCache = TRUE) |
|
431 | 431 | { |
432 | 432 | // Set query. |
433 | 433 | $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*'; |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | $cacheIdentifier = ''; |
449 | - $cache = null; |
|
449 | + $cache = NULL; |
|
450 | 450 | // Calculate cache identifier. |
451 | - if ($enableCache === true) { |
|
452 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
451 | + if ($enableCache === TRUE) { |
|
452 | + $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE)); |
|
453 | 453 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
454 | 454 | } |
455 | 455 | $resultSet = [ |
@@ -457,22 +457,22 @@ discard block |
||
457 | 457 | 'numberOfToplevels' => 0, |
458 | 458 | 'numFound' => 0, |
459 | 459 | ]; |
460 | - if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) { |
|
460 | + if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
461 | 461 | $selectQuery = $solr->service->createSelect($parameters); |
462 | 462 | |
463 | 463 | $grouping = $selectQuery->getGrouping(); |
464 | 464 | $grouping->addField('uid'); |
465 | 465 | $grouping->setLimit(100); // Results in group (TODO: check) |
466 | - $grouping->setNumberOfGroups(true); |
|
466 | + $grouping->setNumberOfGroups(TRUE); |
|
467 | 467 | |
468 | - if ($parameters['fulltext'] === true) { |
|
468 | + if ($parameters['fulltext'] === TRUE) { |
|
469 | 469 | // get highlighting component and apply settings |
470 | 470 | $selectQuery->getHighlighting(); |
471 | 471 | } |
472 | 472 | |
473 | 473 | $solrRequest = $solr->service->createRequest($selectQuery); |
474 | 474 | |
475 | - if ($parameters['fulltext'] === true) { |
|
475 | + if ($parameters['fulltext'] === TRUE) { |
|
476 | 476 | // If it is a fulltext search, enable highlighting. |
477 | 477 | // field for which highlighting is going to be performed, |
478 | 478 | // is required if you want to have OCR highlighting |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups(); |
494 | 494 | $resultSet['numFound'] = $uidGroup->getMatches(); |
495 | 495 | $highlighting = []; |
496 | - if ($parameters['fulltext'] === true) { |
|
496 | + if ($parameters['fulltext'] === TRUE) { |
|
497 | 497 | $data = $result->getData(); |
498 | 498 | $highlighting = $data['ocrHighlighting']; |
499 | 499 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | // Save value in cache. |
527 | - if (!empty($resultSet) && $enableCache === true) { |
|
527 | + if (!empty($resultSet) && $enableCache === TRUE) { |
|
528 | 528 | $cache->set($cacheIdentifier, $resultSet); |
529 | 529 | } |
530 | 530 | } else { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
144 | 144 | return false; |
145 | 145 | } elseif ($checksum == 10) { |
146 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
146 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
148 | 148 | return false; |
149 | 149 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
316 | 316 | // Merge initialisation vector and encrypted data. |
317 | 317 | if ($encrypted !== false) { |
318 | - $encrypted = base64_encode($iv . $encrypted); |
|
318 | + $encrypted = base64_encode($iv.$encrypted); |
|
319 | 319 | } |
320 | 320 | return $encrypted; |
321 | 321 | } |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | public static function getHookObjects($scriptRelPath) |
370 | 370 | { |
371 | 371 | $hookObjects = []; |
372 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
373 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
372 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
373 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
374 | 374 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
375 | 375 | } |
376 | 376 | } |
@@ -397,12 +397,12 @@ discard block |
||
397 | 397 | // NOTE: Only use tables that don't have too many entries! |
398 | 398 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
399 | 399 | ) { |
400 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
400 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
401 | 401 | return ''; |
402 | 402 | } |
403 | 403 | |
404 | - $makeCacheKey = function ($pid, $uid) { |
|
405 | - return $pid . '.' . $uid; |
|
404 | + $makeCacheKey = function($pid, $uid) { |
|
405 | + return $pid.'.'.$uid; |
|
406 | 406 | }; |
407 | 407 | |
408 | 408 | static $cache = []; |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | |
413 | 413 | $result = $queryBuilder |
414 | 414 | ->select( |
415 | - $table . '.index_name AS index_name', |
|
416 | - $table . '.uid AS uid', |
|
417 | - $table . '.pid AS pid', |
|
415 | + $table.'.index_name AS index_name', |
|
416 | + $table.'.uid AS uid', |
|
417 | + $table.'.pid AS pid', |
|
418 | 418 | ) |
419 | 419 | ->from($table) |
420 | 420 | ->execute(); |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $result = $cache[$table][$cacheKey] ?? ''; |
433 | 433 | |
434 | 434 | if ($result === '') { |
435 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
435 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | return $result; |
@@ -459,11 +459,11 @@ discard block |
||
459 | 459 | // No ISO code, return unchanged. |
460 | 460 | return $code; |
461 | 461 | } |
462 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
462 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
463 | 463 | if (!empty($lang)) { |
464 | 464 | return $lang; |
465 | 465 | } else { |
466 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
466 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
467 | 467 | return $code; |
468 | 468 | } |
469 | 469 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | '-' => 39, |
561 | 561 | ':' => 17, |
562 | 562 | ]; |
563 | - $urn = strtolower($base . $id); |
|
563 | + $urn = strtolower($base.$id); |
|
564 | 564 | if (preg_match('/[^a-z0-9:-]/', $urn)) { |
565 | 565 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
566 | 566 | return ''; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $checksum += ($i + 1) * intval(substr($digits, $i, 1)); |
575 | 575 | } |
576 | 576 | $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1); |
577 | - return $base . $id . $checksum; |
|
577 | + return $base.$id.$checksum; |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | // Sanitize input. |
669 | 669 | $pid = max(intval($pid), 0); |
670 | 670 | if (!$pid) { |
671 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
671 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
672 | 672 | return $index_name; |
673 | 673 | } |
674 | 674 | /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */ |
@@ -690,13 +690,13 @@ discard block |
||
690 | 690 | // First fetch the uid of the received index_name |
691 | 691 | $result = $queryBuilder |
692 | 692 | ->select( |
693 | - $table . '.uid AS uid', |
|
694 | - $table . '.l18n_parent AS l18n_parent' |
|
693 | + $table.'.uid AS uid', |
|
694 | + $table.'.l18n_parent AS l18n_parent' |
|
695 | 695 | ) |
696 | 696 | ->from($table) |
697 | 697 | ->where( |
698 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
699 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
|
698 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
699 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)), |
|
700 | 700 | self::whereExpression($table, true) |
701 | 701 | ) |
702 | 702 | ->setMaxResults(1) |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | $resArray = $allResults[0]; |
710 | 710 | |
711 | 711 | $result = $queryBuilder |
712 | - ->select($table . '.index_name AS index_name') |
|
712 | + ->select($table.'.index_name AS index_name') |
|
713 | 713 | ->from($table) |
714 | 714 | ->where( |
715 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
716 | - $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
|
717 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
|
715 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
716 | + $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']), |
|
717 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())), |
|
718 | 718 | self::whereExpression($table, true) |
719 | 719 | ) |
720 | 720 | ->setMaxResults(1) |
@@ -732,14 +732,14 @@ discard block |
||
732 | 732 | if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) { |
733 | 733 | // Check if this table is allowed for translation. |
734 | 734 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
735 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
735 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
736 | 736 | if ($languageAspect->getContentId() > 0) { |
737 | 737 | $additionalWhere = $queryBuilder->expr()->andX( |
738 | 738 | $queryBuilder->expr()->orX( |
739 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
740 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())) |
|
739 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
740 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())) |
|
741 | 741 | ), |
742 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
742 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
743 | 743 | ); |
744 | 744 | } |
745 | 745 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | ->select('*') |
749 | 749 | ->from($table) |
750 | 750 | ->where( |
751 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
751 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
752 | 752 | $additionalWhere, |
753 | 753 | self::whereExpression($table, true) |
754 | 754 | ) |
@@ -766,10 +766,10 @@ discard block |
||
766 | 766 | } |
767 | 767 | } |
768 | 768 | } else { |
769 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
769 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
770 | 770 | } |
771 | 771 | } else { |
772 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
772 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
773 | 773 | } |
774 | 774 | } |
775 | 775 | |
@@ -811,9 +811,9 @@ discard block |
||
811 | 811 | return GeneralUtility::makeInstance(ConnectionPool::class) |
812 | 812 | ->getQueryBuilderForTable($table) |
813 | 813 | ->expr() |
814 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
814 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
815 | 815 | } else { |
816 | - self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR); |
|
816 | + self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR); |
|
817 | 817 | return '1=-1'; |
818 | 818 | } |
819 | 819 | } |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | */ |
853 | 853 | public static function polyfillExtbaseClassesForTYPO3v9() |
854 | 854 | { |
855 | - $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php'; |
|
855 | + $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php'; |
|
856 | 856 | |
857 | 857 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
858 | 858 | $configurationManager = $objectManager->get(ConfigurationManager::class); |
@@ -908,10 +908,10 @@ discard block |
||
908 | 908 | try { |
909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
910 | 910 | } catch (\Exception $e) { |
911 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
911 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
912 | 912 | return false; |
913 | 913 | } |
914 | - $content = $response->getBody()->getContents(); |
|
914 | + $content = $response->getBody()->getContents(); |
|
915 | 915 | |
916 | 916 | return $content; |
917 | 917 | } |
@@ -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 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
83 | 83 | */ |
84 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
84 | + public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages') |
|
85 | 85 | { |
86 | 86 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
87 | 87 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | $checksum = 'X'; |
124 | 124 | } |
125 | 125 | if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) { |
126 | - return false; |
|
126 | + return FALSE; |
|
127 | 127 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
128 | - return false; |
|
128 | + return FALSE; |
|
129 | 129 | } |
130 | 130 | break; |
131 | 131 | case 'ZDB': |
@@ -133,19 +133,19 @@ discard block |
||
133 | 133 | $checksum = 'X'; |
134 | 134 | } |
135 | 135 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
136 | - return false; |
|
136 | + return FALSE; |
|
137 | 137 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
138 | - return false; |
|
138 | + return FALSE; |
|
139 | 139 | } |
140 | 140 | break; |
141 | 141 | case 'SWD': |
142 | 142 | $checksum = 11 - $checksum; |
143 | 143 | if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) { |
144 | - return false; |
|
144 | + return FALSE; |
|
145 | 145 | } elseif ($checksum == 10) { |
146 | 146 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
147 | 147 | } elseif (substr($id, -1, 1) != $checksum) { |
148 | - return false; |
|
148 | + return FALSE; |
|
149 | 149 | } |
150 | 150 | break; |
151 | 151 | case 'GKD': |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | $checksum = 'X'; |
155 | 155 | } |
156 | 156 | if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) { |
157 | - return false; |
|
157 | + return FALSE; |
|
158 | 158 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
159 | - return false; |
|
159 | + return FALSE; |
|
160 | 160 | } |
161 | 161 | break; |
162 | 162 | } |
163 | - return true; |
|
163 | + return TRUE; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -175,28 +175,28 @@ discard block |
||
175 | 175 | public static function decrypt($encrypted) |
176 | 176 | { |
177 | 177 | if ( |
178 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
179 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
178 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
179 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
180 | 180 | ) { |
181 | 181 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
182 | - return false; |
|
182 | + return FALSE; |
|
183 | 183 | } |
184 | 184 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
185 | 185 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
186 | - return false; |
|
186 | + return FALSE; |
|
187 | 187 | } |
188 | 188 | if ( |
189 | 189 | empty($encrypted) |
190 | 190 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
191 | 191 | ) { |
192 | 192 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
193 | - return false; |
|
193 | + return FALSE; |
|
194 | 194 | } |
195 | 195 | // Split initialisation vector and encrypted data. |
196 | 196 | $binary = base64_decode($encrypted); |
197 | 197 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
198 | 198 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
199 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
199 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
200 | 200 | // Decrypt data. |
201 | 201 | $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
202 | 202 | return $decrypted; |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | // Don't make simplexml_load_string throw (when $content is an array |
218 | 218 | // or object) |
219 | 219 | if (!is_string($content)) { |
220 | - return false; |
|
220 | + return FALSE; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // Turn off libxml's error logging. |
224 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
224 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
225 | 225 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
226 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
226 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
227 | 227 | // Try to load XML from file. |
228 | 228 | $xml = simplexml_load_string($content); |
229 | 229 | // reset entity loader setting |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public static function digest($string) |
279 | 279 | { |
280 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
280 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
281 | 281 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
282 | - return false; |
|
282 | + return FALSE; |
|
283 | 283 | } |
284 | 284 | // Hash string. |
285 | 285 | $hashed = openssl_digest($string, self::$hashAlgorithm); |
@@ -298,23 +298,23 @@ discard block |
||
298 | 298 | public static function encrypt($string) |
299 | 299 | { |
300 | 300 | if ( |
301 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
302 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
301 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
302 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
303 | 303 | ) { |
304 | 304 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
305 | - return false; |
|
305 | + return FALSE; |
|
306 | 306 | } |
307 | 307 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
308 | 308 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
309 | - return false; |
|
309 | + return FALSE; |
|
310 | 310 | } |
311 | 311 | // Generate random initialisation vector. |
312 | 312 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
313 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
313 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
314 | 314 | // Encrypt data. |
315 | 315 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
316 | 316 | // Merge initialisation vector and encrypted data. |
317 | - if ($encrypted !== false) { |
|
317 | + if ($encrypted !== FALSE) { |
|
318 | 318 | $encrypted = base64_encode($iv . $encrypted); |
319 | 319 | } |
320 | 320 | return $encrypted; |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | public static function isValidHttpUrl($url) |
602 | 602 | { |
603 | 603 | if (!GeneralUtility::isValidUrl($url)) { |
604 | - return false; |
|
604 | + return FALSE; |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | $parsed = parse_url($url); |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * |
626 | 626 | * @return array Merged array |
627 | 627 | */ |
628 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
628 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE) |
|
629 | 629 | { |
630 | 630 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
631 | 631 | return $original; |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ->where( |
698 | 698 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
699 | 699 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)), |
700 | - self::whereExpression($table, true) |
|
700 | + self::whereExpression($table, TRUE) |
|
701 | 701 | ) |
702 | 702 | ->setMaxResults(1) |
703 | 703 | ->execute(); |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
716 | 716 | $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']), |
717 | 717 | $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())), |
718 | - self::whereExpression($table, true) |
|
718 | + self::whereExpression($table, TRUE) |
|
719 | 719 | ) |
720 | 720 | ->setMaxResults(1) |
721 | 721 | ->execute(); |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | ->where( |
751 | 751 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
752 | 752 | $additionalWhere, |
753 | - self::whereExpression($table, true) |
|
753 | + self::whereExpression($table, TRUE) |
|
754 | 754 | ) |
755 | 755 | ->setMaxResults(10000) |
756 | 756 | ->execute(); |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * |
791 | 791 | * @return string Additional WHERE expression |
792 | 792 | */ |
793 | - public static function whereExpression($table, $showHidden = false) |
|
793 | + public static function whereExpression($table, $showHidden = FALSE) |
|
794 | 794 | { |
795 | 795 | if (\TYPO3_MODE === 'FE') { |
796 | 796 | // Should we ignore the record's hidden flag? |
@@ -859,13 +859,13 @@ discard block |
||
859 | 859 | $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); |
860 | 860 | |
861 | 861 | $extbaseClassmap = &$frameworkConfiguration['persistence']['classes']; |
862 | - if ($extbaseClassmap === null) { |
|
862 | + if ($extbaseClassmap === NULL) { |
|
863 | 863 | $extbaseClassmap = []; |
864 | 864 | } |
865 | 865 | |
866 | 866 | foreach ($classes as $className => $classConfig) { |
867 | 867 | $extbaseClass = &$extbaseClassmap[$className]; |
868 | - if ($extbaseClass === null) { |
|
868 | + if ($extbaseClass === NULL) { |
|
869 | 869 | $extbaseClass = []; |
870 | 870 | } |
871 | 871 | if (!isset($extbaseClass['mapping'])) { |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | public static function getUrl(string $url) |
892 | 892 | { |
893 | 893 | if (!Helper::isValidHttpUrl($url)) { |
894 | - return false; |
|
894 | + return FALSE; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | // Get extension configuration. |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $response = $requestFactory->request($url, 'GET', $configuration); |
910 | 910 | } catch (\Exception $e) { |
911 | 911 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
912 | - return false; |
|
912 | + return FALSE; |
|
913 | 913 | } |
914 | 914 | $content = $response->getBody()->getContents(); |
915 | 915 |
@@ -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 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function getSource() {} |
24 | 24 | |
25 | - public function execute($returnRawQueryResult = false) |
|
25 | + public function execute($returnRawQueryResult = FALSE) |
|
26 | 26 | { |
27 | 27 | $this->solrSearch->submit($this->offset, $this->limit); |
28 | 28 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function logicalAnd($constraint1) {} |
54 | 54 | public function logicalOr($constraint1) {} |
55 | 55 | public function logicalNot(ConstraintInterface $constraint) {} |
56 | - public function equals($propertyName, $operand, $caseSensitive = true) {} |
|
56 | + public function equals($propertyName, $operand, $caseSensitive = TRUE) {} |
|
57 | 57 | public function like($propertyName, $operand) {} |
58 | 58 | public function contains($propertyName, $operand) {} |
59 | 59 | public function in($propertyName, $operand) {} |
@@ -298,7 +298,7 @@ |
||
298 | 298 | if ($doc !== null) { |
299 | 299 | // Same as MetsDocument::parentHref (TODO: Use it) |
300 | 300 | // Get the closest ancestor of the current document which has a MPTR child. |
301 | - $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
301 | + $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$doc->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
302 | 302 | if (!empty($parentMptr)) { |
303 | 303 | $parentLocation = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
304 | 304 |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | // Get extension configuration. |
108 | 108 | $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
109 | 109 | } else { |
110 | - return false; |
|
110 | + return FALSE; |
|
111 | 111 | } |
112 | 112 | $this->storagePid = MathUtility::forceIntegerInRange((int) $storagePid, 0); |
113 | 113 | |
114 | - return true; |
|
114 | + return TRUE; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function saveToDatabase(Document $document) |
174 | 174 | { |
175 | - $success = false; |
|
175 | + $success = FALSE; |
|
176 | 176 | |
177 | 177 | $doc = $document->getDoc(); |
178 | - if ($doc === null) { |
|
178 | + if ($doc === NULL) { |
|
179 | 179 | return $success; |
180 | 180 | } |
181 | 181 | $doc->cPid = $this->storagePid; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $document->setPartof($this->getParentDocumentUidForSaving($document)); |
268 | 268 | } |
269 | 269 | |
270 | - if ($document->getUid() === null) { |
|
270 | + if ($document->getUid() === NULL) { |
|
271 | 271 | // new document |
272 | 272 | $this->documentRepository->add($document); |
273 | 273 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
279 | 279 | $persistenceManager->persistAll(); |
280 | 280 | |
281 | - $success = true; |
|
281 | + $success = TRUE; |
|
282 | 282 | |
283 | 283 | return $success; |
284 | 284 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | { |
296 | 296 | $doc = $document->getDoc(); |
297 | 297 | |
298 | - if ($doc !== null) { |
|
298 | + if ($doc !== NULL) { |
|
299 | 299 | // Same as MetsDocument::parentHref (TODO: Use it) |
300 | 300 | // Get the closest ancestor of the current document which has a MPTR child. |
301 | 301 | $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if ($parentDoc->recordId) { |
309 | 309 | $parentDocument = $this->documentRepository->findOneByRecordId($parentDoc->recordId); |
310 | 310 | |
311 | - if ($parentDocument === null) { |
|
311 | + if ($parentDocument === NULL) { |
|
312 | 312 | // create new Document object |
313 | 313 | $parentDocument = GeneralUtility::makeInstance(Document::class); |
314 | 314 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $success = $this->saveToDatabase($parentDocument); |
322 | 322 | |
323 | - if ($success === true) { |
|
323 | + if ($success === TRUE) { |
|
324 | 324 | // add to index |
325 | 325 | Indexer::add($parentDocument); |
326 | 326 | return $parentDocument->getUid(); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | |
357 | 357 | $excludeOtherWhere = ''; |
358 | 358 | if ($settings['excludeOther']) { |
359 | - $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']); |
|
359 | + $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']); |
|
360 | 360 | } |
361 | 361 | // Check if there are any metadata to suggest. |
362 | 362 | $result = $queryBuilder |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
409 | 409 | ->getConnectionForTable('tx_dlf_documents'); |
410 | 410 | |
411 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
412 | - 'FROM `tx_dlf_documents` ' . |
|
413 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
414 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
415 | - 'WHERE `tx_dlf_documents`.`record_id` = ? ' . |
|
416 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
411 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
412 | + 'FROM `tx_dlf_documents` '. |
|
413 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
414 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
415 | + 'WHERE `tx_dlf_documents`.`record_id` = ? '. |
|
416 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
417 | 417 | $where; |
418 | 418 | |
419 | 419 | $values = [ |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | $connection = GeneralUtility::makeInstance(ConnectionPool::class) |
444 | 444 | ->getConnectionForTable('tx_dlf_documents'); |
445 | 445 | |
446 | - $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' . |
|
447 | - 'FROM `tx_dlf_documents` ' . |
|
448 | - 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' . |
|
449 | - 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' . |
|
450 | - 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' . |
|
451 | - 'AND `tx_dlf_relations`.`ident`="docs_colls" ' . |
|
452 | - 'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' . |
|
446 | + $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '. |
|
447 | + 'FROM `tx_dlf_documents` '. |
|
448 | + 'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '. |
|
449 | + 'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '. |
|
450 | + 'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '. |
|
451 | + 'AND `tx_dlf_relations`.`ident`="docs_colls" '. |
|
452 | + 'AND '.Helper::whereExpression('tx_dlf_collections').' '. |
|
453 | 453 | 'GROUP BY `tx_dlf_documents`.`uid` '; |
454 | 454 | |
455 | 455 | $values = [ |
@@ -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; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function findOneByParameters($parameters) |
52 | 52 | { |
53 | - $doc = null; |
|
54 | - $document = null; |
|
53 | + $doc = NULL; |
|
54 | + $document = NULL; |
|
55 | 55 | |
56 | 56 | if (isset($parameters['id']) && MathUtility::canBeInterpretedAsInteger($parameters['id'])) { |
57 | 57 | |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | } else if (isset($parameters['location']) && GeneralUtility::isValidUrl($parameters['location'])) { |
65 | 65 | |
66 | - $doc = Doc::getInstance($parameters['location'], [], true); |
|
66 | + $doc = Doc::getInstance($parameters['location'], [], TRUE); |
|
67 | 67 | |
68 | 68 | if ($doc->recordId) { |
69 | 69 | $document = $this->findOneByRecordId($doc->recordId); |
70 | 70 | } |
71 | 71 | |
72 | - if ($document === null) { |
|
72 | + if ($document === NULL) { |
|
73 | 73 | // create new (dummy) Document object |
74 | 74 | $document = GeneralUtility::makeInstance(Document::class); |
75 | 75 | $document->setLocation($parameters['location']); |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - if ($document !== null && $doc === null) { |
|
81 | - $doc = Doc::getInstance($document->getLocation(), [], true); |
|
80 | + if ($document !== NULL && $doc === NULL) { |
|
81 | + $doc = Doc::getInstance($document->getLocation(), [], TRUE); |
|
82 | 82 | } |
83 | 83 | |
84 | - if ($doc !== null) { |
|
84 | + if ($doc !== NULL) { |
|
85 | 85 | $document->setDoc($doc); |
86 | 86 | } |
87 | 87 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | if (isset($settings['excludeOther']) && (int) $settings['excludeOther'] === 0) { |
158 | - $query->getQuerySettings()->setRespectStoragePage(false); |
|
158 | + $query->getQuerySettings()->setRespectStoragePage(FALSE); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (count($constraints)) { |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return array |
476 | 476 | */ |
477 | - public function findAllByUids($uids, $checkPartof = false) |
|
477 | + public function findAllByUids($uids, $checkPartof = FALSE) |
|
478 | 478 | { |
479 | 479 | // get all documents from db we are talking about |
480 | 480 | $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function findChildrenOfEach(array $uids) |
528 | 528 | { |
529 | - $allDocuments = $this->findAllByUids($uids, true); |
|
529 | + $allDocuments = $this->findAllByUids($uids, TRUE); |
|
530 | 530 | |
531 | 531 | $result = []; |
532 | 532 | foreach ($allDocuments as $doc) { |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata |
547 | 547 | * @return array |
548 | 548 | */ |
549 | - public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) |
|
549 | + public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = NULL) |
|
550 | 550 | { |
551 | 551 | // set settings global inside this repository |
552 | 552 | // (may be necessary when SolrSearch calls back) |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function collectTables(): array |
64 | 64 | { |
65 | 65 | $sqlReader = $this->objectManager->get(SqlReader::class); |
66 | - $sqlCode = $sqlReader->getTablesDefinitionString(true); |
|
66 | + $sqlCode = $sqlReader->getTablesDefinitionString(TRUE); |
|
67 | 67 | $createTableStatements = $sqlReader->getCreateTableStatementArray($sqlCode); |
68 | 68 | |
69 | 69 | $tableToClassName = $this->getTableClassMap(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | |
82 | - $className = $tableToClassName[$tableName] ?? null; |
|
82 | + $className = $tableToClassName[$tableName] ?? NULL; |
|
83 | 83 | |
84 | 84 | $result[] = $this->getTableInfo($table, $className); |
85 | 85 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $isPrimary = []; |
121 | 121 | if (!is_null($primaryKey = $table->getPrimaryKey())) { |
122 | 122 | foreach ($primaryKey->getUnquotedColumns() as $primaryColumn) { |
123 | - $isPrimary[$primaryColumn] = true; |
|
123 | + $isPrimary[$primaryColumn] = TRUE; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | $result = (object) [ |
142 | 142 | 'name' => $tableName, |
143 | 143 | 'columns' => $columns, |
144 | - 'modelClass' => null, |
|
144 | + 'modelClass' => NULL, |
|
145 | 145 | 'sqlComment' => $table->getComment() ?? '', |
146 | 146 | 'classComment' => '', |
147 | 147 | 'feComment' => $this->languageService->sL($GLOBALS['TCA'][$tableName]['ctrl']['title'] ?? ''), |
148 | 148 | ]; |
149 | 149 | |
150 | 150 | // Integrate doc-comments from model class and its fields |
151 | - if ($className !== null) { |
|
151 | + if ($className !== NULL) { |
|
152 | 152 | $reflection = new ReflectionClass($className); |
153 | 153 | |
154 | 154 | $dataMap = $this->dataMapper->getDataMap($className); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // In that case, try to guess the column name from the property name. |
159 | 159 | |
160 | 160 | $column = $dataMap->getColumnMap($property->getName()); |
161 | - $columnName = $column === null |
|
161 | + $columnName = $column === NULL |
|
162 | 162 | ? GeneralUtility::camelCaseToLowerCaseUnderscored($property->getName()) |
163 | 163 | : $column->getColumnName(); |
164 | 164 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $lines = explode("\n", $docComment); |
185 | 185 | foreach ($lines as $line) { |
186 | 186 | // Stop parsing at first tag |
187 | - if ($line !== '' && strpos($line, '@') !== false) { |
|
187 | + if ($line !== '' && strpos($line, '@') !== FALSE) { |
|
188 | 188 | break; |
189 | 189 | } |
190 | 190 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | This is a reference of all database tables defined by Kitodo.Presentation. |
209 | 209 | |
210 | 210 | .. tip:: This page is auto-generated. If you would like to edit it, please use doc-comments in the model class, COMMENT fields in ``ext_tables.sql`` if the table does not have one, or TCA labels. Then, you may re-generate the page by running ``composer docs:db`` inside the Kitodo.Presentation base folder. |
211 | -RST); |
|
211 | +rst); |
|
212 | 212 | |
213 | 213 | // Sort tables alphabetically |
214 | 214 | usort($tables, function ($lhs, $rhs) { |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | 'field' => ( |
244 | 244 | $page->format($column->name, ['bold' => $column->isPrimary]) |
245 | 245 | . "\u{00a0}\u{00a0}" |
246 | - . $page->format($column->type->getName(), ['italic' => true]) |
|
246 | + . $page->format($column->type->getName(), ['italic' => TRUE]) |
|
247 | 247 | ), |
248 | 248 | |
249 | 249 | 'description' => $page->paragraphs([ |
250 | - $page->format($column->feComment, ['italic' => true]), |
|
250 | + $page->format($column->feComment, ['italic' => TRUE]), |
|
251 | 251 | $column->fieldComment, |
252 | 252 | $column->sqlComment, |
253 | 253 | ]), |
@@ -12,8 +12,8 @@ |
||
12 | 12 | { |
13 | 13 | parent::setUp(); |
14 | 14 | |
15 | - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml'); |
|
16 | - $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml'); |
|
15 | + $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml'); |
|
16 | + $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -6,8 +6,7 @@ discard block |
||
6 | 6 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
7 | 7 | use TYPO3\CMS\Core\Localization\LanguageService; |
8 | 8 | |
9 | -class HelperTest extends FunctionalTestCase |
|
10 | -{ |
|
9 | +class HelperTest extends FunctionalTestCase { |
|
11 | 10 | public function setUp(): void |
12 | 11 | { |
13 | 12 | parent::setUp(); |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | /** |
20 | 19 | * @test |
21 | 20 | */ |
22 | - public function canGetIndexNameFromUid() |
|
23 | - { |
|
21 | + public function canGetIndexNameFromUid() { |
|
24 | 22 | // Repeat to make sure caching isn't broken |
25 | 23 | for ($n = 0; $n < 2; $n++) { |
26 | 24 | // Good UID, no PID |
@@ -69,8 +67,7 @@ discard block |
||
69 | 67 | * @test |
70 | 68 | * @group getLanguageName |
71 | 69 | */ |
72 | - public function canTranslateLanguageNameToEnglish() |
|
73 | - { |
|
70 | + public function canTranslateLanguageNameToEnglish() { |
|
74 | 71 | // NOTE: This only tests in BE mode |
75 | 72 | |
76 | 73 | $this->initLanguageService('default'); |
@@ -84,8 +81,7 @@ discard block |
||
84 | 81 | * @test |
85 | 82 | * @group getLanguageName |
86 | 83 | */ |
87 | - public function canTranslateLanguageNameToGerman() |
|
88 | - { |
|
84 | + public function canTranslateLanguageNameToGerman() { |
|
89 | 85 | // NOTE: This only tests in BE mode |
90 | 86 | |
91 | 87 | $this->initLanguageService('de'); |
@@ -86,17 +86,17 @@ |
||
86 | 86 | 'storagePid' => $document->getPid(), |
87 | 87 | ]; |
88 | 88 | |
89 | - $solrSearch = $this->documentRepository->findSolrByCollection(null, $solrSettings, ['query' => '*']); |
|
89 | + $solrSearch = $this->documentRepository->findSolrByCollection(NULL, $solrSettings, ['query' => '*']); |
|
90 | 90 | $solrSearch->getQuery()->execute(); |
91 | 91 | $this->assertEquals(1, count($solrSearch)); |
92 | 92 | $this->assertEquals(15, $solrSearch->getNumFound()); |
93 | 93 | |
94 | 94 | // Check that the title stored in Solr matches the title of database entry |
95 | - $docTitleInSolr = false; |
|
95 | + $docTitleInSolr = FALSE; |
|
96 | 96 | foreach ($solrSearch->getSolrResults()['documents'] as $solrDoc) { |
97 | 97 | if ($solrDoc['toplevel'] && $solrDoc['uid'] === $document->getUid()) { |
98 | 98 | $this->assertEquals($document->getTitle(), $solrDoc['title']); |
99 | - $docTitleInSolr = true; |
|
99 | + $docTitleInSolr = TRUE; |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | } |