@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function __construct(string $viaf, RequestFactory $requestFactory) |
| 66 | 66 | { |
| 67 | 67 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
| 68 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
| 68 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
| 69 | 69 | $this->requestFactory = $requestFactory; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | try { |
| 96 | 96 | $response = $this->requestFactory->request($url); |
| 97 | 97 | } catch (\Exception $e) { |
| 98 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
| 98 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | 101 | return $response->getBody()->getContents(); |
@@ -110,6 +110,6 @@ discard block |
||
| 110 | 110 | **/ |
| 111 | 111 | private function getApiEndpoint(): string |
| 112 | 112 | { |
| 113 | - return $this->viafUrl . '/' . $this->endpoint; |
|
| 113 | + return $this->viafUrl.'/'.$this->endpoint; |
|
| 114 | 114 | } |
| 115 | 115 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | try { |
| 112 | 112 | $response = $this->requestFactory->request($url); |
| 113 | 113 | } catch (\Exception $e) { |
| 114 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
| 114 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | return $response->getBody()->getContents(); |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | **/ |
| 127 | 127 | private function getApiEndpoint(): string |
| 128 | 128 | { |
| 129 | - $url = 'https://' . $this->level . '.' . self::HOSTNAME; |
|
| 130 | - $url .= '/v' . self::VERSION . '/'; |
|
| 129 | + $url = 'https://'.$this->level.'.'.self::HOSTNAME; |
|
| 130 | + $url .= '/v'.self::VERSION.'/'; |
|
| 131 | 131 | $url .= $this->orcid; |
| 132 | - $url .= '/' . $this->endpoint; |
|
| 132 | + $url .= '/'.$this->endpoint; |
|
| 133 | 133 | return $url; |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -653,16 +653,16 @@ discard block |
||
| 653 | 653 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 654 | 654 | $values = $iiifResource->jsonPath($resArray['xpath_sorting']); |
| 655 | 655 | if (is_string($values)) { |
| 656 | - $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
|
| 656 | + $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)]; |
|
| 657 | 657 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
| 658 | 658 | $metadata[$resArray['index_name']] = []; |
| 659 | 659 | foreach ($values->data() as $value) { |
| 660 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value); |
|
| 660 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | } |
| 664 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
| 665 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 664 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
| 665 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | } |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | 774 | } else { |
| 775 | - $this->logger->warning('Invalid structure resource @id "' . $id . '"'); |
|
| 775 | + $this->logger->warning('Invalid structure resource @id "'.$id.'"'); |
|
| 776 | 776 | return $rawText; |
| 777 | 777 | } |
| 778 | 778 | $this->rawTextArray[$id] = $rawText; |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | return true; |
| 818 | 818 | } |
| 819 | 819 | } |
| 820 | - $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
|
| 820 | + $this->logger->error('Could not load IIIF manifest from "'.$location.'"'); |
|
| 821 | 821 | return false; |
| 822 | 822 | } |
| 823 | 823 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $this->xEndPosition = $highlight['lrx']; |
| 88 | 88 | $this->yBeginPosition = $highlight['uly']; |
| 89 | 89 | $this->yEndPosition = $highlight['lry']; |
| 90 | - $this->id = $this->xBeginPosition . '_' . $this->yBeginPosition; |
|
| 90 | + $this->id = $this->xBeginPosition.'_'.$this->yBeginPosition; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | // Get next available core name if none given. |
| 129 | 129 | if (empty($core)) { |
| 130 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
| 130 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
| 131 | 131 | } |
| 132 | 132 | // Get Solr service instance. |
| 133 | 133 | $solr = self::getInstance($core); |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | ->execute(); |
| 218 | 218 | |
| 219 | 219 | while ($resArray = $result->fetchAssociative()) { |
| 220 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
| 220 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Check if queried field is valid. |
| 224 | 224 | $splitQuery = explode(':', $query, 2); |
| 225 | 225 | if (in_array($splitQuery[0], $fields)) { |
| 226 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
| 226 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
| 227 | 227 | } else { |
| 228 | 228 | $query = self::escapeQuery($query); |
| 229 | 229 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | $number = max($number, 0); |
| 332 | 332 | // Check if core already exists. |
| 333 | - $solr = self::getInstance('dlfCore' . $number); |
|
| 333 | + $solr = self::getInstance('dlfCore'.$number); |
|
| 334 | 334 | if (!$solr->ready) { |
| 335 | 335 | return $number; |
| 336 | 336 | } else { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $parameters['start'] = 0; |
| 389 | 389 | $parameters['rows'] = $this->limit; |
| 390 | 390 | // Calculate cache identifier. |
| 391 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
| 391 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
| 392 | 392 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 393 | 393 | $resultSet = []; |
| 394 | 394 | $entry = $cache->get($cacheIdentifier); |
@@ -520,12 +520,12 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | public function __get(string $var) |
| 522 | 522 | { |
| 523 | - $method = 'magicGet' . ucfirst($var); |
|
| 523 | + $method = 'magicGet'.ucfirst($var); |
|
| 524 | 524 | if ( |
| 525 | 525 | !property_exists($this, $var) |
| 526 | 526 | || !method_exists($this, $method) |
| 527 | 527 | ) { |
| 528 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
| 528 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
| 529 | 529 | return null; |
| 530 | 530 | } else { |
| 531 | 531 | return $this->$method(); |
@@ -558,12 +558,12 @@ discard block |
||
| 558 | 558 | */ |
| 559 | 559 | public function __set(string $var, $value): void |
| 560 | 560 | { |
| 561 | - $method = 'magicSet' . ucfirst($var); |
|
| 561 | + $method = 'magicSet'.ucfirst($var); |
|
| 562 | 562 | if ( |
| 563 | 563 | !property_exists($this, $var) |
| 564 | 564 | || !method_exists($this, $method) |
| 565 | 565 | ) { |
| 566 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
| 566 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
| 567 | 567 | } else { |
| 568 | 568 | $this->$method($value); |
| 569 | 569 | } |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | 'scheme' => $this->config['scheme'], |
| 604 | 604 | 'host' => $this->config['host'], |
| 605 | 605 | 'port' => $this->config['port'], |
| 606 | - 'path' => '/' . $this->config['path'], |
|
| 606 | + 'path' => '/'.$this->config['path'], |
|
| 607 | 607 | 'core' => $core, |
| 608 | 608 | 'username' => $this->config['username'], |
| 609 | 609 | 'password' => $this->config['password'] |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // in which case metadata of toplevel entry isn't yet filled. |
| 221 | 221 | if (empty($document['metadata'])) { |
| 222 | 222 | $document['metadata'] = $this->fetchToplevelMetadataFromSolr([ |
| 223 | - 'query' => 'uid:' . $document['uid'], |
|
| 223 | + 'query' => 'uid:'.$document['uid'], |
|
| 224 | 224 | 'start' => 0, |
| 225 | 225 | 'rows' => 1, |
| 226 | 226 | 'sort' => ['score' => 'desc'], |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if (empty($document['title']) && $document['partOf'] > 0) { |
| 232 | 232 | $superiorTitle = AbstractDocument::getTitle($document['partOf'], true); |
| 233 | 233 | if (!empty($superiorTitle)) { |
| 234 | - $document['title'] = '[' . $superiorTitle . ']'; |
|
| 234 | + $document['title'] = '['.$superiorTitle.']'; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -366,13 +366,13 @@ discard block |
||
| 366 | 366 | // Set search query. |
| 367 | 367 | if ( |
| 368 | 368 | (!empty($this->searchParams['fulltext'])) |
| 369 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 369 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches) |
|
| 370 | 370 | ) { |
| 371 | 371 | // If the query already is a fulltext query e.g using the facets |
| 372 | 372 | $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1]; |
| 373 | 373 | // Search in fulltext field if applicable. Query must not be empty! |
| 374 | 374 | if (!empty($this->searchParams['query'])) { |
| 375 | - $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')'; |
|
| 375 | + $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')'; |
|
| 376 | 376 | } |
| 377 | 377 | $params['fulltext'] = true; |
| 378 | 378 | } else { |
@@ -395,9 +395,9 @@ discard block |
||
| 395 | 395 | in_array($this->searchParams['extOperator'][$i], $allowedOperators) |
| 396 | 396 | ) { |
| 397 | 397 | if (!empty($query)) { |
| 398 | - $query .= ' ' . $this->searchParams['extOperator'][$i] . ' '; |
|
| 398 | + $query .= ' '.$this->searchParams['extOperator'][$i].' '; |
|
| 399 | 399 | } |
| 400 | - $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')'; |
|
| 400 | + $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')'; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | // Add filter query for date search |
| 407 | 407 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
| 408 | 408 | // combine dateFrom and dateTo into range search |
| 409 | - $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
| 409 | + $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // Add filter query for faceting. |
@@ -423,12 +423,12 @@ discard block |
||
| 423 | 423 | ) { |
| 424 | 424 | // Search in document and all subordinates (valid for up to three levels of hierarchy). |
| 425 | 425 | $params['filterquery'][]['query'] = '_query_:"{!join from=' |
| 426 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 427 | - . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 428 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from=' |
|
| 429 | - . $fields['uid'] . ' to=' . $fields['partof'] . '}' |
|
| 430 | - . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR ' |
|
| 431 | - . $fields['uid'] . ':' . $this->searchParams['documentId']; |
|
| 426 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 427 | + . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}' |
|
| 428 | + . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from=' |
|
| 429 | + . $fields['uid'].' to='.$fields['partof'].'}' |
|
| 430 | + . $fields['uid'].':'.$this->searchParams['documentId'].' OR ' |
|
| 431 | + . $fields['uid'].':'.$this->searchParams['documentId']; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | // if collections are given, we prepare the collection query string |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | if ($this->listedMetadata) { |
| 449 | 449 | foreach ($this->listedMetadata as $metadata) { |
| 450 | 450 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 451 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 452 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 451 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 452 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 453 | 453 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 454 | 454 | } |
| 455 | 455 | } |
@@ -524,8 +524,8 @@ discard block |
||
| 524 | 524 | if ($this->searchParams['fulltext'] == '1') { |
| 525 | 525 | $searchResult['snippet'] = $doc['snippet']; |
| 526 | 526 | $searchResult['highlight'] = $doc['highlight']; |
| 527 | - $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end |
|
| 528 | - preg_replace('/;+/', ';', // replace any multiple of ; with a single ; |
|
| 527 | + $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end |
|
| 528 | + preg_replace('/;+/', ';', // replace any multiple of ; with a single ; |
|
| 529 | 529 | preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ; |
| 530 | 530 | } |
| 531 | 531 | $documents[$doc['uid']]['searchResults'][] = $searchResult; |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | // Fetch metadata for the current batch |
| 551 | 551 | $metadataOf = $this->fetchToplevelMetadataFromSolr([ |
| 552 | - 'query' => 'partof:' . $doc['uid'], |
|
| 552 | + 'query' => 'partof:'.$doc['uid'], |
|
| 553 | 553 | 'start' => $start, |
| 554 | 554 | 'rows' => min($batchSize, $totalChildren - $start), |
| 555 | 555 | ]); |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | if ($this->listedMetadata) { |
| 602 | 602 | foreach ($this->listedMetadata as $metadata) { |
| 603 | 603 | if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) { |
| 604 | - $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 605 | - $params['fields'] .= ',' . $listMetadataRecord; |
|
| 604 | + $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u'); |
|
| 605 | + $params['fields'] .= ','.$listMetadataRecord; |
|
| 606 | 606 | $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord; |
| 607 | 607 | } |
| 608 | 608 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $cache = null; |
| 654 | 654 | // Calculate cache identifier. |
| 655 | 655 | if ($enableCache === true) { |
| 656 | - $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true)); |
|
| 656 | + $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true)); |
|
| 657 | 657 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
| 658 | 658 | } |
| 659 | 659 | $resultSet = [ |
@@ -742,24 +742,24 @@ discard block |
||
| 742 | 742 | foreach ($this->collections as $collection) { |
| 743 | 743 | // check for virtual collections query string |
| 744 | 744 | if ($collection->getIndexSearch()) { |
| 745 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')'; |
|
| 745 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collection->getIndexSearch().')' : ' OR ('.$collection->getIndexSearch().')'; |
|
| 746 | 746 | } else { |
| 747 | - $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"'; |
|
| 747 | + $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collection->getIndexName().'"' : ' OR "'.$collection->getIndexName().'"'; |
|
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | // distinguish between simple collection browsing and actual searching within the collection(s) |
| 752 | 752 | if (!empty($collectionsQueryString)) { |
| 753 | 753 | if (empty($query)) { |
| 754 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
|
| 754 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)'; |
|
| 755 | 755 | } else { |
| 756 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
|
| 756 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))'; |
|
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately |
| 761 | 761 | if (!empty($virtualCollectionsQueryString)) { |
| 762 | - $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
|
| 762 | + $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')'; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | // combine both query strings into a single filterquery via OR if both are given, otherwise pass either of those |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | private function translateLanguageCode(&$doc): void |
| 838 | 838 | { |
| 839 | 839 | if ($doc['metadata']['language']) { |
| 840 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
| 840 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
| 841 | 841 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language); |
| 842 | 842 | } |
| 843 | 843 | } |
@@ -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 | } |
@@ -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(); |
@@ -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 |