@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | // Get next available core name if none given. |
| 136 | 136 | if (empty($core)) { |
| 137 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
| 137 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
| 138 | 138 | } |
| 139 | 139 | // Get Solr service instance. |
| 140 | 140 | $solr = self::getInstance($core); |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | ->execute(); |
| 231 | 231 | |
| 232 | 232 | while ($resArray = $result->fetch()) { |
| 233 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
| 233 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Check if queried field is valid. |
| 237 | 237 | $splitQuery = explode(':', $query, 2); |
| 238 | 238 | if (in_array($splitQuery[0], $fields)) { |
| 239 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
| 239 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
| 240 | 240 | } else { |
| 241 | 241 | $query = self::escapeQuery($query); |
| 242 | 242 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | { |
| 344 | 344 | $number = max(intval($number), 0); |
| 345 | 345 | // Check if core already exists. |
| 346 | - $solr = self::getInstance('dlfCore' . $number); |
|
| 346 | + $solr = self::getInstance('dlfCore'.$number); |
|
| 347 | 347 | if (!$solr->ready) { |
| 348 | 348 | return $number; |
| 349 | 349 | } else { |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | // Set filter query to just get toplevel documents. |
| 419 | 419 | $params['filterquery'][] = ['query' => 'toplevel:true']; |
| 420 | 420 | // Set join query to get all documents with the same uids. |
| 421 | - $params['query'] = '{!join from=uid to=uid}' . $params['query']; |
|
| 421 | + $params['query'] = '{!join from=uid to=uid}'.$params['query']; |
|
| 422 | 422 | // Perform search to determine the total number of toplevel hits and fetch the required rows. |
| 423 | 423 | $selectQuery = $this->service->createSelect($params); |
| 424 | 424 | $results = $this->service->select($selectQuery); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | // Set query. |
| 476 | 476 | $parameters['query'] = $query; |
| 477 | 477 | // Calculate cache identifier. |
| 478 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 478 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
| 479 | 479 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 480 | 480 | $resultSet = []; |
| 481 | 481 | if (($entry = $cache->get($cacheIdentifier)) === false) { |
@@ -606,12 +606,12 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | public function __get($var) |
| 608 | 608 | { |
| 609 | - $method = '_get' . ucfirst($var); |
|
| 609 | + $method = '_get'.ucfirst($var); |
|
| 610 | 610 | if ( |
| 611 | 611 | !property_exists($this, $var) |
| 612 | 612 | || !method_exists($this, $method) |
| 613 | 613 | ) { |
| 614 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 614 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 615 | 615 | return; |
| 616 | 616 | } else { |
| 617 | 617 | return $this->$method(); |
@@ -644,12 +644,12 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | public function __set($var, $value) |
| 646 | 646 | { |
| 647 | - $method = '_set' . ucfirst($var); |
|
| 647 | + $method = '_set'.ucfirst($var); |
|
| 648 | 648 | if ( |
| 649 | 649 | !property_exists($this, $var) |
| 650 | 650 | || !method_exists($this, $method) |
| 651 | 651 | ) { |
| 652 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 652 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 653 | 653 | } else { |
| 654 | 654 | $this->$method($value); |
| 655 | 655 | } |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | 'scheme' => $this->config['scheme'], |
| 687 | 687 | 'host' => $this->config['host'], |
| 688 | 688 | 'port' => $this->config['port'], |
| 689 | - 'path' => '/' . $this->config['path'], |
|
| 689 | + 'path' => '/'.$this->config['path'], |
|
| 690 | 690 | 'core' => $core, |
| 691 | 691 | 'username' => $this->config['username'], |
| 692 | 692 | 'password' => $this->config['password'], |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * @property-read bool $ready Is the Solr service instantiated successfully? |
| 38 | 38 | * @property-read \Solarium\Client $service This holds the Solr service object |
| 39 | 39 | */ |
| 40 | -class Solr implements LoggerAwareInterface |
|
| 41 | -{ |
|
| 40 | +class Solr implements LoggerAwareInterface { |
|
| 42 | 41 | use LoggerAwareTrait; |
| 43 | 42 | |
| 44 | 43 | /** |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | * |
| 131 | 130 | * @return string The name of the new core |
| 132 | 131 | */ |
| 133 | - public static function createCore($core = '') |
|
| 134 | - { |
|
| 132 | + public static function createCore($core = '') { |
|
| 135 | 133 | // Get next available core name if none given. |
| 136 | 134 | if (empty($core)) { |
| 137 | 135 | $core = 'dlfCore' . self::getNextCoreNumber(); |
@@ -178,8 +176,7 @@ discard block |
||
| 178 | 176 | * |
| 179 | 177 | * @return string The escaped query string |
| 180 | 178 | */ |
| 181 | - public static function escapeQuery($query) |
|
| 182 | - { |
|
| 179 | + public static function escapeQuery($query) { |
|
| 183 | 180 | $helper = GeneralUtility::makeInstance(\Solarium\Core\Query\Helper::class); |
| 184 | 181 | // Escape query phrase or term. |
| 185 | 182 | if (preg_match('/^".*"$/', $query)) { |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | * |
| 203 | 200 | * @return string The escaped query string |
| 204 | 201 | */ |
| 205 | - public static function escapeQueryKeepField($query, $pid) |
|
| 206 | - { |
|
| 202 | + public static function escapeQueryKeepField($query, $pid) { |
|
| 207 | 203 | // Is there a field query? |
| 208 | 204 | if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(?.*\)?$/', $query)) { |
| 209 | 205 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -253,8 +249,7 @@ discard block |
||
| 253 | 249 | * |
| 254 | 250 | * @return array fields |
| 255 | 251 | */ |
| 256 | - public static function getFields() |
|
| 257 | - { |
|
| 252 | + public static function getFields() { |
|
| 258 | 253 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 259 | 254 | |
| 260 | 255 | $fields = []; |
@@ -296,8 +291,7 @@ discard block |
||
| 296 | 291 | * |
| 297 | 292 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 298 | 293 | */ |
| 299 | - public static function getInstance($core = null) |
|
| 300 | - { |
|
| 294 | + public static function getInstance($core = null) { |
|
| 301 | 295 | // Get core name if UID is given. |
| 302 | 296 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
| 303 | 297 | $core = Helper::getIndexNameFromUid($core, 'tx_dlf_solrcores'); |
@@ -337,8 +331,7 @@ discard block |
||
| 337 | 331 | * |
| 338 | 332 | * @return int First unused core number found |
| 339 | 333 | */ |
| 340 | - public static function getNextCoreNumber($number = 0) |
|
| 341 | - { |
|
| 334 | + public static function getNextCoreNumber($number = 0) { |
|
| 342 | 335 | $number = max(intval($number), 0); |
| 343 | 336 | // Check if core already exists. |
| 344 | 337 | $solr = self::getInstance('dlfCore' . $number); |
@@ -356,8 +349,7 @@ discard block |
||
| 356 | 349 | * |
| 357 | 350 | * @return void |
| 358 | 351 | */ |
| 359 | - protected function loadSolrConnectionInfo() |
|
| 360 | - { |
|
| 352 | + protected function loadSolrConnectionInfo() { |
|
| 361 | 353 | if (empty($this->config)) { |
| 362 | 354 | $config = []; |
| 363 | 355 | // Extract extension configuration. |
@@ -395,8 +387,7 @@ discard block |
||
| 395 | 387 | * |
| 396 | 388 | * @return \Kitodo\Dlf\Common\DocumentList The result list |
| 397 | 389 | */ |
| 398 | - public function search() |
|
| 399 | - { |
|
| 390 | + public function search() { |
|
| 400 | 391 | $toplevel = []; |
| 401 | 392 | // Take over query parameters. |
| 402 | 393 | $params = $this->params; |
@@ -465,8 +456,7 @@ discard block |
||
| 465 | 456 | * |
| 466 | 457 | * @return array The Apache Solr Documents that were fetched |
| 467 | 458 | */ |
| 468 | - public function search_raw($query = '', $parameters = []) |
|
| 469 | - { |
|
| 459 | + public function search_raw($query = '', $parameters = []) { |
|
| 470 | 460 | // Set additional query parameters. |
| 471 | 461 | $parameters['start'] = 0; |
| 472 | 462 | $parameters['rows'] = $this->limit; |
@@ -498,8 +488,7 @@ discard block |
||
| 498 | 488 | * |
| 499 | 489 | * @return string|null The core name of the current query endpoint or null if core admin endpoint |
| 500 | 490 | */ |
| 501 | - protected function _getCore() |
|
| 502 | - { |
|
| 491 | + protected function _getCore() { |
|
| 503 | 492 | return $this->core; |
| 504 | 493 | } |
| 505 | 494 | |
@@ -510,8 +499,7 @@ discard block |
||
| 510 | 499 | * |
| 511 | 500 | * @return int The max number of results |
| 512 | 501 | */ |
| 513 | - protected function _getLimit() |
|
| 514 | - { |
|
| 502 | + protected function _getLimit() { |
|
| 515 | 503 | return $this->limit; |
| 516 | 504 | } |
| 517 | 505 | |
@@ -522,8 +510,7 @@ discard block |
||
| 522 | 510 | * |
| 523 | 511 | * @return int Total number of hits for last search |
| 524 | 512 | */ |
| 525 | - protected function _getNumberOfHits() |
|
| 526 | - { |
|
| 513 | + protected function _getNumberOfHits() { |
|
| 527 | 514 | return $this->numberOfHits; |
| 528 | 515 | } |
| 529 | 516 | |
@@ -534,8 +521,7 @@ discard block |
||
| 534 | 521 | * |
| 535 | 522 | * @return bool Is the search instantiated successfully? |
| 536 | 523 | */ |
| 537 | - protected function _getReady() |
|
| 538 | - { |
|
| 524 | + protected function _getReady() { |
|
| 539 | 525 | return $this->ready; |
| 540 | 526 | } |
| 541 | 527 | |
@@ -546,8 +532,7 @@ discard block |
||
| 546 | 532 | * |
| 547 | 533 | * @return \Solarium\Client Apache Solr service object |
| 548 | 534 | */ |
| 549 | - protected function _getService() |
|
| 550 | - { |
|
| 535 | + protected function _getService() { |
|
| 551 | 536 | return $this->service; |
| 552 | 537 | } |
| 553 | 538 | |
@@ -560,8 +545,7 @@ discard block |
||
| 560 | 545 | * |
| 561 | 546 | * @return void |
| 562 | 547 | */ |
| 563 | - protected function _setCPid($value) |
|
| 564 | - { |
|
| 548 | + protected function _setCPid($value) { |
|
| 565 | 549 | $this->cPid = max(intval($value), 0); |
| 566 | 550 | } |
| 567 | 551 | |
@@ -574,8 +558,7 @@ discard block |
||
| 574 | 558 | * |
| 575 | 559 | * @return void |
| 576 | 560 | */ |
| 577 | - protected function _setLimit($value) |
|
| 578 | - { |
|
| 561 | + protected function _setLimit($value) { |
|
| 579 | 562 | $this->limit = max(intval($value), 0); |
| 580 | 563 | } |
| 581 | 564 | |
@@ -588,8 +571,7 @@ discard block |
||
| 588 | 571 | * |
| 589 | 572 | * @return void |
| 590 | 573 | */ |
| 591 | - protected function _setParams(array $value) |
|
| 592 | - { |
|
| 574 | + protected function _setParams(array $value) { |
|
| 593 | 575 | $this->params = $value; |
| 594 | 576 | } |
| 595 | 577 | |
@@ -602,8 +584,7 @@ discard block |
||
| 602 | 584 | * |
| 603 | 585 | * @return mixed Value of $this->$var |
| 604 | 586 | */ |
| 605 | - public function __get($var) |
|
| 606 | - { |
|
| 587 | + public function __get($var) { |
|
| 607 | 588 | $method = '_get' . ucfirst($var); |
| 608 | 589 | if ( |
| 609 | 590 | !property_exists($this, $var) |
@@ -625,8 +606,7 @@ discard block |
||
| 625 | 606 | * |
| 626 | 607 | * @return bool true if variable is set and not empty, false otherwise |
| 627 | 608 | */ |
| 628 | - public function __isset($var) |
|
| 629 | - { |
|
| 609 | + public function __isset($var) { |
|
| 630 | 610 | return !empty($this->__get($var)); |
| 631 | 611 | } |
| 632 | 612 | |
@@ -640,8 +620,7 @@ discard block |
||
| 640 | 620 | * |
| 641 | 621 | * @return void |
| 642 | 622 | */ |
| 643 | - public function __set($var, $value) |
|
| 644 | - { |
|
| 623 | + public function __set($var, $value) { |
|
| 645 | 624 | $method = '_set' . ucfirst($var); |
| 646 | 625 | if ( |
| 647 | 626 | !property_exists($this, $var) |
@@ -662,8 +641,7 @@ discard block |
||
| 662 | 641 | * |
| 663 | 642 | * @return void |
| 664 | 643 | */ |
| 665 | - protected function __construct($core) |
|
| 666 | - { |
|
| 644 | + protected function __construct($core) { |
|
| 667 | 645 | // Get Solr connection parameters from configuration. |
| 668 | 646 | $this->loadSolrConnectionInfo(); |
| 669 | 647 | // Configure connection adapter. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @var string|null |
| 56 | 56 | * @access protected |
| 57 | 57 | */ |
| 58 | - protected $core = null; |
|
| 58 | + protected $core = NULL; |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * This holds the PID for the configuration |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @var bool |
| 104 | 104 | * @access protected |
| 105 | 105 | */ |
| 106 | - protected $ready = false; |
|
| 106 | + protected $ready = FALSE; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * This holds the singleton search objects with their core as array key |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @return \Kitodo\Dlf\Common\Solr Instance of this class |
| 298 | 298 | */ |
| 299 | - public static function getInstance($core = null) |
|
| 299 | + public static function getInstance($core = NULL) |
|
| 300 | 300 | { |
| 301 | 301 | // Get core name if UID is given. |
| 302 | 302 | if (MathUtility::canBeInterpretedAsInteger($core)) { |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | // Check if core is set or null. |
| 306 | 306 | if ( |
| 307 | 307 | empty($core) |
| 308 | - && $core !== null |
|
| 308 | + && $core !== NULL |
|
| 309 | 309 | ) { |
| 310 | 310 | Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR); |
| 311 | 311 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | 'core' => $this->core, |
| 448 | 448 | 'pid' => $this->cPid, |
| 449 | 449 | 'order' => 'score', |
| 450 | - 'order.asc' => true, |
|
| 450 | + 'order.asc' => TRUE, |
|
| 451 | 451 | 'numberOfHits' => $this->numberOfHits, |
| 452 | 452 | 'numberOfToplevelHits' => $numberOfToplevelHits |
| 453 | 453 | ] |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | // Set query. |
| 474 | 474 | $parameters['query'] = $query; |
| 475 | 475 | // Calculate cache identifier. |
| 476 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 476 | + $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), TRUE)); |
|
| 477 | 477 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 478 | 478 | $resultSet = []; |
| 479 | - if (($entry = $cache->get($cacheIdentifier)) === false) { |
|
| 479 | + if (($entry = $cache->get($cacheIdentifier)) === FALSE) { |
|
| 480 | 480 | $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters)); |
| 481 | 481 | $result = $this->service->select($selectQuery); |
| 482 | 482 | foreach ($result as $doc) { |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | // Check if connection is established. |
| 703 | 703 | $query = $this->service->createCoreAdmin(); |
| 704 | 704 | $action = $query->createStatus(); |
| 705 | - if ($core !== null) { |
|
| 705 | + if ($core !== NULL) { |
|
| 706 | 706 | $action->setCore($core); |
| 707 | 707 | } |
| 708 | 708 | $query->setAction($action); |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | $response = $this->service->coreAdmin($query); |
| 711 | 711 | if ($response->getWasSuccessful()) { |
| 712 | 712 | // Solr is reachable, but is the core as well? |
| 713 | - if ($core !== null) { |
|
| 713 | + if ($core !== NULL) { |
|
| 714 | 714 | $result = $response->getStatusResult(); |
| 715 | 715 | if ( |
| 716 | 716 | $result instanceof \Solarium\QueryType\Server\CoreAdmin\Result\StatusResult |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | // Instantiation successful! |
| 727 | - $this->ready = true; |
|
| 727 | + $this->ready = TRUE; |
|
| 728 | 728 | } |
| 729 | 729 | } catch (\Exception $e) { |
| 730 | 730 | // Nothing to do here. |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($parent->ready) { |
| 103 | 103 | $success = self::add($parent, $core); |
| 104 | 104 | } else { |
| 105 | - Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR); |
|
| 105 | + Helper::log('Could not load parent document with UID '.$doc->parentId, LOG_SEVERITY_ERROR); |
|
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | self::$processedDocs[] = $doc->uid; |
| 112 | 112 | // Delete old Solr documents. |
| 113 | 113 | $updateQuery = self::$solr->service->createUpdate(); |
| 114 | - $updateQuery->addDeleteQuery('uid:' . $doc->uid); |
|
| 114 | + $updateQuery->addDeleteQuery('uid:'.$doc->uid); |
|
| 115 | 115 | self::$solr->service->update($updateQuery); |
| 116 | 116 | |
| 117 | 117 | // Index every logical unit as separate Solr document. |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | } catch (\Exception $e) { |
| 177 | 177 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 178 | 178 | Helper::addMessage( |
| 179 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 179 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
| 180 | 180 | Helper::getMessage('flash.error', true), |
| 181 | 181 | FlashMessage::ERROR, |
| 182 | 182 | true, |
| 183 | 183 | 'core.template.flashMessages' |
| 184 | 184 | ); |
| 185 | 185 | } |
| 186 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 186 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 187 | 187 | return false; |
| 188 | 188 | } |
| 189 | 189 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | // Sanitize input. |
| 217 | 217 | $pid = max(intval($pid), 0); |
| 218 | 218 | if (!$pid) { |
| 219 | - Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 219 | + Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR); |
|
| 220 | 220 | return ''; |
| 221 | 221 | } |
| 222 | 222 | // Load metadata configuration. |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
| 226 | 226 | $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
| 227 | 227 | $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
| 228 | - $index_name .= '_' . $suffix; |
|
| 228 | + $index_name .= '_'.$suffix; |
|
| 229 | 229 | return $index_name; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $updateQuery = self::$solr->service->createUpdate(); |
| 334 | 334 | $solrDoc = $updateQuery->createDocument(); |
| 335 | 335 | // Create unique identifier from document's UID and unit's XML ID. |
| 336 | - $solrDoc->setField('id', $doc->uid . $logicalUnit['id']); |
|
| 336 | + $solrDoc->setField('id', $doc->uid.$logicalUnit['id']); |
|
| 337 | 337 | $solrDoc->setField('uid', $doc->uid); |
| 338 | 338 | $solrDoc->setField('pid', $doc->pid); |
| 339 | 339 | if (MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) { |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]); |
| 375 | 375 | if (in_array($index_name, self::$fields['sortables'])) { |
| 376 | 376 | // Add sortable fields to index. |
| 377 | - $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]); |
|
| 377 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
| 378 | 378 | } |
| 379 | 379 | if (in_array($index_name, self::$fields['facets'])) { |
| 380 | 380 | // Add facets to index. |
| 381 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 381 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 382 | 382 | } |
| 383 | 383 | if (in_array($index_name, self::$fields['autocomplete'])) { |
| 384 | 384 | $autocomplete = array_merge($autocomplete, $data); |
@@ -403,14 +403,14 @@ discard block |
||
| 403 | 403 | } catch (\Exception $e) { |
| 404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 405 | 405 | Helper::addMessage( |
| 406 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 406 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
| 407 | 407 | Helper::getMessage('flash.error', true), |
| 408 | 408 | FlashMessage::ERROR, |
| 409 | 409 | true, |
| 410 | 410 | 'core.template.flashMessages' |
| 411 | 411 | ); |
| 412 | 412 | } |
| 413 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 413 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 414 | 414 | return false; |
| 415 | 415 | } |
| 416 | 416 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $updateQuery = self::$solr->service->createUpdate(); |
| 449 | 449 | $solrDoc = $updateQuery->createDocument(); |
| 450 | 450 | // Create unique identifier from document's UID and unit's XML ID. |
| 451 | - $solrDoc->setField('id', $doc->uid . $physicalUnit['id']); |
|
| 451 | + $solrDoc->setField('id', $doc->uid.$physicalUnit['id']); |
|
| 452 | 452 | $solrDoc->setField('uid', $doc->uid); |
| 453 | 453 | $solrDoc->setField('pid', $doc->pid); |
| 454 | 454 | $solrDoc->setField('page', $page); |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | // Add facets to index. |
| 486 | - $solrDoc->setField($index_name . '_faceting', $data); |
|
| 486 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -500,14 +500,14 @@ discard block |
||
| 500 | 500 | } catch (\Exception $e) { |
| 501 | 501 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 502 | 502 | Helper::addMessage( |
| 503 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 503 | + Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()), |
|
| 504 | 504 | Helper::getMessage('flash.error', true), |
| 505 | 505 | FlashMessage::ERROR, |
| 506 | 506 | true, |
| 507 | 507 | 'core.template.flashMessages' |
| 508 | 508 | ); |
| 509 | 509 | } |
| 510 | - Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
|
| 510 | + Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR); |
|
| 511 | 511 | return false; |
| 512 | 512 | } |
| 513 | 513 | } |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | * @subpackage dlf |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class Indexer |
|
| 32 | -{ |
|
| 31 | +class Indexer { |
|
| 33 | 32 | /** |
| 34 | 33 | * The extension key |
| 35 | 34 | * |
@@ -90,8 +89,7 @@ discard block |
||
| 90 | 89 | * |
| 91 | 90 | * @return bool true on success or false on failure |
| 92 | 91 | */ |
| 93 | - public static function add(Document &$doc, $core = 0) |
|
| 94 | - { |
|
| 92 | + public static function add(Document &$doc, $core = 0) { |
|
| 95 | 93 | if (in_array($doc->uid, self::$processedDocs)) { |
| 96 | 94 | return true; |
| 97 | 95 | } elseif (self::solrConnect($core, $doc->pid)) { |
@@ -211,8 +209,7 @@ discard block |
||
| 211 | 209 | * |
| 212 | 210 | * @return string The field's dynamic index name |
| 213 | 211 | */ |
| 214 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
| 215 | - { |
|
| 212 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
| 216 | 213 | // Sanitize input. |
| 217 | 214 | $pid = max(intval($pid), 0); |
| 218 | 215 | if (!$pid) { |
@@ -238,8 +235,7 @@ discard block |
||
| 238 | 235 | * |
| 239 | 236 | * @return void |
| 240 | 237 | */ |
| 241 | - protected static function loadIndexConf($pid) |
|
| 242 | - { |
|
| 238 | + protected static function loadIndexConf($pid) { |
|
| 243 | 239 | if (!self::$fieldsLoaded) { |
| 244 | 240 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 245 | 241 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -309,8 +305,7 @@ discard block |
||
| 309 | 305 | * |
| 310 | 306 | * @return bool true on success or false on failure |
| 311 | 307 | */ |
| 312 | - protected static function processLogical(Document &$doc, array $logicalUnit) |
|
| 313 | - { |
|
| 308 | + protected static function processLogical(Document &$doc, array $logicalUnit) { |
|
| 314 | 309 | $success = true; |
| 315 | 310 | // Get metadata for logical unit. |
| 316 | 311 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
@@ -439,8 +434,7 @@ discard block |
||
| 439 | 434 | * |
| 440 | 435 | * @return bool true on success or false on failure |
| 441 | 436 | */ |
| 442 | - protected static function processPhysical(Document &$doc, $page, array $physicalUnit) |
|
| 443 | - { |
|
| 437 | + protected static function processPhysical(Document &$doc, $page, array $physicalUnit) { |
|
| 444 | 438 | if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) { |
| 445 | 439 | // Read extension configuration. |
| 446 | 440 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -524,8 +518,7 @@ discard block |
||
| 524 | 518 | * |
| 525 | 519 | * @return bool true on success or false on failure |
| 526 | 520 | */ |
| 527 | - protected static function solrConnect($core, $pid = 0) |
|
| 528 | - { |
|
| 521 | + protected static function solrConnect($core, $pid = 0) { |
|
| 529 | 522 | // Get Solr instance. |
| 530 | 523 | if (!self::$solr) { |
| 531 | 524 | // Connect to Solr server. |
@@ -548,8 +541,7 @@ discard block |
||
| 548 | 541 | * |
| 549 | 542 | * @access private |
| 550 | 543 | */ |
| 551 | - private function __construct() |
|
| 552 | - { |
|
| 544 | + private function __construct() { |
|
| 553 | 545 | // This is a static class, thus no instances should be created. |
| 554 | 546 | } |
| 555 | 547 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @var bool |
| 63 | 63 | * @access protected |
| 64 | 64 | */ |
| 65 | - protected static $fieldsLoaded = false; |
|
| 65 | + protected static $fieldsLoaded = FALSE; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * List of already processed documents |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | public static function add(Document &$doc, $core = 0) |
| 94 | 94 | { |
| 95 | 95 | if (in_array($doc->uid, self::$processedDocs)) { |
| 96 | - return true; |
|
| 96 | + return TRUE; |
|
| 97 | 97 | } elseif (self::solrConnect($core, $doc->pid)) { |
| 98 | - $success = true; |
|
| 98 | + $success = TRUE; |
|
| 99 | 99 | // Handle multi-volume documents. |
| 100 | 100 | if ($doc->parentId) { |
| 101 | - $parent = Document::getInstance($doc->parentId, 0, true); |
|
| 101 | + $parent = Document::getInstance($doc->parentId, 0, TRUE); |
|
| 102 | 102 | if ($parent->ready) { |
| 103 | 103 | $success = self::add($parent, $core); |
| 104 | 104 | } else { |
| 105 | 105 | Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR); |
| 106 | - return false; |
|
| 106 | + return FALSE; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | try { |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | if ($success) { |
| 158 | 158 | Helper::addMessage( |
| 159 | 159 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentIndexed'), $resArray['title'], $doc->uid)), |
| 160 | - Helper::getMessage('flash.done', true), |
|
| 160 | + Helper::getMessage('flash.done', TRUE), |
|
| 161 | 161 | FlashMessage::OK, |
| 162 | - true, |
|
| 162 | + TRUE, |
|
| 163 | 163 | 'core.template.flashMessages' |
| 164 | 164 | ); |
| 165 | 165 | } else { |
| 166 | 166 | Helper::addMessage( |
| 167 | 167 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentNotIndexed'), $resArray['title'], $doc->uid)), |
| 168 | - Helper::getMessage('flash.error', true), |
|
| 168 | + Helper::getMessage('flash.error', TRUE), |
|
| 169 | 169 | FlashMessage::ERROR, |
| 170 | - true, |
|
| 170 | + TRUE, |
|
| 171 | 171 | 'core.template.flashMessages' |
| 172 | 172 | ); |
| 173 | 173 | } |
@@ -176,28 +176,28 @@ discard block |
||
| 176 | 176 | } catch (\Exception $e) { |
| 177 | 177 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 178 | 178 | Helper::addMessage( |
| 179 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 180 | - Helper::getMessage('flash.error', true), |
|
| 179 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 180 | + Helper::getMessage('flash.error', TRUE), |
|
| 181 | 181 | FlashMessage::ERROR, |
| 182 | - true, |
|
| 182 | + TRUE, |
|
| 183 | 183 | 'core.template.flashMessages' |
| 184 | 184 | ); |
| 185 | 185 | } |
| 186 | 186 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 187 | - return false; |
|
| 187 | + return FALSE; |
|
| 188 | 188 | } |
| 189 | 189 | } else { |
| 190 | 190 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 191 | 191 | Helper::addMessage( |
| 192 | - Helper::getMessage('flash.solrNoConnection', true), |
|
| 193 | - Helper::getMessage('flash.warning', true), |
|
| 192 | + Helper::getMessage('flash.solrNoConnection', TRUE), |
|
| 193 | + Helper::getMessage('flash.warning', TRUE), |
|
| 194 | 194 | FlashMessage::WARNING, |
| 195 | - true, |
|
| 195 | + TRUE, |
|
| 196 | 196 | 'core.template.flashMessages' |
| 197 | 197 | ); |
| 198 | 198 | } |
| 199 | 199 | Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR); |
| 200 | - return false; |
|
| 200 | + return FALSE; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | if ($indexing['index_boost'] > 0.0) { |
| 293 | 293 | self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
| 294 | 294 | } else { |
| 295 | - self::$fields['fieldboost'][$indexing['index_name']] = false; |
|
| 295 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | - self::$fieldsLoaded = true; |
|
| 298 | + self::$fieldsLoaded = TRUE; |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | protected static function processLogical(Document &$doc, array $logicalUnit) |
| 313 | 313 | { |
| 314 | - $success = true; |
|
| 314 | + $success = TRUE; |
|
| 315 | 315 | // Get metadata for logical unit. |
| 316 | 316 | $metadata = $doc->metadataArray[$logicalUnit['id']]; |
| 317 | 317 | if (!empty($metadata)) { |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $solrDoc->setField('root', $doc->rootId); |
| 349 | 349 | $solrDoc->setField('sid', $logicalUnit['id']); |
| 350 | 350 | // There can be only one toplevel unit per UID, independently of backend configuration |
| 351 | - $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false); |
|
| 351 | + $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE); |
|
| 352 | 352 | $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']); |
| 353 | 353 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
| 354 | 354 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
@@ -403,15 +403,15 @@ discard block |
||
| 403 | 403 | } catch (\Exception $e) { |
| 404 | 404 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 405 | 405 | Helper::addMessage( |
| 406 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 407 | - Helper::getMessage('flash.error', true), |
|
| 406 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 407 | + Helper::getMessage('flash.error', TRUE), |
|
| 408 | 408 | FlashMessage::ERROR, |
| 409 | - true, |
|
| 409 | + TRUE, |
|
| 410 | 410 | 'core.template.flashMessages' |
| 411 | 411 | ); |
| 412 | 412 | } |
| 413 | 413 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 414 | - return false; |
|
| 414 | + return FALSE; |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | // Check for child elements... |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $solrDoc->setField('partof', $doc->parentId); |
| 463 | 463 | $solrDoc->setField('root', $doc->rootId); |
| 464 | 464 | $solrDoc->setField('sid', $physicalUnit['id']); |
| 465 | - $solrDoc->setField('toplevel', false); |
|
| 465 | + $solrDoc->setField('toplevel', FALSE); |
|
| 466 | 466 | $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
| 467 | 467 | $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']); |
| 468 | 468 | |
@@ -500,18 +500,18 @@ discard block |
||
| 500 | 500 | } catch (\Exception $e) { |
| 501 | 501 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 502 | 502 | Helper::addMessage( |
| 503 | - Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 504 | - Helper::getMessage('flash.error', true), |
|
| 503 | + Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()), |
|
| 504 | + Helper::getMessage('flash.error', TRUE), |
|
| 505 | 505 | FlashMessage::ERROR, |
| 506 | - true, |
|
| 506 | + TRUE, |
|
| 507 | 507 | 'core.template.flashMessages' |
| 508 | 508 | ); |
| 509 | 509 | } |
| 510 | 510 | Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR); |
| 511 | - return false; |
|
| 511 | + return FALSE; |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | - return true; |
|
| 514 | + return TRUE; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -537,10 +537,10 @@ discard block |
||
| 537 | 537 | self::loadIndexConf($pid); |
| 538 | 538 | } |
| 539 | 539 | } else { |
| 540 | - return false; |
|
| 540 | + return FALSE; |
|
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | - return true; |
|
| 543 | + return TRUE; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -671,14 +671,14 @@ discard block |
||
| 671 | 671 | if ($fileContent !== false) { |
| 672 | 672 | $textFormat = $this->getTextFormat($fileContent); |
| 673 | 673 | } else { |
| 674 | - $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
|
| 674 | + $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"'); |
|
| 675 | 675 | return $fullText; |
| 676 | 676 | } |
| 677 | 677 | break; |
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | } else { |
| 681 | - $this->logger->warning('Invalid structure node @ID "' . $id . '"'); |
|
| 681 | + $this->logger->warning('Invalid structure node @ID "'.$id.'"'); |
|
| 682 | 682 | return $fullText; |
| 683 | 683 | } |
| 684 | 684 | // Is this text format supported? |
@@ -697,12 +697,12 @@ discard block |
||
| 697 | 697 | $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml); |
| 698 | 698 | $this->rawTextArray[$id] = $textMiniOcr; |
| 699 | 699 | } else { |
| 700 | - $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"'); |
|
| 700 | + $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"'); |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | $fullText = $textMiniOcr; |
| 704 | 704 | } else { |
| 705 | - $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"'); |
|
| 705 | + $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"'); |
|
| 706 | 706 | } |
| 707 | 707 | return $fullText; |
| 708 | 708 | } |
@@ -770,10 +770,10 @@ discard block |
||
| 770 | 770 | $title = self::getTitle($partof, true); |
| 771 | 771 | } |
| 772 | 772 | } else { |
| 773 | - Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 773 | + Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING); |
|
| 774 | 774 | } |
| 775 | 775 | } else { |
| 776 | - Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR); |
|
| 776 | + Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR); |
|
| 777 | 777 | } |
| 778 | 778 | return $title; |
| 779 | 779 | } |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | // the actual loading is format specific |
| 909 | 909 | return $this->loadLocation($location); |
| 910 | 910 | } else { |
| 911 | - $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
|
| 911 | + $this->logger->error('Invalid file location "'.$location.'" for document loading'); |
|
| 912 | 912 | } |
| 913 | 913 | return false; |
| 914 | 914 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | // Retain current PID. |
| 1019 | 1019 | $pid = $this->pid; |
| 1020 | 1020 | } elseif (!$pid) { |
| 1021 | - $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
|
| 1021 | + $this->logger->error('Invalid PID '.$pid.' for document saving'); |
|
| 1022 | 1022 | return false; |
| 1023 | 1023 | } |
| 1024 | 1024 | // Set PID for metadata definitions. |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | if ($resArray = $result->fetch()) { |
| 1056 | 1056 | $structure = $resArray['uid']; |
| 1057 | 1057 | } else { |
| 1058 | - $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
|
| 1058 | + $this->logger->error('Could not identify document/structure type "'.$queryBuilder->expr()->literal($metadata['type'][0]).'"'); |
|
| 1059 | 1059 | return false; |
| 1060 | 1060 | } |
| 1061 | 1061 | $metadata['type'][0] = $structure; |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | if ($core) { |
| 1305 | 1305 | return Indexer::add($this, $core); |
| 1306 | 1306 | } else { |
| 1307 | - $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
|
| 1307 | + $this->logger->notice('Invalid UID "'.$core.'" for Solr core'); |
|
| 1308 | 1308 | return false; |
| 1309 | 1309 | } |
| 1310 | 1310 | } |
@@ -1382,7 +1382,7 @@ discard block |
||
| 1382 | 1382 | // Set metadata definitions' PID. |
| 1383 | 1383 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1384 | 1384 | if (!$cPid) { |
| 1385 | - $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions'); |
|
| 1385 | + $this->logger->error('Invalid PID '.$cPid.' for metadata definitions'); |
|
| 1386 | 1386 | return []; |
| 1387 | 1387 | } |
| 1388 | 1388 | if ( |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | // Document ready! |
| 1711 | 1711 | $this->ready = true; |
| 1712 | 1712 | } else { |
| 1713 | - $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
|
| 1713 | + $this->logger->error('No document with UID '.$uid.' found or document not accessible'); |
|
| 1714 | 1714 | } |
| 1715 | 1715 | } |
| 1716 | 1716 | |
@@ -1725,12 +1725,12 @@ discard block |
||
| 1725 | 1725 | */ |
| 1726 | 1726 | public function __get($var) |
| 1727 | 1727 | { |
| 1728 | - $method = '_get' . ucfirst($var); |
|
| 1728 | + $method = '_get'.ucfirst($var); |
|
| 1729 | 1729 | if ( |
| 1730 | 1730 | !property_exists($this, $var) |
| 1731 | 1731 | || !method_exists($this, $method) |
| 1732 | 1732 | ) { |
| 1733 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 1733 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 1734 | 1734 | return; |
| 1735 | 1735 | } else { |
| 1736 | 1736 | return $this->$method(); |
@@ -1763,12 +1763,12 @@ discard block |
||
| 1763 | 1763 | */ |
| 1764 | 1764 | public function __set($var, $value) |
| 1765 | 1765 | { |
| 1766 | - $method = '_set' . ucfirst($var); |
|
| 1766 | + $method = '_set'.ucfirst($var); |
|
| 1767 | 1767 | if ( |
| 1768 | 1768 | !property_exists($this, $var) |
| 1769 | 1769 | || !method_exists($this, $method) |
| 1770 | 1770 | ) { |
| 1771 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 1771 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 1772 | 1772 | } else { |
| 1773 | 1773 | $this->$method($value); |
| 1774 | 1774 | } |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | * @property-read mixed $uid This holds the UID or the URL of the document |
| 49 | 49 | * @abstract |
| 50 | 50 | */ |
| 51 | -abstract class Document |
|
| 52 | -{ |
|
| 51 | +abstract class Document { |
|
| 53 | 52 | /** |
| 54 | 53 | * This holds the logger |
| 55 | 54 | * |
@@ -341,8 +340,7 @@ discard block |
||
| 341 | 340 | * |
| 342 | 341 | * @return void |
| 343 | 342 | */ |
| 344 | - public static function clearRegistry() |
|
| 345 | - { |
|
| 343 | + public static function clearRegistry() { |
|
| 346 | 344 | // Reset registry array. |
| 347 | 345 | self::$registry = []; |
| 348 | 346 | } |
@@ -607,8 +605,7 @@ discard block |
||
| 607 | 605 | * |
| 608 | 606 | * @return int The physical page number |
| 609 | 607 | */ |
| 610 | - public function getPhysicalPage($logicalPage) |
|
| 611 | - { |
|
| 608 | + public function getPhysicalPage($logicalPage) { |
|
| 612 | 609 | if ( |
| 613 | 610 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
| 614 | 611 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -653,8 +650,7 @@ discard block |
||
| 653 | 650 | * |
| 654 | 651 | * @return string The OCR full text |
| 655 | 652 | */ |
| 656 | - protected function getFullTextFromXml($id) |
|
| 657 | - { |
|
| 653 | + protected function getFullTextFromXml($id) { |
|
| 658 | 654 | $fullText = ''; |
| 659 | 655 | // Load available text formats, ... |
| 660 | 656 | $this->loadFormats(); |
@@ -716,8 +712,7 @@ discard block |
||
| 716 | 712 | * |
| 717 | 713 | * @return string The format of the OCR full text |
| 718 | 714 | */ |
| 719 | - private function getTextFormat($fileContent) |
|
| 720 | - { |
|
| 715 | + private function getTextFormat($fileContent) { |
|
| 721 | 716 | // Get the root element's name as text format. |
| 722 | 717 | return strtoupper(Helper::getXmlFileAsString($fileContent)->getName()); |
| 723 | 718 | } |
@@ -734,8 +729,7 @@ discard block |
||
| 734 | 729 | * |
| 735 | 730 | * @return string The title of the document itself or a parent document |
| 736 | 731 | */ |
| 737 | - public static function getTitle($uid, $recursive = false) |
|
| 738 | - { |
|
| 732 | + public static function getTitle($uid, $recursive = false) { |
|
| 739 | 733 | $title = ''; |
| 740 | 734 | // Sanitize input. |
| 741 | 735 | $uid = max(intval($uid), 0); |
@@ -787,8 +781,7 @@ discard block |
||
| 787 | 781 | * |
| 788 | 782 | * @return array The logical structure node's / resource's parsed metadata array |
| 789 | 783 | */ |
| 790 | - public function getTitledata($cPid = 0) |
|
| 791 | - { |
|
| 784 | + public function getTitledata($cPid = 0) { |
|
| 792 | 785 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
| 793 | 786 | // Add information from METS structural map to titledata array. |
| 794 | 787 | if ($this instanceof MetsDocument) { |
@@ -821,8 +814,7 @@ discard block |
||
| 821 | 814 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
| 822 | 815 | * or the actual depth. |
| 823 | 816 | */ |
| 824 | - protected function getTreeDepth($structure, $depth, $logId) |
|
| 825 | - { |
|
| 817 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
| 826 | 818 | foreach ($structure as $element) { |
| 827 | 819 | if ($element['id'] == $logId) { |
| 828 | 820 | return $depth; |
@@ -844,8 +836,7 @@ discard block |
||
| 844 | 836 | * @param string $logId: The id of the logical structure element whose depth is requested |
| 845 | 837 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
| 846 | 838 | */ |
| 847 | - public function getStructureDepth($logId) |
|
| 848 | - { |
|
| 839 | + public function getStructureDepth($logId) { |
|
| 849 | 840 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
| 850 | 841 | } |
| 851 | 842 | |
@@ -895,8 +886,7 @@ discard block |
||
| 895 | 886 | * |
| 896 | 887 | * @return bool true on success or false on failure |
| 897 | 888 | */ |
| 898 | - protected function load($location) |
|
| 899 | - { |
|
| 889 | + protected function load($location) { |
|
| 900 | 890 | // Load XML / JSON-LD file. |
| 901 | 891 | if (GeneralUtility::isValidUrl($location)) { |
| 902 | 892 | // Load extension configuration |
@@ -929,8 +919,7 @@ discard block |
||
| 929 | 919 | * |
| 930 | 920 | * @return void |
| 931 | 921 | */ |
| 932 | - protected function loadFormats() |
|
| 933 | - { |
|
| 922 | + protected function loadFormats() { |
|
| 934 | 923 | if (!$this->formatsLoaded) { |
| 935 | 924 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 936 | 925 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -970,8 +959,7 @@ discard block |
||
| 970 | 959 | * |
| 971 | 960 | * @return void |
| 972 | 961 | */ |
| 973 | - public function registerNamespaces(&$obj) |
|
| 974 | - { |
|
| 962 | + public function registerNamespaces(&$obj) { |
|
| 975 | 963 | // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions. |
| 976 | 964 | $this->loadFormats(); |
| 977 | 965 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -1000,8 +988,7 @@ discard block |
||
| 1000 | 988 | * |
| 1001 | 989 | * @return bool true on success or false on failure |
| 1002 | 990 | */ |
| 1003 | - public function save($pid = 0, $core = 0, $owner = null) |
|
| 1004 | - { |
|
| 991 | + public function save($pid = 0, $core = 0, $owner = null) { |
|
| 1005 | 992 | if (\TYPO3_MODE !== 'BE') { |
| 1006 | 993 | $this->logger->error('Saving a document is only allowed in the backend'); |
| 1007 | 994 | return false; |
@@ -1329,8 +1316,7 @@ discard block |
||
| 1329 | 1316 | * |
| 1330 | 1317 | * @return int The PID of the metadata definitions |
| 1331 | 1318 | */ |
| 1332 | - protected function _getCPid() |
|
| 1333 | - { |
|
| 1319 | + protected function _getCPid() { |
|
| 1334 | 1320 | return $this->cPid; |
| 1335 | 1321 | } |
| 1336 | 1322 | |
@@ -1341,8 +1327,7 @@ discard block |
||
| 1341 | 1327 | * |
| 1342 | 1328 | * @return bool Are there any fulltext files available? |
| 1343 | 1329 | */ |
| 1344 | - protected function _getHasFulltext() |
|
| 1345 | - { |
|
| 1330 | + protected function _getHasFulltext() { |
|
| 1346 | 1331 | $this->ensureHasFulltextIsSet(); |
| 1347 | 1332 | return $this->hasFulltext; |
| 1348 | 1333 | } |
@@ -1354,8 +1339,7 @@ discard block |
||
| 1354 | 1339 | * |
| 1355 | 1340 | * @return string The location of the document |
| 1356 | 1341 | */ |
| 1357 | - protected function _getLocation() |
|
| 1358 | - { |
|
| 1342 | + protected function _getLocation() { |
|
| 1359 | 1343 | return $this->location; |
| 1360 | 1344 | } |
| 1361 | 1345 | |
@@ -1377,8 +1361,7 @@ discard block |
||
| 1377 | 1361 | * |
| 1378 | 1362 | * @return array Array of metadata with their corresponding logical structure node ID as key |
| 1379 | 1363 | */ |
| 1380 | - protected function _getMetadataArray() |
|
| 1381 | - { |
|
| 1364 | + protected function _getMetadataArray() { |
|
| 1382 | 1365 | // Set metadata definitions' PID. |
| 1383 | 1366 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
| 1384 | 1367 | if (!$cPid) { |
@@ -1403,8 +1386,7 @@ discard block |
||
| 1403 | 1386 | * |
| 1404 | 1387 | * @return int The total number of pages and/or tracks |
| 1405 | 1388 | */ |
| 1406 | - protected function _getNumPages() |
|
| 1407 | - { |
|
| 1389 | + protected function _getNumPages() { |
|
| 1408 | 1390 | $this->_getPhysicalStructure(); |
| 1409 | 1391 | return $this->numPages; |
| 1410 | 1392 | } |
@@ -1416,8 +1398,7 @@ discard block |
||
| 1416 | 1398 | * |
| 1417 | 1399 | * @return int The UID of the parent document or zero if not applicable |
| 1418 | 1400 | */ |
| 1419 | - protected function _getParentId() |
|
| 1420 | - { |
|
| 1401 | + protected function _getParentId() { |
|
| 1421 | 1402 | return $this->parentId; |
| 1422 | 1403 | } |
| 1423 | 1404 | |
@@ -1440,8 +1421,7 @@ discard block |
||
| 1440 | 1421 | * |
| 1441 | 1422 | * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order |
| 1442 | 1423 | */ |
| 1443 | - protected function _getPhysicalStructureInfo() |
|
| 1444 | - { |
|
| 1424 | + protected function _getPhysicalStructureInfo() { |
|
| 1445 | 1425 | // Is there no physical structure array yet? |
| 1446 | 1426 | if (!$this->physicalStructureLoaded) { |
| 1447 | 1427 | // Build physical structure array. |
@@ -1457,8 +1437,7 @@ discard block |
||
| 1457 | 1437 | * |
| 1458 | 1438 | * @return int The PID of the document or zero if not in database |
| 1459 | 1439 | */ |
| 1460 | - protected function _getPid() |
|
| 1461 | - { |
|
| 1440 | + protected function _getPid() { |
|
| 1462 | 1441 | return $this->pid; |
| 1463 | 1442 | } |
| 1464 | 1443 | |
@@ -1469,8 +1448,7 @@ discard block |
||
| 1469 | 1448 | * |
| 1470 | 1449 | * @return bool Is the document instantiated successfully? |
| 1471 | 1450 | */ |
| 1472 | - protected function _getReady() |
|
| 1473 | - { |
|
| 1451 | + protected function _getReady() { |
|
| 1474 | 1452 | return $this->ready; |
| 1475 | 1453 | } |
| 1476 | 1454 | |
@@ -1481,8 +1459,7 @@ discard block |
||
| 1481 | 1459 | * |
| 1482 | 1460 | * @return mixed The METS file's / IIIF manifest's record identifier |
| 1483 | 1461 | */ |
| 1484 | - protected function _getRecordId() |
|
| 1485 | - { |
|
| 1462 | + protected function _getRecordId() { |
|
| 1486 | 1463 | return $this->recordId; |
| 1487 | 1464 | } |
| 1488 | 1465 | |
@@ -1493,8 +1470,7 @@ discard block |
||
| 1493 | 1470 | * |
| 1494 | 1471 | * @return int The UID of the root document or zero if not applicable |
| 1495 | 1472 | */ |
| 1496 | - protected function _getRootId() |
|
| 1497 | - { |
|
| 1473 | + protected function _getRootId() { |
|
| 1498 | 1474 | if (!$this->rootIdLoaded) { |
| 1499 | 1475 | if ($this->parentId) { |
| 1500 | 1476 | $parent = self::getInstance($this->parentId, $this->pid); |
@@ -1524,8 +1500,7 @@ discard block |
||
| 1524 | 1500 | * |
| 1525 | 1501 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
| 1526 | 1502 | */ |
| 1527 | - protected function _getTableOfContents() |
|
| 1528 | - { |
|
| 1503 | + protected function _getTableOfContents() { |
|
| 1529 | 1504 | // Is there no logical structure array yet? |
| 1530 | 1505 | if (!$this->tableOfContentsLoaded) { |
| 1531 | 1506 | // Get all logical structures. |
@@ -1566,8 +1541,7 @@ discard block |
||
| 1566 | 1541 | * |
| 1567 | 1542 | * @return mixed The UID or the URL of the document |
| 1568 | 1543 | */ |
| 1569 | - protected function _getUid() |
|
| 1570 | - { |
|
| 1544 | + protected function _getUid() { |
|
| 1571 | 1545 | return $this->uid; |
| 1572 | 1546 | } |
| 1573 | 1547 | |
@@ -1580,8 +1554,7 @@ discard block |
||
| 1580 | 1554 | * |
| 1581 | 1555 | * @return void |
| 1582 | 1556 | */ |
| 1583 | - protected function _setCPid($value) |
|
| 1584 | - { |
|
| 1557 | + protected function _setCPid($value) { |
|
| 1585 | 1558 | $this->cPid = max(intval($value), 0); |
| 1586 | 1559 | } |
| 1587 | 1560 | |
@@ -1592,8 +1565,7 @@ discard block |
||
| 1592 | 1565 | * |
| 1593 | 1566 | * @return void |
| 1594 | 1567 | */ |
| 1595 | - protected function __clone() |
|
| 1596 | - { |
|
| 1568 | + protected function __clone() { |
|
| 1597 | 1569 | // This method is defined as protected because singleton objects should not be cloned. |
| 1598 | 1570 | } |
| 1599 | 1571 | |
@@ -1610,8 +1582,7 @@ discard block |
||
| 1610 | 1582 | * |
| 1611 | 1583 | * @return void |
| 1612 | 1584 | */ |
| 1613 | - protected function __construct($uid, $pid, $preloadedDocument) |
|
| 1614 | - { |
|
| 1585 | + protected function __construct($uid, $pid, $preloadedDocument) { |
|
| 1615 | 1586 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 1616 | 1587 | ->getQueryBuilderForTable('tx_dlf_documents'); |
| 1617 | 1588 | $location = ''; |
@@ -1723,8 +1694,7 @@ discard block |
||
| 1723 | 1694 | * |
| 1724 | 1695 | * @return mixed Value of $this->$var |
| 1725 | 1696 | */ |
| 1726 | - public function __get($var) |
|
| 1727 | - { |
|
| 1697 | + public function __get($var) { |
|
| 1728 | 1698 | $method = '_get' . ucfirst($var); |
| 1729 | 1699 | if ( |
| 1730 | 1700 | !property_exists($this, $var) |
@@ -1746,8 +1716,7 @@ discard block |
||
| 1746 | 1716 | * |
| 1747 | 1717 | * @return bool true if variable is set and not empty, false otherwise |
| 1748 | 1718 | */ |
| 1749 | - public function __isset($var) |
|
| 1750 | - { |
|
| 1719 | + public function __isset($var) { |
|
| 1751 | 1720 | return !empty($this->__get($var)); |
| 1752 | 1721 | } |
| 1753 | 1722 | |
@@ -1761,8 +1730,7 @@ discard block |
||
| 1761 | 1730 | * |
| 1762 | 1731 | * @return void |
| 1763 | 1732 | */ |
| 1764 | - public function __set($var, $value) |
|
| 1765 | - { |
|
| 1733 | + public function __set($var, $value) { |
|
| 1766 | 1734 | $method = '_set' . ucfirst($var); |
| 1767 | 1735 | if ( |
| 1768 | 1736 | !property_exists($this, $var) |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @var bool |
| 104 | 104 | * @access protected |
| 105 | 105 | */ |
| 106 | - protected $formatsLoaded = false; |
|
| 106 | + protected $formatsLoaded = FALSE; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * Are there any fulltext files available? This also includes IIIF text annotations |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @var bool |
| 114 | 114 | * @access protected |
| 115 | 115 | */ |
| 116 | - protected $hasFulltext = false; |
|
| 116 | + protected $hasFulltext = FALSE; |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Last searched logical and physical page |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @var array |
| 122 | 122 | * @access protected |
| 123 | 123 | */ |
| 124 | - protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null]; |
|
| 124 | + protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL]; |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * This holds the documents location |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @var bool |
| 156 | 156 | * @access protected |
| 157 | 157 | */ |
| 158 | - protected $metadataArrayLoaded = false; |
|
| 158 | + protected $metadataArrayLoaded = FALSE; |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * The holds the total number of pages |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @var bool |
| 197 | 197 | * @access protected |
| 198 | 198 | */ |
| 199 | - protected $physicalStructureLoaded = false; |
|
| 199 | + protected $physicalStructureLoaded = FALSE; |
|
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * This holds the PID of the document or zero if not in database |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @var bool |
| 222 | 222 | * @access protected |
| 223 | 223 | */ |
| 224 | - protected $ready = false; |
|
| 224 | + protected $ready = FALSE; |
|
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * The METS file's / IIIF manifest's record identifier |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @var bool |
| 256 | 256 | * @access protected |
| 257 | 257 | */ |
| 258 | - protected $rootIdLoaded = false; |
|
| 258 | + protected $rootIdLoaded = FALSE; |
|
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * This holds the smLinks between logical and physical structMap |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @var bool |
| 273 | 273 | * @access protected |
| 274 | 274 | */ |
| 275 | - protected $smLinksLoaded = false; |
|
| 275 | + protected $smLinksLoaded = FALSE; |
|
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * This holds the logical structure |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @var bool |
| 290 | 290 | * @access protected |
| 291 | 291 | */ |
| 292 | - protected $tableOfContentsLoaded = false; |
|
| 292 | + protected $tableOfContentsLoaded = FALSE; |
|
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * This holds the document's thumbnail location |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @var bool |
| 307 | 307 | * @access protected |
| 308 | 308 | */ |
| 309 | - protected $thumbnailLoaded = false; |
|
| 309 | + protected $thumbnailLoaded = FALSE; |
|
| 310 | 310 | |
| 311 | 311 | /** |
| 312 | 312 | * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest |
| 425 | 425 | */ |
| 426 | - public static function &getInstance($uid, $pid = 0, $forceReload = false) |
|
| 426 | + public static function &getInstance($uid, $pid = 0, $forceReload = FALSE) |
|
| 427 | 427 | { |
| 428 | 428 | // Sanitize input. |
| 429 | 429 | $pid = max(intval($pid), 0); |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | // Create new instance depending on format (METS or IIIF) ... |
| 466 | - $instance = null; |
|
| 467 | - $documentFormat = null; |
|
| 468 | - $xml = null; |
|
| 469 | - $iiif = null; |
|
| 466 | + $instance = NULL; |
|
| 467 | + $documentFormat = NULL; |
|
| 468 | + $xml = NULL; |
|
| 469 | + $iiif = NULL; |
|
| 470 | 470 | // Try to get document format from database |
| 471 | 471 | if (MathUtility::canBeInterpretedAsInteger($uid)) { |
| 472 | 472 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
@@ -515,17 +515,17 @@ discard block |
||
| 515 | 515 | @ini_set('user_agent', $extConf['useragent']); |
| 516 | 516 | } |
| 517 | 517 | $content = GeneralUtility::getUrl($location); |
| 518 | - if ($content !== false) { |
|
| 518 | + if ($content !== FALSE) { |
|
| 519 | 519 | $xml = Helper::getXmlFileAsString($content); |
| 520 | - if ($xml !== false) { |
|
| 520 | + if ($xml !== FALSE) { |
|
| 521 | 521 | /* @var $xml \SimpleXMLElement */ |
| 522 | 522 | $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/'); |
| 523 | 523 | $xpathResult = $xml->xpath('//mets:mets'); |
| 524 | - $documentFormat = !empty($xpathResult) ? 'METS' : null; |
|
| 524 | + $documentFormat = !empty($xpathResult) ? 'METS' : NULL; |
|
| 525 | 525 | } else { |
| 526 | 526 | // Try to load file as IIIF resource instead. |
| 527 | - $contentAsJsonArray = json_decode($content, true); |
|
| 528 | - if ($contentAsJsonArray !== null) { |
|
| 527 | + $contentAsJsonArray = json_decode($content, TRUE); |
|
| 528 | + if ($contentAsJsonArray !== NULL) { |
|
| 529 | 529 | // Load plugin configuration. |
| 530 | 530 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 531 | 531 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 582 | 582 | */ |
| 583 | - public abstract function getLogicalStructure($id, $recursive = false); |
|
| 583 | + public abstract function getLogicalStructure($id, $recursive = FALSE); |
|
| 584 | 584 | |
| 585 | 585 | /** |
| 586 | 586 | * This extracts all the metadata for a logical structure node |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | } else { |
| 618 | 618 | $physicalPage = 0; |
| 619 | 619 | foreach ($this->physicalStructureInfo as $page) { |
| 620 | - if (strpos($page['orderlabel'], $logicalPage) !== false) { |
|
| 620 | + if (strpos($page['orderlabel'], $logicalPage) !== FALSE) { |
|
| 621 | 621 | $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage; |
| 622 | 622 | $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage; |
| 623 | 623 | return $physicalPage; |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) { |
| 669 | 669 | // Get full text file. |
| 670 | 670 | $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])); |
| 671 | - if ($fileContent !== false) { |
|
| 671 | + if ($fileContent !== FALSE) { |
|
| 672 | 672 | $textFormat = $this->getTextFormat($fileContent); |
| 673 | 673 | } else { |
| 674 | 674 | $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"'); |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | * |
| 735 | 735 | * @return string The title of the document itself or a parent document |
| 736 | 736 | */ |
| 737 | - public static function getTitle($uid, $recursive = false) |
|
| 737 | + public static function getTitle($uid, $recursive = FALSE) |
|
| 738 | 738 | { |
| 739 | 739 | $title = ''; |
| 740 | 740 | // Sanitize input. |
@@ -767,7 +767,7 @@ discard block |
||
| 767 | 767 | && intval($partof) |
| 768 | 768 | && $partof != $uid |
| 769 | 769 | ) { |
| 770 | - $title = self::getTitle($partof, true); |
|
| 770 | + $title = self::getTitle($partof, TRUE); |
|
| 771 | 771 | } |
| 772 | 772 | } else { |
| 773 | 773 | Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING); |
@@ -828,12 +828,12 @@ discard block |
||
| 828 | 828 | return $depth; |
| 829 | 829 | } elseif (array_key_exists('children', $element)) { |
| 830 | 830 | $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId); |
| 831 | - if ($foundInChildren !== false) { |
|
| 831 | + if ($foundInChildren !== FALSE) { |
|
| 832 | 832 | return $foundInChildren; |
| 833 | 833 | } |
| 834 | 834 | } |
| 835 | 835 | } |
| 836 | - return false; |
|
| 836 | + return FALSE; |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | /** |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | } else { |
| 911 | 911 | $this->logger->error('Invalid file location "' . $location . '" for document loading'); |
| 912 | 912 | } |
| 913 | - return false; |
|
| 913 | + return FALSE; |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | 'class' => $resArray['class'] |
| 958 | 958 | ]; |
| 959 | 959 | } |
| 960 | - $this->formatsLoaded = true; |
|
| 960 | + $this->formatsLoaded = TRUE; |
|
| 961 | 961 | } |
| 962 | 962 | } |
| 963 | 963 | |
@@ -1000,11 +1000,11 @@ discard block |
||
| 1000 | 1000 | * |
| 1001 | 1001 | * @return bool true on success or false on failure |
| 1002 | 1002 | */ |
| 1003 | - public function save($pid = 0, $core = 0, $owner = null) |
|
| 1003 | + public function save($pid = 0, $core = 0, $owner = NULL) |
|
| 1004 | 1004 | { |
| 1005 | 1005 | if (\TYPO3_MODE !== 'BE') { |
| 1006 | 1006 | $this->logger->error('Saving a document is only allowed in the backend'); |
| 1007 | - return false; |
|
| 1007 | + return FALSE; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | // Make sure $pid is a non-negative integer. |
| 1010 | 1010 | $pid = max(intval($pid), 0); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $pid = $this->pid; |
| 1020 | 1020 | } elseif (!$pid) { |
| 1021 | 1021 | $this->logger->error('Invalid PID ' . $pid . ' for document saving'); |
| 1022 | - return false; |
|
| 1022 | + return FALSE; |
|
| 1023 | 1023 | } |
| 1024 | 1024 | // Set PID for metadata definitions. |
| 1025 | 1025 | $this->cPid = $pid; |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | // Check for record identifier. |
| 1033 | 1033 | if (empty($metadata['record_id'][0])) { |
| 1034 | 1034 | $this->logger->error('No record identifier found to avoid duplication'); |
| 1035 | - return false; |
|
| 1035 | + return FALSE; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | // Load plugin configuration. |
| 1038 | 1038 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | $structure = $resArray['uid']; |
| 1057 | 1057 | } else { |
| 1058 | 1058 | $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"'); |
| 1059 | - return false; |
|
| 1059 | + return FALSE; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | $metadata['type'][0] = $structure; |
| 1062 | 1062 | |
@@ -1116,9 +1116,9 @@ discard block |
||
| 1116 | 1116 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1117 | 1117 | Helper::addMessage( |
| 1118 | 1118 | htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])), |
| 1119 | - Helper::getMessage('flash.attention', true), |
|
| 1119 | + Helper::getMessage('flash.attention', TRUE), |
|
| 1120 | 1120 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
| 1121 | - true |
|
| 1121 | + TRUE |
|
| 1122 | 1122 | ); |
| 1123 | 1123 | } |
| 1124 | 1124 | } |
@@ -1169,9 +1169,9 @@ discard block |
||
| 1169 | 1169 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1170 | 1170 | Helper::addMessage( |
| 1171 | 1171 | htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)), |
| 1172 | - Helper::getMessage('flash.attention', true), |
|
| 1172 | + Helper::getMessage('flash.attention', TRUE), |
|
| 1173 | 1173 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
| 1174 | - true |
|
| 1174 | + TRUE |
|
| 1175 | 1175 | ); |
| 1176 | 1176 | } |
| 1177 | 1177 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | 'author' => implode('; ', $metadata['author']), |
| 1260 | 1260 | 'year' => implode('; ', $metadata['year']), |
| 1261 | 1261 | 'place' => implode('; ', $metadata['place']), |
| 1262 | - 'thumbnail' => $this->_getThumbnail(true), |
|
| 1262 | + 'thumbnail' => $this->_getThumbnail(TRUE), |
|
| 1263 | 1263 | 'metadata' => serialize($listed), |
| 1264 | 1264 | 'metadata_sorting' => serialize($sortable), |
| 1265 | 1265 | 'structure' => $metadata['type'][0], |
@@ -1295,9 +1295,9 @@ discard block |
||
| 1295 | 1295 | if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) { |
| 1296 | 1296 | Helper::addMessage( |
| 1297 | 1297 | htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)), |
| 1298 | - Helper::getMessage('flash.done', true), |
|
| 1298 | + Helper::getMessage('flash.done', TRUE), |
|
| 1299 | 1299 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
| 1300 | - true |
|
| 1300 | + TRUE |
|
| 1301 | 1301 | ); |
| 1302 | 1302 | } |
| 1303 | 1303 | // Add document to index. |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | return Indexer::add($this, $core); |
| 1306 | 1306 | } else { |
| 1307 | 1307 | $this->logger->notice('Invalid UID "' . $core . '" for Solr core'); |
| 1308 | - return false; |
|
| 1308 | + return FALSE; |
|
| 1309 | 1309 | } |
| 1310 | 1310 | } |
| 1311 | 1311 | |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | ) { |
| 1392 | 1392 | $this->prepareMetadataArray($cPid); |
| 1393 | 1393 | $this->metadataArray[0] = $cPid; |
| 1394 | - $this->metadataArrayLoaded = true; |
|
| 1394 | + $this->metadataArrayLoaded = TRUE; |
|
| 1395 | 1395 | } |
| 1396 | 1396 | return $this->metadataArray; |
| 1397 | 1397 | } |
@@ -1500,7 +1500,7 @@ discard block |
||
| 1500 | 1500 | $parent = self::getInstance($this->parentId, $this->pid); |
| 1501 | 1501 | $this->rootId = $parent->rootId; |
| 1502 | 1502 | } |
| 1503 | - $this->rootIdLoaded = true; |
|
| 1503 | + $this->rootIdLoaded = TRUE; |
|
| 1504 | 1504 | } |
| 1505 | 1505 | return $this->rootId; |
| 1506 | 1506 | } |
@@ -1529,8 +1529,8 @@ discard block |
||
| 1529 | 1529 | // Is there no logical structure array yet? |
| 1530 | 1530 | if (!$this->tableOfContentsLoaded) { |
| 1531 | 1531 | // Get all logical structures. |
| 1532 | - $this->getLogicalStructure('', true); |
|
| 1533 | - $this->tableOfContentsLoaded = true; |
|
| 1532 | + $this->getLogicalStructure('', TRUE); |
|
| 1533 | + $this->tableOfContentsLoaded = TRUE; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | return $this->tableOfContents; |
| 1536 | 1536 | } |
@@ -1546,7 +1546,7 @@ discard block |
||
| 1546 | 1546 | * |
| 1547 | 1547 | * @return string The document's thumbnail location |
| 1548 | 1548 | */ |
| 1549 | - protected abstract function _getThumbnail($forceReload = false); |
|
| 1549 | + protected abstract function _getThumbnail($forceReload = FALSE); |
|
| 1550 | 1550 | |
| 1551 | 1551 | /** |
| 1552 | 1552 | * This returns the ID of the toplevel logical structure node |
@@ -1627,7 +1627,7 @@ discard block |
||
| 1627 | 1627 | && $this->load($uid))) { |
| 1628 | 1628 | // Initialize core METS object. |
| 1629 | 1629 | $this->init(); |
| 1630 | - if ($this->getDocument() !== null) { |
|
| 1630 | + if ($this->getDocument() !== NULL) { |
|
| 1631 | 1631 | // Cast to string for safety reasons. |
| 1632 | 1632 | $location = (string) $uid; |
| 1633 | 1633 | $this->establishRecordId($pid); |
@@ -1685,30 +1685,30 @@ discard block |
||
| 1685 | 1685 | $this->parentId = $resArray['partof']; |
| 1686 | 1686 | $this->thumbnail = $resArray['thumbnail']; |
| 1687 | 1687 | $this->location = $resArray['location']; |
| 1688 | - $this->thumbnailLoaded = true; |
|
| 1688 | + $this->thumbnailLoaded = TRUE; |
|
| 1689 | 1689 | // Load XML file if necessary... |
| 1690 | 1690 | if ( |
| 1691 | - $this->getDocument() === null |
|
| 1691 | + $this->getDocument() === NULL |
|
| 1692 | 1692 | && $this->load($this->location) |
| 1693 | 1693 | ) { |
| 1694 | 1694 | // ...and set some basic properties. |
| 1695 | 1695 | $this->init(); |
| 1696 | 1696 | } |
| 1697 | 1697 | // Do we have a METS / IIIF object now? |
| 1698 | - if ($this->getDocument() !== null) { |
|
| 1698 | + if ($this->getDocument() !== NULL) { |
|
| 1699 | 1699 | // Set new location if necessary. |
| 1700 | 1700 | if (!empty($location)) { |
| 1701 | 1701 | $this->location = $location; |
| 1702 | 1702 | } |
| 1703 | 1703 | // Document ready! |
| 1704 | - $this->ready = true; |
|
| 1704 | + $this->ready = TRUE; |
|
| 1705 | 1705 | } |
| 1706 | - } elseif ($this->getDocument() !== null) { |
|
| 1706 | + } elseif ($this->getDocument() !== NULL) { |
|
| 1707 | 1707 | // Set location as UID for documents not in database. |
| 1708 | 1708 | $this->uid = $location; |
| 1709 | 1709 | $this->location = $location; |
| 1710 | 1710 | // Document ready! |
| 1711 | - $this->ready = true; |
|
| 1711 | + $this->ready = TRUE; |
|
| 1712 | 1712 | } else { |
| 1713 | 1713 | $this->logger->error('No document with UID ' . $uid . ' found or document not accessible'); |
| 1714 | 1714 | } |
@@ -25,8 +25,7 @@ discard block |
||
| 25 | 25 | * @subpackage dlf |
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | -class Helper |
|
| 29 | -{ |
|
| 28 | +class Helper { |
|
| 30 | 29 | /** |
| 31 | 30 | * The extension key |
| 32 | 31 | * |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * |
| 75 | 74 | * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to |
| 76 | 75 | */ |
| 77 | - public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') |
|
| 78 | - { |
|
| 76 | + public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') { |
|
| 79 | 77 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 80 | 78 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 81 | 79 | $flashMessage = GeneralUtility::makeInstance( |
@@ -100,8 +98,7 @@ discard block |
||
| 100 | 98 | * |
| 101 | 99 | * @return bool Is $id a valid GNL identifier of the given $type? |
| 102 | 100 | */ |
| 103 | - public static function checkIdentifier($id, $type) |
|
| 104 | - { |
|
| 101 | + public static function checkIdentifier($id, $type) { |
|
| 105 | 102 | $digits = substr($id, 0, 8); |
| 106 | 103 | $checksum = 0; |
| 107 | 104 | for ($i = 0, $j = strlen($digits); $i < $j; $i++) { |
@@ -165,8 +162,7 @@ discard block |
||
| 165 | 162 | * |
| 166 | 163 | * @return mixed The decrypted value or false on error |
| 167 | 164 | */ |
| 168 | - public static function decrypt($encrypted) |
|
| 169 | - { |
|
| 165 | + public static function decrypt($encrypted) { |
|
| 170 | 166 | if ( |
| 171 | 167 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 172 | 168 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -204,8 +200,7 @@ discard block |
||
| 204 | 200 | * |
| 205 | 201 | * @return mixed |
| 206 | 202 | */ |
| 207 | - public static function getXmlFileAsString($content) |
|
| 208 | - { |
|
| 203 | + public static function getXmlFileAsString($content) { |
|
| 209 | 204 | // Turn off libxml's error logging. |
| 210 | 205 | $libxmlErrors = libxml_use_internal_errors(true); |
| 211 | 206 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
@@ -230,8 +225,7 @@ discard block |
||
| 230 | 225 | * |
| 231 | 226 | * @return void |
| 232 | 227 | */ |
| 233 | - public static function log($message, $severity = 0) |
|
| 234 | - { |
|
| 228 | + public static function log($message, $severity = 0) { |
|
| 235 | 229 | $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class()); |
| 236 | 230 | |
| 237 | 231 | switch ($severity) { |
@@ -261,8 +255,7 @@ discard block |
||
| 261 | 255 | * |
| 262 | 256 | * @return mixed Hashed string or false on error |
| 263 | 257 | */ |
| 264 | - public static function digest($string) |
|
| 265 | - { |
|
| 258 | + public static function digest($string) { |
|
| 266 | 259 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
| 267 | 260 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
| 268 | 261 | return false; |
@@ -281,8 +274,7 @@ discard block |
||
| 281 | 274 | * |
| 282 | 275 | * @return mixed Encrypted string or false on error |
| 283 | 276 | */ |
| 284 | - public static function encrypt($string) |
|
| 285 | - { |
|
| 277 | + public static function encrypt($string) { |
|
| 286 | 278 | if ( |
| 287 | 279 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
| 288 | 280 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -315,8 +307,7 @@ discard block |
||
| 315 | 307 | * |
| 316 | 308 | * @return string The unqualified class name |
| 317 | 309 | */ |
| 318 | - public static function getUnqualifiedClassName($qualifiedClassname) |
|
| 319 | - { |
|
| 310 | + public static function getUnqualifiedClassName($qualifiedClassname) { |
|
| 320 | 311 | $nameParts = explode('\\', $qualifiedClassname); |
| 321 | 312 | return end($nameParts); |
| 322 | 313 | } |
@@ -330,8 +321,7 @@ discard block |
||
| 330 | 321 | * |
| 331 | 322 | * @return string The cleaned up string |
| 332 | 323 | */ |
| 333 | - public static function getCleanString($string) |
|
| 334 | - { |
|
| 324 | + public static function getCleanString($string) { |
|
| 335 | 325 | // Convert to lowercase. |
| 336 | 326 | $string = strtolower($string); |
| 337 | 327 | // Remove non-alphanumeric characters. |
@@ -352,8 +342,7 @@ discard block |
||
| 352 | 342 | * |
| 353 | 343 | * @return array Array of hook objects for the class |
| 354 | 344 | */ |
| 355 | - public static function getHookObjects($scriptRelPath) |
|
| 356 | - { |
|
| 345 | + public static function getHookObjects($scriptRelPath) { |
|
| 357 | 346 | $hookObjects = []; |
| 358 | 347 | if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
| 359 | 348 | foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
@@ -374,8 +363,7 @@ discard block |
||
| 374 | 363 | * |
| 375 | 364 | * @return string "index_name" for the given UID |
| 376 | 365 | */ |
| 377 | - public static function getIndexNameFromUid($uid, $table, $pid = -1) |
|
| 378 | - { |
|
| 366 | + public static function getIndexNameFromUid($uid, $table, $pid = -1) { |
|
| 379 | 367 | // Sanitize input. |
| 380 | 368 | $uid = max(intval($uid), 0); |
| 381 | 369 | if ( |
@@ -427,8 +415,7 @@ discard block |
||
| 427 | 415 | * |
| 428 | 416 | * @return string "label" for the given UID |
| 429 | 417 | */ |
| 430 | - public static function getLabelFromUid($uid, $table, $pid = -1) |
|
| 431 | - { |
|
| 418 | + public static function getLabelFromUid($uid, $table, $pid = -1) { |
|
| 432 | 419 | // Sanitize input. |
| 433 | 420 | $uid = max(intval($uid), 0); |
| 434 | 421 | if ( |
@@ -478,8 +465,7 @@ discard block |
||
| 478 | 465 | * |
| 479 | 466 | * @return string Localized full name of language or unchanged input |
| 480 | 467 | */ |
| 481 | - public static function getLanguageName($code) |
|
| 482 | - { |
|
| 468 | + public static function getLanguageName($code) { |
|
| 483 | 469 | // Analyze code and set appropriate ISO table. |
| 484 | 470 | $isoCode = strtolower(trim($code)); |
| 485 | 471 | if (preg_match('/^[a-z]{3}$/', $isoCode)) { |
@@ -524,8 +510,7 @@ discard block |
||
| 524 | 510 | * |
| 525 | 511 | * @return string The translated string or the given key on failure |
| 526 | 512 | */ |
| 527 | - public static function getMessage($key, $hsc = false, $default = '') |
|
| 528 | - { |
|
| 513 | + public static function getMessage($key, $hsc = false, $default = '') { |
|
| 529 | 514 | // Set initial output to default value. |
| 530 | 515 | $translated = (string) $default; |
| 531 | 516 | // Load common messages file. |
@@ -567,8 +552,7 @@ discard block |
||
| 567 | 552 | * |
| 568 | 553 | * @return string "uid" for the given index_name |
| 569 | 554 | */ |
| 570 | - public static function getUidFromIndexName($index_name, $table, $pid = -1) |
|
| 571 | - { |
|
| 555 | + public static function getUidFromIndexName($index_name, $table, $pid = -1) { |
|
| 572 | 556 | if ( |
| 573 | 557 | !$index_name |
| 574 | 558 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
@@ -619,8 +603,7 @@ discard block |
||
| 619 | 603 | * |
| 620 | 604 | * @return string Uniform Resource Name as string |
| 621 | 605 | */ |
| 622 | - public static function getURN($base, $id) |
|
| 623 | - { |
|
| 606 | + public static function getURN($base, $id) { |
|
| 624 | 607 | $concordance = [ |
| 625 | 608 | '0' => 1, |
| 626 | 609 | '1' => 2, |
@@ -687,8 +670,7 @@ discard block |
||
| 687 | 670 | * |
| 688 | 671 | * @return bool Is $id a valid PPN? |
| 689 | 672 | */ |
| 690 | - public static function isPPN($id) |
|
| 691 | - { |
|
| 673 | + public static function isPPN($id) { |
|
| 692 | 674 | return self::checkIdentifier($id, 'PPN'); |
| 693 | 675 | } |
| 694 | 676 | |
@@ -701,8 +683,7 @@ discard block |
||
| 701 | 683 | * |
| 702 | 684 | * @return mixed Session value for given key or null on failure |
| 703 | 685 | */ |
| 704 | - public static function loadFromSession($key) |
|
| 705 | - { |
|
| 686 | + public static function loadFromSession($key) { |
|
| 706 | 687 | // Cast to string for security reasons. |
| 707 | 688 | $key = (string) $key; |
| 708 | 689 | if (!$key) { |
@@ -734,8 +715,7 @@ discard block |
||
| 734 | 715 | * |
| 735 | 716 | * @return array Merged array |
| 736 | 717 | */ |
| 737 | - public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) |
|
| 738 | - { |
|
| 718 | + public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) { |
|
| 739 | 719 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature); |
| 740 | 720 | return $original; |
| 741 | 721 | } |
@@ -752,8 +732,7 @@ discard block |
||
| 752 | 732 | * |
| 753 | 733 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
| 754 | 734 | */ |
| 755 | - public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
| 756 | - { |
|
| 735 | + public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
| 757 | 736 | if ( |
| 758 | 737 | \TYPO3_MODE === 'BE' |
| 759 | 738 | && $GLOBALS['BE_USER']->isAdmin() |
@@ -799,8 +778,7 @@ discard block |
||
| 799 | 778 | * |
| 800 | 779 | * @return string All flash messages in the queue rendered as HTML. |
| 801 | 780 | */ |
| 802 | - public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') |
|
| 803 | - { |
|
| 781 | + public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') { |
|
| 804 | 782 | $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class); |
| 805 | 783 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
| 806 | 784 | $flashMessages = $flashMessageQueue->getAllMessagesAndFlush(); |
@@ -819,8 +797,7 @@ discard block |
||
| 819 | 797 | * |
| 820 | 798 | * @return bool true on success, false on failure |
| 821 | 799 | */ |
| 822 | - public static function saveToSession($value, $key) |
|
| 823 | - { |
|
| 800 | + public static function saveToSession($value, $key) { |
|
| 824 | 801 | // Cast to string for security reasons. |
| 825 | 802 | $key = (string) $key; |
| 826 | 803 | if (!$key) { |
@@ -852,8 +829,7 @@ discard block |
||
| 852 | 829 | * |
| 853 | 830 | * @return string Localized label for $index_name |
| 854 | 831 | */ |
| 855 | - public static function translate($index_name, $table, $pid) |
|
| 856 | - { |
|
| 832 | + public static function translate($index_name, $table, $pid) { |
|
| 857 | 833 | // Load labels into static variable for future use. |
| 858 | 834 | static $labels = []; |
| 859 | 835 | // Sanitize input. |
@@ -976,8 +952,7 @@ discard block |
||
| 976 | 952 | * |
| 977 | 953 | * @return string Additional WHERE expression |
| 978 | 954 | */ |
| 979 | - public static function whereExpression($table, $showHidden = false) |
|
| 980 | - { |
|
| 955 | + public static function whereExpression($table, $showHidden = false) { |
|
| 981 | 956 | if (\TYPO3_MODE === 'FE') { |
| 982 | 957 | // Should we ignore the record's hidden flag? |
| 983 | 958 | $ignoreHide = 0; |
@@ -1006,8 +981,7 @@ discard block |
||
| 1006 | 981 | * |
| 1007 | 982 | * @access private |
| 1008 | 983 | */ |
| 1009 | - private function __construct() |
|
| 1010 | - { |
|
| 984 | + private function __construct() { |
|
| 1011 | 985 | // This is a static class, thus no instances should be created. |
| 1012 | 986 | } |
| 1013 | 987 | } |