@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $parent->setCurrentDocument($doc); |
| 113 | 113 | $success = self::add($parent, $documentRepository); |
| 114 | 114 | } else { |
| 115 | - Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR); |
|
| 115 | + Helper::log('Could not load parent document with UID '.$document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR); |
|
| 116 | 116 | return false; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | self::$processedDocs[] = $document->getUid(); |
| 123 | 123 | // Delete old Solr documents. |
| 124 | 124 | $updateQuery = self::$solr->service->createUpdate(); |
| 125 | - $updateQuery->addDeleteQuery('uid:' . $document->getUid()); |
|
| 125 | + $updateQuery->addDeleteQuery('uid:'.$document->getUid()); |
|
| 126 | 126 | self::$solr->service->update($updateQuery); |
| 127 | 127 | |
| 128 | 128 | // Index every logical unit as separate Solr document. |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // Sanitize input. |
| 195 | 195 | $pid = max((int) $pid, 0); |
| 196 | 196 | if (!$pid) { |
| 197 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 197 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 198 | 198 | return ''; |
| 199 | 199 | } |
| 200 | 200 | // Load metadata configuration. |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $suffix = (in_array($indexName, self::$fields['tokenized']) ? 't' : 'u'); |
| 204 | 204 | $suffix .= (in_array($indexName, self::$fields['stored']) ? 's' : 'u'); |
| 205 | 205 | $suffix .= (in_array($indexName, self::$fields['indexed']) ? 'i' : 'u'); |
| 206 | - $indexName .= '_' . $suffix; |
|
| 206 | + $indexName .= '_'.$suffix; |
|
| 207 | 207 | return $indexName; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 321 | 321 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
| 322 | 322 | // verify date formatting |
| 323 | - if(strtotime($metadata['date'][0])) { |
|
| 323 | + if (strtotime($metadata['date'][0])) { |
|
| 324 | 324 | $solrDoc->setField('date', self::getFormattedDate($metadata['date'][0])); |
| 325 | 325 | } |
| 326 | 326 | $solrDoc->setField('record_id', $metadata['record_id'][0]); |
@@ -479,11 +479,11 @@ discard block |
||
| 479 | 479 | $solrDoc->setField(self::getIndexFieldName($indexName, $document->getPid()), $data, self::$fields['fieldboost'][$indexName]); |
| 480 | 480 | if (in_array($indexName, self::$fields['sortables'])) { |
| 481 | 481 | // Add sortable fields to index. |
| 482 | - $solrDoc->setField($indexName . '_sorting', $metadata[$indexName . '_sorting'][0]); |
|
| 482 | + $solrDoc->setField($indexName.'_sorting', $metadata[$indexName.'_sorting'][0]); |
|
| 483 | 483 | } |
| 484 | 484 | if (in_array($indexName, self::$fields['facets'])) { |
| 485 | 485 | // Add facets to index. |
| 486 | - $solrDoc->setField($indexName . '_faceting', $data); |
|
| 486 | + $solrDoc->setField($indexName.'_faceting', $data); |
|
| 487 | 487 | } |
| 488 | 488 | if (in_array($indexName, self::$fields['autocomplete'])) { |
| 489 | 489 | $autocomplete = array_merge($autocomplete, $data); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | $data = self::removeAppendsFromAuthor($data); |
| 520 | 520 | } |
| 521 | 521 | // Add facets to index. |
| 522 | - $solrDoc->setField($indexName . '_faceting', $data); |
|
| 522 | + $solrDoc->setField($indexName.'_faceting', $data); |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | // Add sorting information to physical sub-elements if applicable. |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | { |
| 551 | 551 | $solrDoc = $updateQuery->createDocument(); |
| 552 | 552 | // Create unique identifier from document's UID and unit's XML ID. |
| 553 | - $solrDoc->setField('id', $document->getUid() . $unit['id']); |
|
| 553 | + $solrDoc->setField('id', $document->getUid().$unit['id']); |
|
| 554 | 554 | $solrDoc->setField('uid', $document->getUid()); |
| 555 | 555 | $solrDoc->setField('pid', $document->getPid()); |
| 556 | 556 | $solrDoc->setField('partof', $document->getPartof()); |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | private static function handleException(string $errorMessage): void |
| 630 | 630 | { |
| 631 | 631 | if (!(Environment::isCli())) { |
| 632 | - self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($errorMessage)); |
|
| 632 | + self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($errorMessage)); |
|
| 633 | 633 | } |
| 634 | - Helper::log('Apache Solr threw exception: "' . $errorMessage . '"', LOG_SEVERITY_ERROR); |
|
| 634 | + Helper::log('Apache Solr threw exception: "'.$errorMessage.'"', LOG_SEVERITY_ERROR); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | /** |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @access public |
| 34 | 34 | */ |
| 35 | -class Indexer |
|
| 36 | -{ |
|
| 35 | +class Indexer { |
|
| 37 | 36 | /** |
| 38 | 37 | * @access public |
| 39 | 38 | * @static |
@@ -604,8 +603,7 @@ discard block |
||
| 604 | 603 | * |
| 605 | 604 | * @return array|string |
| 606 | 605 | */ |
| 607 | - private static function removeAppendsFromAuthor($authors) |
|
| 608 | - { |
|
| 606 | + private static function removeAppendsFromAuthor($authors) { |
|
| 609 | 607 | if (is_array($authors)) { |
| 610 | 608 | foreach ($authors as $i => $author) { |
| 611 | 609 | $splitName = explode(pack('C', 31), $author); |
@@ -685,7 +683,6 @@ discard block |
||
| 685 | 683 | * |
| 686 | 684 | * @return void |
| 687 | 685 | */ |
| 688 | - private function __construct() |
|
| 689 | - { |
|
| 686 | + private function __construct() { |
|
| 690 | 687 | } |
| 691 | 688 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @see $fields |
| 67 | 67 | */ |
| 68 | - protected static bool $fieldsLoaded = false; |
|
| 68 | + protected static bool $fieldsLoaded = FALSE; |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @access protected |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | public static function add(Document $document, DocumentRepository $documentRepository): bool |
| 97 | 97 | { |
| 98 | 98 | if (in_array($document->getUid(), self::$processedDocs)) { |
| 99 | - return true; |
|
| 99 | + return TRUE; |
|
| 100 | 100 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
| 101 | - $success = true; |
|
| 101 | + $success = TRUE; |
|
| 102 | 102 | Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
| 103 | 103 | // Handle multi-volume documents. |
| 104 | 104 | $parentId = $document->getPartof(); |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | $parent = $documentRepository->findByUid($parentId); |
| 108 | 108 | if ($parent) { |
| 109 | 109 | // get XML document of parent |
| 110 | - $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true); |
|
| 111 | - if ($doc !== null) { |
|
| 110 | + $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE); |
|
| 111 | + if ($doc !== NULL) { |
|
| 112 | 112 | $parent->setCurrentDocument($doc); |
| 113 | 113 | $success = self::add($parent, $documentRepository); |
| 114 | 114 | } else { |
| 115 | 115 | Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR); |
| 116 | - return false; |
|
| 116 | + return FALSE; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return $success; |
| 163 | 163 | } catch (\Exception $e) { |
| 164 | 164 | self::handleException($e->getMessage()); |
| 165 | - return false; |
|
| 165 | + return FALSE; |
|
| 166 | 166 | } |
| 167 | 167 | } else { |
| 168 | 168 | if (!(Environment::isCli())) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | ); |
| 174 | 174 | } |
| 175 | 175 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
| 176 | - return false; |
|
| 176 | + return FALSE; |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | if ($indexing['index_boost'] > 0.0) { |
| 273 | 273 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
| 274 | 274 | } else { |
| 275 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
| 275 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | - self::$fieldsLoaded = true; |
|
| 278 | + self::$fieldsLoaded = TRUE; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | protected static function processLogical(Document $document, array $logicalUnit): bool |
| 295 | 295 | { |
| 296 | - $success = true; |
|
| 296 | + $success = TRUE; |
|
| 297 | 297 | $doc = $document->getCurrentDocument(); |
| 298 | 298 | $doc->cPid = $document->getPid(); |
| 299 | 299 | // Get metadata for logical unit. |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
| 317 | 317 | } |
| 318 | 318 | // There can be only one toplevel unit per UID, independently of backend configuration |
| 319 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
| 319 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
| 320 | 320 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 321 | 321 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
| 322 | 322 | // verify date formatting |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | self::$solr->service->update($updateQuery); |
| 353 | 353 | } catch (\Exception $e) { |
| 354 | 354 | self::handleException($e->getMessage()); |
| 355 | - return false; |
|
| 355 | + return FALSE; |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | // Check for child elements... |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | break; |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | - $solrDoc->setField('toplevel', false); |
|
| 403 | + $solrDoc->setField('toplevel', FALSE); |
|
| 404 | 404 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
| 405 | 405 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
| 406 | 406 | $solrDoc->setField('location', $document->getLocation()); |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | self::$solr->service->update($updateQuery); |
| 422 | 422 | } catch (\Exception $e) { |
| 423 | 423 | self::handleException($e->getMessage()); |
| 424 | - return false; |
|
| 424 | + return FALSE; |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | - return true; |
|
| 427 | + return TRUE; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | if ($pid) { |
| 451 | 451 | self::loadIndexConf($pid); |
| 452 | 452 | } |
| 453 | - return true; |
|
| 453 | + return TRUE; |
|
| 454 | 454 | } |
| 455 | - return false; |
|
| 455 | + return FALSE; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | $message, |
| 674 | 674 | Helper::getLanguageService()->getLL($type), |
| 675 | 675 | $status, |
| 676 | - true, |
|
| 676 | + TRUE, |
|
| 677 | 677 | 'core.template.flashMessages' |
| 678 | 678 | ); |
| 679 | 679 | } |
@@ -664,14 +664,14 @@ discard block |
||
| 664 | 664 | if ($fileContent !== false) { |
| 665 | 665 | $textFormat = $this->getTextFormat($fileContent); |
| 666 | 666 | } else { |
| 667 | - $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
|
| 667 | + $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"'); |
|
| 668 | 668 | return $fullText; |
| 669 | 669 | } |
| 670 | 670 | break; |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | } else { |
| 674 | - $this->logger->warning('Invalid structure node @ID "' . $id . '"'); |
|
| 674 | + $this->logger->warning('Invalid structure node @ID "'.$id.'"'); |
|
| 675 | 675 | return $fullText; |
| 676 | 676 | } |
| 677 | 677 | // Is this text format supported? |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } |
| 684 | 684 | $fullText = $textMiniOcr; |
| 685 | 685 | } else { |
| 686 | - $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"'); |
|
| 686 | + $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"'); |
|
| 687 | 687 | } |
| 688 | 688 | return $fullText; |
| 689 | 689 | } |
@@ -712,10 +712,10 @@ discard block |
||
| 712 | 712 | $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml); |
| 713 | 713 | $this->rawTextArray[$id] = $textMiniOcr; |
| 714 | 714 | } else { |
| 715 | - $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"'); |
|
| 715 | + $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"'); |
|
| 716 | 716 | } |
| 717 | 717 | } else { |
| 718 | - $this->logger->warning('Class "' . $class . ' does not exists for "' . $textFormat . ' text format"'); |
|
| 718 | + $this->logger->warning('Class "'.$class.' does not exists for "'.$textFormat.' text format"'); |
|
| 719 | 719 | } |
| 720 | 720 | return $textMiniOcr; |
| 721 | 721 | } |
@@ -790,10 +790,10 @@ discard block |
||
| 790 | 790 | $title = self::getTitle($partof, true); |
| 791 | 791 | } |
| 792 | 792 | } else { |
| 793 | - Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 793 | + Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 794 | 794 | } |
| 795 | 795 | } else { |
| 796 | - Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR); |
|
| 796 | + Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR); |
|
| 797 | 797 | } |
| 798 | 798 | return $title; |
| 799 | 799 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | // the actual loading is format specific |
| 884 | 884 | return $this->loadLocation($location); |
| 885 | 885 | } else { |
| 886 | - $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
|
| 886 | + $this->logger->error('Invalid file location "'.$location.'" for document loading'); |
|
| 887 | 887 | } |
| 888 | 888 | return false; |
| 889 | 889 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // Set metadata definitions' PID. |
| 1036 | 1036 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1037 | 1037 | if (!$cPid) { |
| 1038 | - $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
| 1038 | + $this->logger->error('Invalid PID '.$cPid.' for metadata definitions'); |
|
| 1039 | 1039 | return []; |
| 1040 | 1040 | } |
| 1041 | 1041 | if ( |
@@ -1212,12 +1212,12 @@ discard block |
||
| 1212 | 1212 | */ |
| 1213 | 1213 | public function __get(string $var) |
| 1214 | 1214 | { |
| 1215 | - $method = 'magicGet' . ucfirst($var); |
|
| 1215 | + $method = 'magicGet'.ucfirst($var); |
|
| 1216 | 1216 | if ( |
| 1217 | 1217 | !property_exists($this, $var) |
| 1218 | 1218 | || !method_exists($this, $method) |
| 1219 | 1219 | ) { |
| 1220 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 1220 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 1221 | 1221 | return null; |
| 1222 | 1222 | } else { |
| 1223 | 1223 | return $this->$method(); |
@@ -1250,12 +1250,12 @@ discard block |
||
| 1250 | 1250 | */ |
| 1251 | 1251 | public function __set(string $var, $value): void |
| 1252 | 1252 | { |
| 1253 | - $method = '_set' . ucfirst($var); |
|
| 1253 | + $method = '_set'.ucfirst($var); |
|
| 1254 | 1254 | if ( |
| 1255 | 1255 | !property_exists($this, $var) |
| 1256 | 1256 | || !method_exists($this, $method) |
| 1257 | 1257 | ) { |
| 1258 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 1258 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 1259 | 1259 | } else { |
| 1260 | 1260 | $this->$method($value); |
| 1261 | 1261 | } |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * @property-read string $toplevelId this holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF) |
| 58 | 58 | * @property \SimpleXMLElement $xml this holds the whole XML file as \SimpleXMLElement object |
| 59 | 59 | */ |
| 60 | -abstract class AbstractDocument |
|
| 61 | -{ |
|
| 60 | +abstract class AbstractDocument { |
|
| 62 | 61 | /** |
| 63 | 62 | * @access protected |
| 64 | 63 | * @var Logger This holds the logger |
@@ -838,8 +837,7 @@ discard block |
||
| 838 | 837 | * @return int|bool false if structure with $logId is not a child of this substructure, |
| 839 | 838 | * or the actual depth. |
| 840 | 839 | */ |
| 841 | - protected function getTreeDepth(array $structure, int $depth, string $logId) |
|
| 842 | - { |
|
| 840 | + protected function getTreeDepth(array $structure, int $depth, string $logId) { |
|
| 843 | 841 | foreach ($structure as $element) { |
| 844 | 842 | if ($element['id'] == $logId) { |
| 845 | 843 | return $depth; |
@@ -862,8 +860,7 @@ discard block |
||
| 862 | 860 | * |
| 863 | 861 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
| 864 | 862 | */ |
| 865 | - public function getStructureDepth(string $logId) |
|
| 866 | - { |
|
| 863 | + public function getStructureDepth(string $logId) { |
|
| 867 | 864 | return $this->getTreeDepth($this->magicGetTableOfContents(), 1, $logId); |
| 868 | 865 | } |
| 869 | 866 | |
@@ -1122,8 +1119,7 @@ discard block |
||
| 1122 | 1119 | * |
| 1123 | 1120 | * @return mixed The METS file's / IIIF manifest's record identifier |
| 1124 | 1121 | */ |
| 1125 | - protected function magicGetRecordId() |
|
| 1126 | - { |
|
| 1122 | + protected function magicGetRecordId() { |
|
| 1127 | 1123 | return $this->recordId; |
| 1128 | 1124 | } |
| 1129 | 1125 | |
@@ -1193,8 +1189,7 @@ discard block |
||
| 1193 | 1189 | * |
| 1194 | 1190 | * @return void |
| 1195 | 1191 | */ |
| 1196 | - protected function __construct(int $pid, string $location, $preloadedDocument, array $settings = []) |
|
| 1197 | - { |
|
| 1192 | + protected function __construct(int $pid, string $location, $preloadedDocument, array $settings = []) { |
|
| 1198 | 1193 | $this->pid = $pid; |
| 1199 | 1194 | $this->setPreloadedDocument($preloadedDocument); |
| 1200 | 1195 | $this->init($location, $settings); |
@@ -1210,8 +1205,7 @@ discard block |
||
| 1210 | 1205 | * |
| 1211 | 1206 | * @return mixed Value of $this->$var |
| 1212 | 1207 | */ |
| 1213 | - public function __get(string $var) |
|
| 1214 | - { |
|
| 1208 | + public function __get(string $var) { |
|
| 1215 | 1209 | $method = 'magicGet' . ucfirst($var); |
| 1216 | 1210 | if ( |
| 1217 | 1211 | !property_exists($this, $var) |
@@ -1272,8 +1266,7 @@ discard block |
||
| 1272 | 1266 | * |
| 1273 | 1267 | * @return AbstractDocument|false |
| 1274 | 1268 | */ |
| 1275 | - private static function getDocumentCache(string $location) |
|
| 1276 | - { |
|
| 1269 | + private static function getDocumentCache(string $location) { |
|
| 1277 | 1270 | $cacheIdentifier = hash('md5', $location); |
| 1278 | 1271 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
| 1279 | 1272 | $cacheHit = $cache->get($cacheIdentifier); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @see $formats |
| 113 | 113 | */ |
| 114 | - protected bool $formatsLoaded = false; |
|
| 114 | + protected bool $formatsLoaded = FALSE; |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | * @access protected |
| 122 | 122 | * @var bool |
| 123 | 123 | */ |
| 124 | - protected bool $hasFulltext = false; |
|
| 124 | + protected bool $hasFulltext = FALSE; |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @access protected |
| 128 | 128 | * @var array Last searched logical and physical page |
| 129 | 129 | */ |
| 130 | - protected array $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
| 130 | + protected array $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * @access protected |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @see $metadataArray |
| 152 | 152 | */ |
| 153 | - protected bool $metadataArrayLoaded = false; |
|
| 153 | + protected bool $metadataArrayLoaded = FALSE; |
|
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * @access protected |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @see $physicalStructure |
| 184 | 184 | */ |
| 185 | - protected bool $physicalStructureLoaded = false; |
|
| 185 | + protected bool $physicalStructureLoaded = FALSE; |
|
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | 188 | * @access protected |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @access protected |
| 204 | 204 | * @var bool Is the document instantiated successfully? |
| 205 | 205 | */ |
| 206 | - protected bool $ready = false; |
|
| 206 | + protected bool $ready = FALSE; |
|
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * @access protected |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @see $rootId |
| 225 | 225 | */ |
| 226 | - protected bool $rootIdLoaded = false; |
|
| 226 | + protected bool $rootIdLoaded = FALSE; |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * @access protected |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @see $smLinks |
| 239 | 239 | */ |
| 240 | - protected bool $smLinksLoaded = false; |
|
| 240 | + protected bool $smLinksLoaded = FALSE; |
|
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | 243 | * This holds the logical structure |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @see $tableOfContents |
| 255 | 255 | */ |
| 256 | - protected bool $tableOfContentsLoaded = false; |
|
| 256 | + protected bool $tableOfContentsLoaded = FALSE; |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * @access protected |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @see $thumbnail |
| 269 | 269 | */ |
| 270 | - protected bool $thumbnailLoaded = false; |
|
| 270 | + protected bool $thumbnailLoaded = FALSE; |
|
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * @access protected |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | * |
| 362 | 362 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 363 | 363 | */ |
| 364 | - abstract public function getLogicalStructure(string $id, bool $recursive = false): array; |
|
| 364 | + abstract public function getLogicalStructure(string $id, bool $recursive = FALSE): array; |
|
| 365 | 365 | |
| 366 | 366 | /** |
| 367 | 367 | * This extracts all the metadata for a logical structure node |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * |
| 450 | 450 | * @return string The document's thumbnail location |
| 451 | 451 | */ |
| 452 | - abstract protected function magicGetThumbnail(bool $forceReload = false): string; |
|
| 452 | + abstract protected function magicGetThumbnail(bool $forceReload = FALSE): string; |
|
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | 455 | * This returns the ID of the toplevel logical structure node |
@@ -528,21 +528,21 @@ discard block |
||
| 528 | 528 | * |
| 529 | 529 | * @return AbstractDocument|null Instance of this class, either MetsDocument or IiifManifest |
| 530 | 530 | */ |
| 531 | - public static function &getInstance(string $location, array $settings = [], bool $forceReload = false) |
|
| 531 | + public static function &getInstance(string $location, array $settings = [], bool $forceReload = FALSE) |
|
| 532 | 532 | { |
| 533 | 533 | // Create new instance depending on format (METS or IIIF) ... |
| 534 | - $documentFormat = null; |
|
| 535 | - $xml = null; |
|
| 536 | - $iiif = null; |
|
| 534 | + $documentFormat = NULL; |
|
| 535 | + $xml = NULL; |
|
| 536 | + $iiif = NULL; |
|
| 537 | 537 | |
| 538 | 538 | if (!$forceReload) { |
| 539 | 539 | $instance = self::getDocumentCache($location); |
| 540 | - if ($instance !== false) { |
|
| 540 | + if ($instance !== FALSE) { |
|
| 541 | 541 | return $instance; |
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - $instance = null; |
|
| 545 | + $instance = NULL; |
|
| 546 | 546 | |
| 547 | 547 | // Try to load a file from the url |
| 548 | 548 | if (GeneralUtility::isValidUrl($location)) { |
@@ -550,17 +550,17 @@ discard block |
||
| 550 | 550 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 551 | 551 | |
| 552 | 552 | $content = Helper::getUrl($location); |
| 553 | - if ($content !== false) { |
|
| 553 | + if ($content !== FALSE) { |
|
| 554 | 554 | $xml = Helper::getXmlFileAsString($content); |
| 555 | - if ($xml !== false) { |
|
| 555 | + if ($xml !== FALSE) { |
|
| 556 | 556 | /* @var $xml \SimpleXMLElement */ |
| 557 | 557 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 558 | 558 | $xpathResult = $xml->xpath('//mets:mets'); |
| 559 | - $documentFormat = !empty($xpathResult) ? 'METS' : null; |
|
| 559 | + $documentFormat = !empty($xpathResult) ? 'METS' : NULL; |
|
| 560 | 560 | } else { |
| 561 | 561 | // Try to load file as IIIF resource instead. |
| 562 | - $contentAsJsonArray = json_decode($content, true); |
|
| 563 | - if ($contentAsJsonArray !== null) { |
|
| 562 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
| 563 | + if ($contentAsJsonArray !== NULL) { |
|
| 564 | 564 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 565 | 565 | IiifHelper::setMaxThumbnailHeight($extConf['iiifThumbnailHeight']); |
| 566 | 566 | IiifHelper::setMaxThumbnailWidth($extConf['iiifThumbnailWidth']); |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $instance = new IiifManifest($pid, $location, $iiif); |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - if ($instance !== null) { |
|
| 586 | + if ($instance !== NULL) { |
|
| 587 | 587 | self::setDocumentCache($location, $instance); |
| 588 | 588 | } |
| 589 | 589 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | } else { |
| 625 | 625 | $physicalPage = 0; |
| 626 | 626 | foreach ($this->physicalStructureInfo as $page) { |
| 627 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
| 627 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
| 628 | 628 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
| 629 | 629 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
| 630 | 630 | return $physicalPage; |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
| 662 | 662 | // Get full text file. |
| 663 | 663 | $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
| 664 | - if ($fileContent !== false) { |
|
| 664 | + if ($fileContent !== FALSE) { |
|
| 665 | 665 | $textFormat = $this->getTextFormat($fileContent); |
| 666 | 666 | } else { |
| 667 | 667 | $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | { |
| 734 | 734 | $xml = Helper::getXmlFileAsString($fileContent); |
| 735 | 735 | |
| 736 | - if ($xml !== false) { |
|
| 736 | + if ($xml !== FALSE) { |
|
| 737 | 737 | // Get the root element's name as text format. |
| 738 | 738 | return strtoupper($xml->getName()); |
| 739 | 739 | } else { |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @return string The title of the document itself or a parent document |
| 755 | 755 | */ |
| 756 | - public static function getTitle(int $uid, bool $recursive = false): string |
|
| 756 | + public static function getTitle(int $uid, bool $recursive = FALSE): string |
|
| 757 | 757 | { |
| 758 | 758 | $title = ''; |
| 759 | 759 | // Sanitize input. |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | && (int) $partof |
| 788 | 788 | && $partof != $uid |
| 789 | 789 | ) { |
| 790 | - $title = self::getTitle($partof, true); |
|
| 790 | + $title = self::getTitle($partof, TRUE); |
|
| 791 | 791 | } |
| 792 | 792 | } else { |
| 793 | 793 | Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
@@ -845,12 +845,12 @@ discard block |
||
| 845 | 845 | return $depth; |
| 846 | 846 | } elseif (array_key_exists('children', $element)) { |
| 847 | 847 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 848 | - if ($foundInChildren !== false) { |
|
| 848 | + if ($foundInChildren !== FALSE) { |
|
| 849 | 849 | return $foundInChildren; |
| 850 | 850 | } |
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | - return false; |
|
| 853 | + return FALSE; |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | } else { |
| 886 | 886 | $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
| 887 | 887 | } |
| 888 | - return false; |
|
| 888 | + return FALSE; |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | 'class' => $resArray['class'] |
| 924 | 924 | ]; |
| 925 | 925 | } |
| 926 | - $this->formatsLoaded = true; |
|
| 926 | + $this->formatsLoaded = TRUE; |
|
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | ) { |
| 1045 | 1045 | $this->prepareMetadataArray($cPid); |
| 1046 | 1046 | $this->metadataArray[0] = $cPid; |
| 1047 | - $this->metadataArrayLoaded = true; |
|
| 1047 | + $this->metadataArrayLoaded = TRUE; |
|
| 1048 | 1048 | } |
| 1049 | 1049 | return $this->metadataArray; |
| 1050 | 1050 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]); |
| 1144 | 1144 | $this->rootId = $parent->rootId; |
| 1145 | 1145 | } |
| 1146 | - $this->rootIdLoaded = true; |
|
| 1146 | + $this->rootIdLoaded = TRUE; |
|
| 1147 | 1147 | } |
| 1148 | 1148 | return $this->rootId; |
| 1149 | 1149 | } |
@@ -1160,8 +1160,8 @@ discard block |
||
| 1160 | 1160 | // Is there no logical structure array yet? |
| 1161 | 1161 | if (!$this->tableOfContentsLoaded) { |
| 1162 | 1162 | // Get all logical structures. |
| 1163 | - $this->getLogicalStructure('', true); |
|
| 1164 | - $this->tableOfContentsLoaded = true; |
|
| 1163 | + $this->getLogicalStructure('', TRUE); |
|
| 1164 | + $this->tableOfContentsLoaded = TRUE; |
|
| 1165 | 1165 | } |
| 1166 | 1166 | return $this->tableOfContents; |
| 1167 | 1167 | } |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | || !method_exists($this, $method) |
| 1219 | 1219 | ) { |
| 1220 | 1220 | $this->logger->warning('There is no getter function for property "' . $var . '"'); |
| 1221 | - return null; |
|
| 1221 | + return NULL; |
|
| 1222 | 1222 | } else { |
| 1223 | 1223 | return $this->$method(); |
| 1224 | 1224 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } elseif ($checksum == 10) { |
| 147 | 147 | //TODO: Binary operation "+" between string and 1 results in an error. |
| 148 | 148 | // @phpstan-ignore-next-line |
| 149 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
| 149 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
| 150 | 150 | } elseif (substr($id, -1, 1) != $checksum) { |
| 151 | 151 | return false; |
| 152 | 152 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 346 | 346 | // Merge initialization vector and encrypted data. |
| 347 | 347 | if ($encrypted !== false) { |
| 348 | - $encrypted = base64_encode($iv . $encrypted); |
|
| 348 | + $encrypted = base64_encode($iv.$encrypted); |
|
| 349 | 349 | } |
| 350 | 350 | return $encrypted; |
| 351 | 351 | } |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | public static function getHookObjects(string $scriptRelPath): array |
| 405 | 405 | { |
| 406 | 406 | $hookObjects = []; |
| 407 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
| 408 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
| 407 | + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
| 408 | + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
| 409 | 409 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | // NOTE: Only use tables that don't have too many entries! |
| 435 | 435 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
| 436 | 436 | ) { |
| 437 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
| 437 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
| 438 | 438 | return ''; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - $makeCacheKey = function ($pid, $uid) { |
|
| 442 | - return $pid . '.' . $uid; |
|
| 441 | + $makeCacheKey = function($pid, $uid) { |
|
| 442 | + return $pid.'.'.$uid; |
|
| 443 | 443 | }; |
| 444 | 444 | |
| 445 | 445 | static $cache = []; |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $result = $queryBuilder |
| 451 | 451 | ->select( |
| 452 | - $table . '.index_name AS index_name', |
|
| 453 | - $table . '.uid AS uid', |
|
| 454 | - $table . '.pid AS pid', |
|
| 452 | + $table.'.index_name AS index_name', |
|
| 453 | + $table.'.uid AS uid', |
|
| 454 | + $table.'.pid AS pid', |
|
| 455 | 455 | ) |
| 456 | 456 | ->from($table) |
| 457 | 457 | ->execute(); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $result = $cache[$table][$cacheKey] ?? ''; |
| 470 | 470 | |
| 471 | 471 | if ($result === '') { |
| 472 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 472 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | return $result; |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | // No ISO code, return unchanged. |
| 499 | 499 | return $code; |
| 500 | 500 | } |
| 501 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
| 501 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
| 502 | 502 | if (!empty($lang)) { |
| 503 | 503 | return $lang; |
| 504 | 504 | } else { |
| 505 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 505 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
| 506 | 506 | return $code; |
| 507 | 507 | } |
| 508 | 508 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | '-' => 39, |
| 604 | 604 | ':' => 17, |
| 605 | 605 | ]; |
| 606 | - $urn = strtolower($base . $id); |
|
| 606 | + $urn = strtolower($base.$id); |
|
| 607 | 607 | if (preg_match('/[^a-z\d:-]/', $urn)) { |
| 608 | 608 | self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING); |
| 609 | 609 | return ''; |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $checksum += ($i + 1) * (int) substr($digits, $i, 1); |
| 618 | 618 | } |
| 619 | 619 | $checksum = substr((string) floor($checksum / (int) substr($digits, -1, 1)), -1, 1); |
| 620 | - return $base . $id . $checksum; |
|
| 620 | + return $base.$id.$checksum; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | // Sanitize input. |
| 725 | 725 | $pid = max((int) $pid, 0); |
| 726 | 726 | if (!$pid) { |
| 727 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
| 727 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
| 728 | 728 | return $indexName; |
| 729 | 729 | } |
| 730 | 730 | /** @var PageRepository $pageRepository */ |
@@ -747,13 +747,13 @@ discard block |
||
| 747 | 747 | // First fetch the uid of the received index_name |
| 748 | 748 | $result = $queryBuilder |
| 749 | 749 | ->select( |
| 750 | - $table . '.uid AS uid', |
|
| 751 | - $table . '.l18n_parent AS l18n_parent' |
|
| 750 | + $table.'.uid AS uid', |
|
| 751 | + $table.'.l18n_parent AS l18n_parent' |
|
| 752 | 752 | ) |
| 753 | 753 | ->from($table) |
| 754 | 754 | ->where( |
| 755 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 756 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 755 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 756 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($indexName)), |
|
| 757 | 757 | self::whereExpression($table, true) |
| 758 | 758 | ) |
| 759 | 759 | ->setMaxResults(1) |
@@ -764,12 +764,12 @@ discard block |
||
| 764 | 764 | if ($row) { |
| 765 | 765 | // Now we use the uid of the l18_parent to fetch the index_name of the translated content element. |
| 766 | 766 | $result = $queryBuilder |
| 767 | - ->select($table . '.index_name AS index_name') |
|
| 767 | + ->select($table.'.index_name AS index_name') |
|
| 768 | 768 | ->from($table) |
| 769 | 769 | ->where( |
| 770 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 771 | - $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
|
| 772 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
|
| 770 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 771 | + $queryBuilder->expr()->eq($table.'.uid', $row['l18n_parent']), |
|
| 772 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId), |
|
| 773 | 773 | self::whereExpression($table, true) |
| 774 | 774 | ) |
| 775 | 775 | ->setMaxResults(1) |
@@ -787,14 +787,14 @@ discard block |
||
| 787 | 787 | if (empty($labels[$table][$pid][$languageContentId][$indexName])) { |
| 788 | 788 | // Check if this table is allowed for translation. |
| 789 | 789 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) { |
| 790 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
| 790 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
| 791 | 791 | if ($languageContentId > 0) { |
| 792 | 792 | $additionalWhere = $queryBuilder->expr()->andX( |
| 793 | 793 | $queryBuilder->expr()->orX( |
| 794 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
| 795 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) |
|
| 794 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
| 795 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId) |
|
| 796 | 796 | ), |
| 797 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
| 797 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
| 798 | 798 | ); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | ->select('*') |
| 804 | 804 | ->from($table) |
| 805 | 805 | ->where( |
| 806 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
| 806 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
| 807 | 807 | $additionalWhere, |
| 808 | 808 | self::whereExpression($table, true) |
| 809 | 809 | ) |
@@ -821,10 +821,10 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | } else { |
| 824 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 824 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
| 825 | 825 | } |
| 826 | 826 | } else { |
| 827 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
| 827 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | return GeneralUtility::makeInstance(ConnectionPool::class) |
| 871 | 871 | ->getQueryBuilderForTable($table) |
| 872 | 872 | ->expr() |
| 873 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 873 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
| 874 | 874 | } else { |
| 875 | 875 | self::log('Unexpected TYPO3_MODE', LOG_SEVERITY_ERROR); |
| 876 | 876 | return '1=-1'; |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | try { |
| 937 | 937 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 938 | 938 | } catch (\Exception $e) { |
| 939 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
| 939 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
| 940 | 940 | return false; |
| 941 | 941 | } |
| 942 | 942 | return $response->getBody()->getContents(); |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @access public |
| 39 | 39 | */ |
| 40 | -class Helper |
|
| 41 | -{ |
|
| 40 | +class Helper { |
|
| 42 | 41 | /** |
| 43 | 42 | * @access public |
| 44 | 43 | * @static |
@@ -198,8 +197,7 @@ discard block |
||
| 198 | 197 | * |
| 199 | 198 | * @return mixed The decrypted value or false on error |
| 200 | 199 | */ |
| 201 | - public static function decrypt(string $encrypted) |
|
| 202 | - { |
|
| 200 | + public static function decrypt(string $encrypted) { |
|
| 203 | 201 | if ( |
| 204 | 202 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 205 | 203 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -239,8 +237,7 @@ discard block |
||
| 239 | 237 | * |
| 240 | 238 | * @return \SimpleXMLElement|false |
| 241 | 239 | */ |
| 242 | - public static function getXmlFileAsString($content) |
|
| 243 | - { |
|
| 240 | + public static function getXmlFileAsString($content) { |
|
| 244 | 241 | // Don't make simplexml_load_string throw (when $content is an array |
| 245 | 242 | // or object) |
| 246 | 243 | if (!is_string($content)) { |
@@ -305,8 +302,7 @@ discard block |
||
| 305 | 302 | * |
| 306 | 303 | * @return mixed Hashed string or false on error |
| 307 | 304 | */ |
| 308 | - public static function digest(string $string) |
|
| 309 | - { |
|
| 305 | + public static function digest(string $string) { |
|
| 310 | 306 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 311 | 307 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 312 | 308 | return false; |
@@ -326,8 +322,7 @@ discard block |
||
| 326 | 322 | * |
| 327 | 323 | * @return mixed Encrypted string or false on error |
| 328 | 324 | */ |
| 329 | - public static function encrypt(string $string) |
|
| 330 | - { |
|
| 325 | + public static function encrypt(string $string) { |
|
| 331 | 326 | if ( |
| 332 | 327 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 333 | 328 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -697,8 +692,7 @@ discard block |
||
| 697 | 692 | * |
| 698 | 693 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 699 | 694 | */ |
| 700 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 701 | - { |
|
| 695 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 702 | 696 | $context = GeneralUtility::makeInstance(Context::class); |
| 703 | 697 | |
| 704 | 698 | if ( |
@@ -937,8 +931,7 @@ discard block |
||
| 937 | 931 | * |
| 938 | 932 | * @return void |
| 939 | 933 | */ |
| 940 | - private function __construct() |
|
| 941 | - { |
|
| 934 | + private function __construct() { |
|
| 942 | 935 | // This is a static class, thus no instances should be created. |
| 943 | 936 | } |
| 944 | 937 | |
@@ -969,8 +962,7 @@ discard block |
||
| 969 | 962 | * |
| 970 | 963 | * @return string|bool |
| 971 | 964 | */ |
| 972 | - public static function getUrl(string $url) |
|
| 973 | - { |
|
| 965 | + public static function getUrl(string $url) { |
|
| 974 | 966 | if (!Helper::isValidHttpUrl($url)) { |
| 975 | 967 | return false; |
| 976 | 968 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return FlashMessageQueue The queue the message was added to |
| 88 | 88 | */ |
| 89 | - public static function addMessage(string $message, string $title, int $severity, bool $session = false, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
| 89 | + public static function addMessage(string $message, string $title, int $severity, bool $session = FALSE, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
| 90 | 90 | { |
| 91 | 91 | $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); |
| 92 | 92 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | $checksum = 'X'; |
| 126 | 126 | } |
| 127 | 127 | if (!preg_match('/\d{8}[\dX]{1}/i', $id)) { |
| 128 | - return false; |
|
| 128 | + return FALSE; |
|
| 129 | 129 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 130 | - return false; |
|
| 130 | + return FALSE; |
|
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | case 'ZDB': |
@@ -135,21 +135,21 @@ discard block |
||
| 135 | 135 | $checksum = 'X'; |
| 136 | 136 | } |
| 137 | 137 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
| 138 | - return false; |
|
| 138 | + return FALSE; |
|
| 139 | 139 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 140 | - return false; |
|
| 140 | + return FALSE; |
|
| 141 | 141 | } |
| 142 | 142 | break; |
| 143 | 143 | case 'SWD': |
| 144 | 144 | $checksum = 11 - $checksum; |
| 145 | 145 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
| 146 | - return false; |
|
| 146 | + return FALSE; |
|
| 147 | 147 | } elseif ($checksum == 10) { |
| 148 | 148 | //TODO: Binary operation "+" between string and 1 results in an error. |
| 149 | 149 | // @phpstan-ignore-next-line |
| 150 | 150 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
| 151 | 151 | } elseif (substr($id, -1, 1) != $checksum) { |
| 152 | - return false; |
|
| 152 | + return FALSE; |
|
| 153 | 153 | } |
| 154 | 154 | break; |
| 155 | 155 | case 'GKD': |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | $checksum = 'X'; |
| 159 | 159 | } |
| 160 | 160 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
| 161 | - return false; |
|
| 161 | + return FALSE; |
|
| 162 | 162 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
| 163 | - return false; |
|
| 163 | + return FALSE; |
|
| 164 | 164 | } |
| 165 | 165 | break; |
| 166 | 166 | } |
| 167 | - return true; |
|
| 167 | + return TRUE; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -201,28 +201,28 @@ discard block |
||
| 201 | 201 | public static function decrypt(string $encrypted) |
| 202 | 202 | { |
| 203 | 203 | if ( |
| 204 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 205 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 204 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 205 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 206 | 206 | ) { |
| 207 | 207 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 208 | - return false; |
|
| 208 | + return FALSE; |
|
| 209 | 209 | } |
| 210 | 210 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 211 | 211 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 212 | - return false; |
|
| 212 | + return FALSE; |
|
| 213 | 213 | } |
| 214 | 214 | if ( |
| 215 | 215 | empty($encrypted) |
| 216 | 216 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
| 217 | 217 | ) { |
| 218 | 218 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
| 219 | - return false; |
|
| 219 | + return FALSE; |
|
| 220 | 220 | } |
| 221 | 221 | // Split initialisation vector and encrypted data. |
| 222 | 222 | $binary = base64_decode($encrypted); |
| 223 | 223 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 224 | 224 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 225 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 225 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 226 | 226 | // Decrypt data. |
| 227 | 227 | return openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 228 | 228 | } |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | // Don't make simplexml_load_string throw (when $content is an array |
| 245 | 245 | // or object) |
| 246 | 246 | if (!is_string($content)) { |
| 247 | - return false; |
|
| 247 | + return FALSE; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // Turn off libxml's error logging. |
| 251 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
| 251 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
| 252 | 252 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
| 253 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
| 253 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
| 254 | 254 | // Try to load XML from file. |
| 255 | 255 | $xml = simplexml_load_string($content); |
| 256 | 256 | // reset entity loader setting |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public static function digest(string $string) |
| 309 | 309 | { |
| 310 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
| 310 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
| 311 | 311 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 312 | - return false; |
|
| 312 | + return FALSE; |
|
| 313 | 313 | } |
| 314 | 314 | // Hash string. |
| 315 | 315 | return openssl_digest($string, self::$hashAlgorithm); |
@@ -329,23 +329,23 @@ discard block |
||
| 329 | 329 | public static function encrypt(string $string) |
| 330 | 330 | { |
| 331 | 331 | if ( |
| 332 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
| 333 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
| 332 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
| 333 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
| 334 | 334 | ) { |
| 335 | 335 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
| 336 | - return false; |
|
| 336 | + return FALSE; |
|
| 337 | 337 | } |
| 338 | 338 | if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) { |
| 339 | 339 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
| 340 | - return false; |
|
| 340 | + return FALSE; |
|
| 341 | 341 | } |
| 342 | 342 | // Generate random initialization vector. |
| 343 | 343 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
| 344 | - $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true); |
|
| 344 | + $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE); |
|
| 345 | 345 | // Encrypt data. |
| 346 | 346 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
| 347 | 347 | // Merge initialization vector and encrypted data. |
| 348 | - if ($encrypted !== false) { |
|
| 348 | + if ($encrypted !== FALSE) { |
|
| 349 | 349 | $encrypted = base64_encode($iv . $encrypted); |
| 350 | 350 | } |
| 351 | 351 | return $encrypted; |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | public static function isValidHttpUrl(string $url): bool |
| 652 | 652 | { |
| 653 | 653 | if (!GeneralUtility::isValidUrl($url)) { |
| 654 | - return false; |
|
| 654 | + return FALSE; |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | try { |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | return !empty($uri->getScheme()); |
| 660 | 660 | } catch (\InvalidArgumentException $e) { |
| 661 | 661 | self::log($e->getMessage(), LOG_SEVERITY_ERROR); |
| 662 | - return false; |
|
| 662 | + return FALSE; |
|
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * |
| 680 | 680 | * @return array Merged array |
| 681 | 681 | */ |
| 682 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, bool $addKeys = true, bool $includeEmptyValues = true, bool $enableUnsetFeature = true): array |
|
| 682 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, bool $addKeys = TRUE, bool $includeEmptyValues = TRUE, bool $enableUnsetFeature = TRUE): array |
|
| 683 | 683 | { |
| 684 | 684 | ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 685 | 685 | return $original; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | * |
| 698 | 698 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 699 | 699 | */ |
| 700 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 700 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
| 701 | 701 | { |
| 702 | 702 | $context = GeneralUtility::makeInstance(Context::class); |
| 703 | 703 | |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | // Instantiate TYPO3 core engine. |
| 709 | 709 | $dataHandler = GeneralUtility::makeInstance(DataHandler::class); |
| 710 | 710 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
| 711 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
| 711 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
| 712 | 712 | // Load data and command arrays. |
| 713 | 713 | $dataHandler->start($data, $cmd); |
| 714 | 714 | // Process command map first if default order is reversed. |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | ->where( |
| 808 | 808 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 809 | 809 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
| 810 | - self::whereExpression($table, true) |
|
| 810 | + self::whereExpression($table, TRUE) |
|
| 811 | 811 | ) |
| 812 | 812 | ->setMaxResults(1) |
| 813 | 813 | ->execute(); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 824 | 824 | $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
| 825 | 825 | $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
| 826 | - self::whereExpression($table, true) |
|
| 826 | + self::whereExpression($table, TRUE) |
|
| 827 | 827 | ) |
| 828 | 828 | ->setMaxResults(1) |
| 829 | 829 | ->execute(); |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | ->where( |
| 859 | 859 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
| 860 | 860 | $additionalWhere, |
| 861 | - self::whereExpression($table, true) |
|
| 861 | + self::whereExpression($table, TRUE) |
|
| 862 | 862 | ) |
| 863 | 863 | ->setMaxResults(10000) |
| 864 | 864 | ->execute(); |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | * |
| 901 | 901 | * @return string Additional WHERE expression |
| 902 | 902 | */ |
| 903 | - public static function whereExpression(string $table, bool $showHidden = false): string |
|
| 903 | + public static function whereExpression(string $table, bool $showHidden = FALSE): string |
|
| 904 | 904 | { |
| 905 | 905 | // TODO: Check with applicationType; TYPO3_MODE is removed in v12 |
| 906 | 906 | if (\TYPO3_MODE === 'FE') { |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | public static function getUrl(string $url) |
| 973 | 973 | { |
| 974 | 974 | if (!Helper::isValidHttpUrl($url)) { |
| 975 | - return false; |
|
| 975 | + return FALSE; |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | // Get extension configuration. |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | $response = $requestFactory->request($url, 'GET', $configuration); |
| 991 | 991 | } catch (\Exception $e) { |
| 992 | 992 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
| 993 | - return false; |
|
| 993 | + return FALSE; |
|
| 994 | 994 | } |
| 995 | 995 | return $response->getBody()->getContents(); |
| 996 | 996 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->initializeRepositories($input->getOption('pid')); |
| 115 | 115 | |
| 116 | 116 | if ($this->storagePid == 0) { |
| 117 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 117 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 118 | 118 | return BaseCommand::FAILURE; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $output_solrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $index_name => $uid) { |
| 132 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 132 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($output_solrCores)) { |
| 135 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 135 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 136 | 136 | return BaseCommand::FAILURE; |
| 137 | 137 | } else { |
| 138 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 139 | 139 | return BaseCommand::FAILURE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ->setOffset((int) $input->getOption('index-begin')) |
| 169 | 169 | ->execute(); |
| 170 | 170 | |
| 171 | - $io->writeln($input->getOption('index-limit') . ' documents starting from ' . $input->getOption('index-begin') . ' will be indexed.'); |
|
| 171 | + $io->writeln($input->getOption('index-limit').' documents starting from '.$input->getOption('index-begin').' will be indexed.'); |
|
| 172 | 172 | } elseif ( |
| 173 | 173 | !empty($input->getOption('coll')) |
| 174 | 174 | && !is_array($input->getOption('coll')) |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
| 190 | 190 | |
| 191 | 191 | if ($doc === null) { |
| 192 | - $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
|
| 192 | + $io->warning('WARNING: Document "'.$document->getLocation().'" could not be loaded. Skip to next document.'); |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if ($dryRun) { |
| 197 | - $io->writeln('DRY RUN: Would index ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 197 | + $io->writeln('DRY RUN: Would index '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 198 | 198 | } else { |
| 199 | 199 | if ($io->isVerbose()) { |
| 200 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . ($id + 1) . '/' . count($documents) . ' with UID "' . $document->getUid() . '" ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 200 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.($id + 1).'/'.count($documents).' with UID "'.$document->getUid().'" ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 201 | 201 | } |
| 202 | 202 | $document->setCurrentDocument($doc); |
| 203 | 203 | // save to database |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @access public |
| 32 | 32 | */ |
| 33 | -class ReindexCommand extends BaseCommand |
|
| 34 | -{ |
|
| 33 | +class ReindexCommand extends BaseCommand { |
|
| 35 | 34 | /** |
| 36 | 35 | * Configure the command by defining the name, options and arguments |
| 37 | 36 | * |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | ->setHelp('') |
| 47 | 47 | ->addOption( |
| 48 | 48 | 'dry-run', |
| 49 | - null, |
|
| 49 | + NULL, |
|
| 50 | 50 | InputOption::VALUE_NONE, |
| 51 | 51 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
| 52 | 52 | ) |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 108 | 108 | { |
| 109 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 109 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 110 | 110 | |
| 111 | 111 | $io = new SymfonyStyle($input, $output); |
| 112 | 112 | $io->title($this->getDescription()); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
| 152 | 152 | } |
| 153 | 153 | } else { |
| 154 | - $this->owner = null; |
|
| 154 | + $this->owner = NULL; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if (!empty($input->getOption('all'))) { |
@@ -174,21 +174,21 @@ discard block |
||
| 174 | 174 | && !is_array($input->getOption('coll')) |
| 175 | 175 | ) { |
| 176 | 176 | // "coll" may be a single integer or a comma-separated list of integers. |
| 177 | - if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), true)))) { |
|
| 177 | + if (empty(array_filter(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE)))) { |
|
| 178 | 178 | $io->error('ERROR: Parameter --coll|-c is not a valid comma-separated list of collection UIDs.'); |
| 179 | 179 | return BaseCommand::FAILURE; |
| 180 | 180 | } |
| 181 | 181 | // Get all documents of given collections. |
| 182 | - $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), true), 0); |
|
| 182 | + $documents = $this->documentRepository->findAllByCollectionsLimited(GeneralUtility::intExplode(',', $input->getOption('coll'), TRUE), 0); |
|
| 183 | 183 | } else { |
| 184 | 184 | $io->error('ERROR: One of parameters --all|-a or --coll|-c must be given.'); |
| 185 | 185 | return BaseCommand::FAILURE; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | foreach ($documents as $id => $document) { |
| 189 | - $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
| 189 | + $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
| 190 | 190 | |
| 191 | - if ($doc === null) { |
|
| 191 | + if ($doc === NULL) { |
|
| 192 | 192 | $io->warning('WARNING: Document "' . $document->getLocation() . '" could not be loaded. Skip to next document.'); |
| 193 | 193 | continue; |
| 194 | 194 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * |
| 335 | 335 | * @return void |
| 336 | 336 | */ |
| 337 | - private function addCollections(Document &$document, array $collections): void |
|
| 337 | + private function addCollections(Document & $document, array $collections): void |
|
| 338 | 338 | { |
| 339 | 339 | foreach ($collections as $collection) { |
| 340 | 340 | $documentCollection = $this->collectionRepository->findOneByIndexName($collection); |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | for ($i = 0; $i < $count; $i++) { |
| 378 | 378 | // Build the next part to add |
| 379 | - $nextPart = ($i === 0 ? '' : $delimiter) . $metadataAuthor[$i]; |
|
| 379 | + $nextPart = ($i === 0 ? '' : $delimiter).$metadataAuthor[$i]; |
|
| 380 | 380 | // Check if adding this part and ellipsis in future would exceed the character limit |
| 381 | - if (strlen($authors . $nextPart . $delimiter . $ellipsis) > 255) { |
|
| 381 | + if (strlen($authors.$nextPart.$delimiter.$ellipsis) > 255) { |
|
| 382 | 382 | // Add ellipsis and stop adding more authors |
| 383 | - $authors .= $delimiter . $ellipsis; |
|
| 383 | + $authors .= $delimiter.$ellipsis; |
|
| 384 | 384 | break; |
| 385 | 385 | } |
| 386 | 386 | // Add the part to the main string |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @access public |
| 42 | 42 | */ |
| 43 | -class BaseCommand extends Command |
|
| 44 | -{ |
|
| 43 | +class BaseCommand extends Command { |
|
| 45 | 44 | /** |
| 46 | 45 | * @access protected |
| 47 | 46 | * @var CollectionRepository |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | // Get extension configuration. |
| 135 | 135 | $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
| 136 | 136 | } else { |
| 137 | - return false; |
|
| 137 | + return FALSE; |
|
| 138 | 138 | } |
| 139 | 139 | $this->storagePid = MathUtility::forceIntegerInRange((int) $storagePid, 0); |
| 140 | 140 | |
| 141 | - return true; |
|
| 141 | + return TRUE; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | protected function saveToDatabase(Document $document): bool |
| 207 | 207 | { |
| 208 | 208 | $doc = $document->getCurrentDocument(); |
| 209 | - if ($doc === null) { |
|
| 210 | - return false; |
|
| 209 | + if ($doc === NULL) { |
|
| 210 | + return FALSE; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $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 { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | $this->persistenceManager->persistAll(); |
| 279 | 279 | |
| 280 | - return true; |
|
| 280 | + return TRUE; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | $doc = $document->getCurrentDocument(); |
| 296 | 296 | |
| 297 | - if ($doc !== null && !empty($doc->parentHref)) { |
|
| 297 | + if ($doc !== NULL && !empty($doc->parentHref)) { |
|
| 298 | 298 | // find document object by record_id of parent |
| 299 | 299 | $parent = AbstractDocument::getInstance($doc->parentHref, ['storagePid' => $this->storagePid]); |
| 300 | 300 | |
| 301 | 301 | if ($parent->recordId) { |
| 302 | 302 | $parentDocument = $this->documentRepository->findOneByRecordId($parent->recordId); |
| 303 | 303 | |
| 304 | - if ($parentDocument === null) { |
|
| 304 | + if ($parentDocument === NULL) { |
|
| 305 | 305 | // create new Document object |
| 306 | 306 | $parentDocument = GeneralUtility::makeInstance(Document::class); |
| 307 | 307 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $success = $this->saveToDatabase($parentDocument); |
| 315 | 315 | |
| 316 | - if ($success === true) { |
|
| 316 | + if ($success === TRUE) { |
|
| 317 | 317 | // add to index |
| 318 | 318 | Indexer::add($parentDocument, $this->documentRepository); |
| 319 | 319 | return $parentDocument->getUid(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->initializeRepositories($input->getOption('pid')); |
| 112 | 112 | |
| 113 | 113 | if ($this->storagePid == 0) { |
| 114 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 114 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 115 | 115 | return BaseCommand::FAILURE; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 130 | 130 | $output_solrCores = []; |
| 131 | 131 | foreach ($allSolrCores as $index_name => $uid) { |
| 132 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 132 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 133 | 133 | } |
| 134 | 134 | if (empty($output_solrCores)) { |
| 135 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 135 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 136 | 136 | return BaseCommand::FAILURE; |
| 137 | 137 | } else { |
| 138 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
| 138 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 139 | 139 | return BaseCommand::FAILURE; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | return BaseCommand::FAILURE; |
| 156 | 156 | } |
| 157 | 157 | if (!GeneralUtility::isValidUrl($baseUrl)) { |
| 158 | - $io->error('ERROR: No valid OAI Base URL set for library with given UID ("' . $input->getOption('lib') . '").'); |
|
| 158 | + $io->error('ERROR: No valid OAI Base URL set for library with given UID ("'.$input->getOption('lib').'").'); |
|
| 159 | 159 | return BaseCommand::FAILURE; |
| 160 | 160 | } else { |
| 161 | 161 | try { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | if (empty($set)) { |
| 200 | - $io->error('ERROR: OAI interface does not provide a set with given setSpec ("' . $input->getOption('set') . '").'); |
|
| 200 | + $io->error('ERROR: OAI interface does not provide a set with given setSpec ("'.$input->getOption('set').'").'); |
|
| 201 | 201 | return BaseCommand::FAILURE; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Process all identifiers. |
| 218 | - $baseLocation = $baseUrl . (parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
| 218 | + $baseLocation = $baseUrl.(parse_url($baseUrl, PHP_URL_QUERY) ? '&' : '?'); |
|
| 219 | 219 | foreach ($identifiers as $identifier) { |
| 220 | 220 | // Build OAI GetRecord URL... |
| 221 | 221 | $params = [ |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | 'metadataPrefix' => 'mets', |
| 224 | 224 | 'identifier' => (string) $identifier->identifier |
| 225 | 225 | ]; |
| 226 | - $docLocation = $baseLocation . http_build_query($params); |
|
| 226 | + $docLocation = $baseLocation.http_build_query($params); |
|
| 227 | 227 | // ...index the document... |
| 228 | 228 | $document = null; |
| 229 | 229 | $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
| 230 | 230 | |
| 231 | 231 | if ($doc === null) { |
| 232 | - $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
|
| 232 | + $io->warning('WARNING: Document "'.$docLocation.'" could not be loaded. Skip to next document.'); |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | $document->setSolrcore($solrCoreUid); |
| 247 | 247 | |
| 248 | 248 | if ($dryRun) { |
| 249 | - $io->writeln('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 249 | + $io->writeln('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 250 | 250 | } else { |
| 251 | 251 | if ($io->isVerbose()) { |
| 252 | - $io->writeln(date('Y-m-d H:i:s') . ' Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 252 | + $io->writeln(date('Y-m-d H:i:s').' Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 253 | 253 | } |
| 254 | 254 | $document->setCurrentDocument($doc); |
| 255 | 255 | // save to database |
@@ -276,6 +276,6 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | protected function handleOaiError(BaseoaipmhException $exception, SymfonyStyle $io): void |
| 278 | 278 | { |
| 279 | - $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:' . "\n " . $exception->getMessage()); |
|
| 279 | + $io->error('ERROR: Trying to retrieve data from OAI interface resulted in error:'."\n ".$exception->getMessage()); |
|
| 280 | 280 | } |
| 281 | 281 | } |
@@ -33,8 +33,7 @@ |
||
| 33 | 33 | * |
| 34 | 34 | * @access public |
| 35 | 35 | */ |
| 36 | -class HarvestCommand extends BaseCommand |
|
| 37 | -{ |
|
| 36 | +class HarvestCommand extends BaseCommand { |
|
| 38 | 37 | /** |
| 39 | 38 | * Configure the command by defining the name, options and arguments |
| 40 | 39 | * |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ->setHelp('') |
| 50 | 50 | ->addOption( |
| 51 | 51 | 'dry-run', |
| 52 | - null, |
|
| 52 | + NULL, |
|
| 53 | 53 | InputOption::VALUE_NONE, |
| 54 | 54 | 'If this option is set, the files will not actually be processed but the location URIs are shown.' |
| 55 | 55 | ) |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | ) |
| 74 | 74 | ->addOption( |
| 75 | 75 | 'from', |
| 76 | - null, |
|
| 76 | + NULL, |
|
| 77 | 77 | InputOption::VALUE_OPTIONAL, |
| 78 | 78 | 'Datestamp (YYYY-MM-DD) to begin harvesting from.' |
| 79 | 79 | ) |
| 80 | 80 | ->addOption( |
| 81 | 81 | 'until', |
| 82 | - null, |
|
| 82 | + NULL, |
|
| 83 | 83 | InputOption::VALUE_OPTIONAL, |
| 84 | 84 | 'Datestamp (YYYY-MM-DD) to end harvesting on.' |
| 85 | 85 | ) |
| 86 | 86 | ->addOption( |
| 87 | 87 | 'set', |
| 88 | - null, |
|
| 88 | + NULL, |
|
| 89 | 89 | InputOption::VALUE_OPTIONAL, |
| 90 | 90 | 'Name of the set to limit harvesting to.' |
| 91 | 91 | ); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 105 | 105 | { |
| 106 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 106 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 107 | 107 | |
| 108 | 108 | $io = new SymfonyStyle($input, $output); |
| 109 | 109 | $io->title($this->getDescription()); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ) { |
| 172 | 172 | $from = new \DateTime($input->getOption('from')); |
| 173 | 173 | } else { |
| 174 | - $from = null; |
|
| 174 | + $from = NULL; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if ( |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | ) { |
| 181 | 181 | $until = new \DateTime($input->getOption('until')); |
| 182 | 182 | } else { |
| 183 | - $until = null; |
|
| 183 | + $until = NULL; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $set = null; |
|
| 186 | + $set = NULL; |
|
| 187 | 187 | if ( |
| 188 | 188 | !is_array($input->getOption('set')) |
| 189 | 189 | && !empty($input->getOption('set')) |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | ]; |
| 226 | 226 | $docLocation = $baseLocation . http_build_query($params); |
| 227 | 227 | // ...index the document... |
| 228 | - $document = null; |
|
| 229 | - $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], true); |
|
| 228 | + $document = NULL; |
|
| 229 | + $doc = AbstractDocument::getInstance($docLocation, ['storagePid' => $this->storagePid], TRUE); |
|
| 230 | 230 | |
| 231 | - if ($doc === null) { |
|
| 231 | + if ($doc === NULL) { |
|
| 232 | 232 | $io->warning('WARNING: Document "' . $docLocation . '" could not be loaded. Skip to next document.'); |
| 233 | 233 | continue; |
| 234 | 234 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if ($document === null) { |
|
| 240 | + if ($document === NULL) { |
|
| 241 | 241 | // create new Document object |
| 242 | 242 | $document = GeneralUtility::makeInstance(Document::class); |
| 243 | 243 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->initializeRepositories($input->getOption('pid')); |
| 99 | 99 | |
| 100 | 100 | if ($this->storagePid == 0) { |
| 101 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
| 101 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
| 102 | 102 | return BaseCommand::FAILURE; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
| 114 | 114 | $output_solrCores = []; |
| 115 | 115 | foreach ($allSolrCores as $index_name => $uid) { |
| 116 | - $output_solrCores[] = $uid . ' : ' . $index_name; |
|
| 116 | + $output_solrCores[] = $uid.' : '.$index_name; |
|
| 117 | 117 | } |
| 118 | 118 | if (empty($output_solrCores)) { |
| 119 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
| 119 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
| 120 | 120 | return BaseCommand::FAILURE; |
| 121 | 121 | } else { |
| 122 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $output_solrCores) . "\n"); |
|
| 122 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $output_solrCores)."\n"); |
|
| 123 | 123 | return BaseCommand::FAILURE; |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
| 160 | 160 | |
| 161 | 161 | if ($document === null) { |
| 162 | - $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
|
| 162 | + $io->error('ERROR: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.' .'); |
|
| 163 | 163 | exit(1); |
| 164 | 164 | } else { |
| 165 | 165 | $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
@@ -172,17 +172,17 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ($doc === null) { |
| 175 | - $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
|
| 175 | + $io->error('ERROR: Document "'.$input->getOption('doc').'" could not be loaded.'); |
|
| 176 | 176 | return BaseCommand::FAILURE; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $document->setSolrcore($solrCoreUid); |
| 180 | 180 | |
| 181 | 181 | if ($dryRun) { |
| 182 | - $io->section('DRY RUN: Would index ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 182 | + $io->section('DRY RUN: Would index '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 183 | 183 | } else { |
| 184 | 184 | if ($io->isVerbose()) { |
| 185 | - $io->section('Indexing ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . ' and Solr core ' . $solrCoreUid . '.'); |
|
| 185 | + $io->section('Indexing '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.' and Solr core '.$solrCoreUid.'.'); |
|
| 186 | 186 | } |
| 187 | 187 | $document->setCurrentDocument($doc); |
| 188 | 188 | // save to database |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | * |
| 32 | 32 | * @access public |
| 33 | 33 | */ |
| 34 | -class IndexCommand extends BaseCommand |
|
| 35 | -{ |
|
| 34 | +class IndexCommand extends BaseCommand { |
|
| 36 | 35 | |
| 37 | 36 | /** |
| 38 | 37 | * Configure the command by defining the name, options and arguments |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ->setHelp('') |
| 49 | 49 | ->addOption( |
| 50 | 50 | 'dry-run', |
| 51 | - null, |
|
| 51 | + NULL, |
|
| 52 | 52 | InputOption::VALUE_NONE, |
| 53 | 53 | 'If this option is set, the files will not actually be processed but the location URI is shown.' |
| 54 | 54 | ) |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function execute(InputInterface $input, OutputInterface $output): int |
| 92 | 92 | { |
| 93 | - $dryRun = $input->getOption('dry-run') != false ? true : false; |
|
| 93 | + $dryRun = $input->getOption('dry-run') != FALSE ? TRUE : FALSE; |
|
| 94 | 94 | |
| 95 | 95 | $io = new SymfonyStyle($input, $output); |
| 96 | 96 | $io->title($this->getDescription()); |
@@ -147,31 +147,31 @@ discard block |
||
| 147 | 147 | $this->owner = $this->libraryRepository->findOneByIndexName((string) $input->getOption('owner')); |
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - $this->owner = null; |
|
| 150 | + $this->owner = NULL; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $document = null; |
|
| 154 | - $doc = null; |
|
| 153 | + $document = NULL; |
|
| 154 | + $doc = NULL; |
|
| 155 | 155 | |
| 156 | 156 | // Try to find existing document in database |
| 157 | 157 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
| 158 | 158 | |
| 159 | 159 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
| 160 | 160 | |
| 161 | - if ($document === null) { |
|
| 161 | + if ($document === NULL) { |
|
| 162 | 162 | $io->error('ERROR: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . ' .'); |
| 163 | 163 | exit(1); |
| 164 | 164 | } else { |
| 165 | - $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], true); |
|
| 165 | + $doc = AbstractDocument::getInstance($document->getLocation(), ['storagePid' => $this->storagePid], TRUE); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | } else if (GeneralUtility::isValidUrl($input->getOption('doc'))) { |
| 169 | - $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); |
|
| 169 | + $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE); |
|
| 170 | 170 | |
| 171 | 171 | $document = $this->getDocumentFromUrl($doc, $input->getOption('doc')); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - if ($doc === null) { |
|
| 174 | + if ($doc === NULL) { |
|
| 175 | 175 | $io->error('ERROR: Document "' . $input->getOption('doc') . '" could not be loaded.'); |
| 176 | 176 | return BaseCommand::FAILURE; |
| 177 | 177 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | private function getDocumentFromUrl($doc, string $url): Document |
| 210 | 210 | { |
| 211 | - $document = null; |
|
| 211 | + $document = NULL; |
|
| 212 | 212 | |
| 213 | 213 | if ($doc->recordId) { |
| 214 | 214 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $document = $this->documentRepository->findOneByLocation($url); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ($document === null) { |
|
| 219 | + if ($document === NULL) { |
|
| 220 | 220 | // create new Document object |
| 221 | 221 | $document = GeneralUtility::makeInstance(Document::class); |
| 222 | 222 | } |
@@ -22,7 +22,6 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @access public |
| 24 | 24 | */ |
| 25 | -class StructureRepository extends Repository |
|
| 26 | -{ |
|
| 25 | +class StructureRepository extends Repository { |
|
| 27 | 26 | |
| 28 | 27 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @access public |
| 26 | 26 | */ |
| 27 | -class MetadataRepository extends Repository |
|
| 28 | -{ |
|
| 27 | +class MetadataRepository extends Repository { |
|
| 29 | 28 | /** |
| 30 | 29 | * Finds all collection for the given settings |
| 31 | 30 | * |