Passed
Pull Request — master (#123)
by
unknown
04:03
created
Classes/Common/Solr/SearchResult/Highlight.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @access public
22 22
  */
23
-class Highlight
24
-{
23
+class Highlight {
25 24
 
26 25
     /**
27 26
      * @access private
@@ -62,8 +61,7 @@  discard block
 block discarded – undo
62 61
      *
63 62
      * @return void
64 63
      */
65
-    public function __construct(array $highlight)
66
-    {
64
+    public function __construct(array $highlight) {
67 65
         // there is also possibility to access parentRegionIdx
68 66
         // $this->parentRegionId = $highlight['parentRegionIdx'];
69 67
         $this->xBeginPosition = $highlight['ulx'];
Please login to merge, or discard this patch.
Classes/Common/Solr/SearchResult/ResultDocument.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @access public
24 24
  */
25
-class ResultDocument
26
-{
25
+class ResultDocument {
27 26
 
28 27
     /**
29 28
      * @access private
@@ -108,8 +107,7 @@  discard block
 block discarded – undo
108 107
      *
109 108
      * @return void
110 109
      */
111
-    public function __construct(Document $record, array $highlighting, array $fields)
112
-    {
110
+    public function __construct(Document $record, array $highlighting, array $fields) {
113 111
         $this->id = $record[$fields['id']];
114 112
         $this->uid = $record[$fields['uid']];
115 113
         $this->page = $record[$fields['page']];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @access private
66 66
      * @var bool It's a toplevel element?
67 67
      */
68
-    private bool $toplevel = false;
68
+    private bool $toplevel = FALSE;
69 69
 
70 70
     /**
71 71
      * @access private
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $this->page = $record[$fields['page']];
116 116
         $this->thumbnail = $record[$fields['thumbnail']];
117 117
         $this->title = $record[$fields['title']];
118
-        $this->toplevel = $record[$fields['toplevel']] ?? false;
118
+        $this->toplevel = $record[$fields['toplevel']] ?? FALSE;
119 119
         $this->type = $record[$fields['type']];
120 120
 
121 121
         if (!empty($highlighting[$this->id])) {
Please login to merge, or discard this patch.
Classes/Common/Solr/Solr.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@  discard block
 block discarded – undo
42 42
  * @property-read bool $ready flag if the Solr service is instantiated successfully
43 43
  * @property-read Client $service this holds the Solr service object
44 44
  */
45
-class Solr implements LoggerAwareInterface
46
-{
45
+class Solr implements LoggerAwareInterface {
47 46
     use LoggerAwareTrait;
48 47
 
49 48
     /**
@@ -518,8 +517,7 @@  discard block
 block discarded – undo
518 517
      *
519 518
      * @return mixed Value of $this->$var
520 519
      */
521
-    public function __get(string $var)
522
-    {
520
+    public function __get(string $var) {
523 521
         $method = 'magicGet' . ucfirst($var);
524 522
         if (
525 523
             !property_exists($this, $var)
@@ -578,8 +576,7 @@  discard block
 block discarded – undo
578 576
      *
579 577
      * @return void
580 578
      */
581
-    protected function __construct(?string $core)
582
-    {
579
+    protected function __construct(?string $core) {
583 580
         // Solarium requires different code for version 5 and 6.
584 581
         $isSolarium5 = Client::checkExact('5');
585 582
         // Get Solr connection parameters from configuration.
Please login to merge, or discard this patch.
Upper-Lower-Casing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @access protected
57 57
      * @var string|null This holds the core name
58 58
      */
59
-    protected ?string $core = null;
59
+    protected ?string $core = NULL;
60 60
 
61 61
     /**
62 62
      * @access protected
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @access protected
101 101
      * @var bool Is the search instantiated successfully?
102 102
      */
103
-    protected bool $ready = false;
103
+    protected bool $ready = FALSE;
104 104
 
105 105
     /**
106 106
      * @access protected
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      *
286 286
      * @return Solr Instance of this class
287 287
      */
288
-    public static function getInstance($core = null): Solr
288
+    public static function getInstance($core = NULL): Solr
289 289
     {
290 290
         // Get core name if UID is given.
291 291
         if (MathUtility::canBeInterpretedAsInteger($core)) {
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         // Check if core is set or null.
295 295
         if (
296 296
             empty($core)
297
-            && $core !== null
297
+            && $core !== NULL
298 298
         ) {
299 299
             Helper::log('Invalid core UID or name given for Apache Solr', LOG_SEVERITY_ERROR);
300 300
         }
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
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);
395
-        if ($entry === false) {
395
+        if ($entry === FALSE) {
396 396
             $selectQuery = $this->service->createSelect(array_merge($this->params, $parameters));
397 397
             $result = $this->service->select($selectQuery);
398 398
             foreach ($result as $doc) {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
             || !method_exists($this, $method)
527 527
         ) {
528 528
             $this->logger->warning('There is no getter function for property "' . $var . '"');
529
-            return null;
529
+            return NULL;
530 530
         } else {
531 531
             return $this->$method();
532 532
         }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         $adapter->setTimeout($this->config['timeout']);
590 590
         // Configure event dispatcher.
591 591
         if ($isSolarium5) {
592
-            $eventDispatcher = null;
592
+            $eventDispatcher = NULL;
593 593
         } else {
594 594
             // When updating to TYPO3 >=10.x and Solarium >=6.x
595 595
             // we have to provide an PSR-14 Event Dispatcher instead of
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         // Check if connection is established.
624 624
         $query = $this->service->createCoreAdmin();
625 625
         $action = $query->createStatus();
626
-        if ($core !== null) {
626
+        if ($core !== NULL) {
627 627
             $action->setCore($core);
628 628
         }
629 629
         $query->setAction($action);
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
             $response = $this->service->coreAdmin($query);
632 632
             if ($response->getWasSuccessful()) {
633 633
                 // Solr is reachable, but is the core as well?
634
-                if ($core !== null) {
634
+                if ($core !== NULL) {
635 635
                     $result = $response->getStatusResult();
636 636
                     if (
637 637
                         $result instanceof StatusResult
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                     }
646 646
                 }
647 647
                 // Instantiation successful!
648
-                $this->ready = true;
648
+                $this->ready = TRUE;
649 649
             }
650 650
         } catch (\Exception $e) {
651 651
             // Nothing to do here.
Please login to merge, or discard this patch.
Classes/Common/Solr/SolrSearch.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -525,8 +525,8 @@
 block discarded – undo
525 525
                                 $searchResult['snippet'] = $doc['snippet'];
526 526
                                 $searchResult['highlight'] = $doc['highlight'];
527 527
                                 $searchResult['highlight_word'] = preg_replace('/^;|;$/', '',       // remove ; at beginning or end
528
-                                                                  preg_replace('/;+/', ';',         // replace any multiple of ; with a single ;
529
-                                                                  preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ;
528
+                                                                    preg_replace('/;+/', ';',         // replace any multiple of ; with a single ;
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;
532 532
                         }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             // in which case metadata of toplevel entry isn't yet filled.
228 228
             if (empty($document['metadata'])) {
229 229
                 $document['metadata'] = $this->fetchToplevelMetadataFromSolr([
230
-                    'query' => 'uid:' . $document['uid'],
230
+                    'query' => 'uid:'.$document['uid'],
231 231
                     'start' => 0,
232 232
                     'rows' => 1,
233 233
                     'sort' => ['score' => 'desc'],
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             if (empty($document['title']) && $document['partOf'] > 0) {
239 239
                 $superiorTitle = AbstractDocument::getTitle($document['partOf'], true);
240 240
                 if (!empty($superiorTitle)) {
241
-                    $document['title'] = '[' . $superiorTitle . ']';
241
+                    $document['title'] = '['.$superiorTitle.']';
242 242
                 }
243 243
             }
244 244
         }
@@ -373,13 +373,13 @@  discard block
 block discarded – undo
373 373
         // Set search query.
374 374
         if (
375 375
             !empty($this->searchParams['fulltext'])
376
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query'] ?? ''), $matches)
376
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query'] ?? ''), $matches)
377 377
         ) {
378 378
             // If the query already is a fulltext query e.g using the facets
379 379
             $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1];
380 380
             // Search in fulltext field if applicable. Query must not be empty!
381 381
             if (!empty($this->searchParams['query'])) {
382
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
382
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')';
383 383
             }
384 384
             $params['fulltext'] = true;
385 385
         } else {
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
                         in_array($this->searchParams['extOperator'][$i], $allowedOperators)
403 403
                     ) {
404 404
                         if (!empty($query)) {
405
-                            $query .= ' ' . $this->searchParams['extOperator'][$i] . ' ';
405
+                            $query .= ' '.$this->searchParams['extOperator'][$i].' ';
406 406
                         }
407
-                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')';
407
+                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')';
408 408
                     }
409 409
                 }
410 410
             }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         // Add filter query for date search
414 414
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
415 415
             // combine dateFrom and dateTo into range search
416
-            $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
416
+            $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
417 417
         }
418 418
 
419 419
         // Add filter query for faceting.
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
         ) {
431 431
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
432 432
             $params['filterquery'][]['query'] = '_query_:"{!join from='
433
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
434
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
435
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from='
436
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
437
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR '
438
-                . $fields['uid'] . ':' . $this->searchParams['documentId'];
433
+                . $fields['uid'].' to='.$fields['partof'].'}'
434
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
435
+                . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from='
436
+                . $fields['uid'].' to='.$fields['partof'].'}'
437
+                . $fields['uid'].':'.$this->searchParams['documentId'].' OR '
438
+                . $fields['uid'].':'.$this->searchParams['documentId'];
439 439
         }
440 440
 
441 441
         // if collections are given, we prepare the collection query string
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
         if ($this->listedMetadata) {
456 456
             foreach ($this->listedMetadata as $metadata) {
457 457
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
458
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
459
-                    $params['fields'] .= ',' . $listMetadataRecord;
458
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
459
+                    $params['fields'] .= ','.$listMetadataRecord;
460 460
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
461 461
                 }
462 462
             }
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
                             if ($this->searchParams['fulltext'] == '1') {
532 532
                                 $searchResult['snippet'] = $doc['snippet'];
533 533
                                 $searchResult['highlight'] = $doc['highlight'];
534
-                                $searchResult['highlight_word'] = preg_replace('/^;|;$/', '',       // remove ; at beginning or end
535
-                                                                  preg_replace('/;+/', ';',         // replace any multiple of ; with a single ;
534
+                                $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end
535
+                                                                  preg_replace('/;+/', ';', // replace any multiple of ; with a single ;
536 536
                                                                   preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ;
537 537
                             }
538 538
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                         
557 557
                                     // Fetch metadata for the current batch
558 558
                                     $metadataOf = $this->fetchToplevelMetadataFromSolr([
559
-                                        'query' => 'partof:' . $doc['uid'],
559
+                                        'query' => 'partof:'.$doc['uid'],
560 560
                                         'start' => $start,
561 561
                                         'rows' => min($batchSize, $totalChildren - $start),
562 562
                                     ]);
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
         if ($this->listedMetadata) {
609 609
             foreach ($this->listedMetadata as $metadata) {
610 610
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
611
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
612
-                    $params['fields'] .= ',' . $listMetadataRecord;
611
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
612
+                    $params['fields'] .= ','.$listMetadataRecord;
613 613
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
614 614
                 }
615 615
             }
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $cache = null;
661 661
         // Calculate cache identifier.
662 662
         if ($enableCache === true) {
663
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
663
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
664 664
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
665 665
         }
666 666
         $resultSet = [
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
             if ($this->indexedMetadata) {
679 679
                 foreach ($this->indexedMetadata as $metadata) {
680 680
                     if ($metadata->getIndexIndexed()) {
681
-                        $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . 'i';
682
-                        $queryFields .= $listMetadataRecord . '^' . $metadata->getIndexBoost() . ' ';
681
+                        $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').'i';
682
+                        $queryFields .= $listMetadataRecord.'^'.$metadata->getIndexBoost().' ';
683 683
                     }
684 684
                 }
685 685
             }
@@ -765,24 +765,24 @@  discard block
 block discarded – undo
765 765
         foreach ($this->collections as $collection) {
766 766
             // check for virtual collections query string
767 767
             if ($collection->getIndexSearch()) {
768
-                $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')';
768
+                $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collection->getIndexSearch().')' : ' OR ('.$collection->getIndexSearch().')';
769 769
             } else {
770
-                $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"';
770
+                $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collection->getIndexName().'"' : ' OR "'.$collection->getIndexName().'"';
771 771
             }
772 772
         }
773 773
 
774 774
         // distinguish between simple collection browsing and actual searching within the collection(s)
775 775
         if (!empty($collectionsQueryString)) {
776 776
             if (empty($query)) {
777
-                $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)';
777
+                $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)';
778 778
             } else {
779
-                $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))';
779
+                $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))';
780 780
             }
781 781
         }
782 782
 
783 783
         // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately
784 784
         if (!empty($virtualCollectionsQueryString)) {
785
-            $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')';
785
+            $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')';
786 786
         }
787 787
 
788 788
         // combine both query strings into a single filterquery via OR if both are given, otherwise pass either of those
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
     private function translateLanguageCode(&$doc): void
861 861
     {
862 862
         if (array_key_exists('language', $doc['metadata'])) {
863
-            foreach($doc['metadata']['language'] as $indexName => $language) {
863
+            foreach ($doc['metadata']['language'] as $indexName => $language) {
864 864
                 $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language);
865 865
             }
866 866
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -96,8 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return void
98 98
      */
99
-    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null, QueryResult $indexedMetadata = null)
100
-    {
99
+    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null, QueryResult $indexedMetadata = null) {
101 100
         $this->documentRepository = $documentRepository;
102 101
         $this->collections = $collections;
103 102
         $this->settings = $settings;
@@ -217,8 +216,7 @@  discard block
 block discarded – undo
217 216
      * @return mixed
218 217
      */
219 218
     #[\ReturnTypeWillChange]
220
-    public function offsetGet($offset)
221
-    {
219
+    public function offsetGet($offset) {
222 220
         $idx = $this->result['document_keys'][$offset];
223 221
         $document = $this->result['documents'][$idx] ?? null;
224 222
 
@@ -286,8 +284,7 @@  discard block
 block discarded – undo
286 284
      *
287 285
      * @return mixed
288 286
      */
289
-    public function getSolrResults()
290
-    {
287
+    public function getSolrResults() {
291 288
         return $this->result['solrResults'];
292 289
     }
293 290
 
@@ -300,8 +297,7 @@  discard block
 block discarded – undo
300 297
      *
301 298
      * @return mixed
302 299
      */
303
-    public function getByUid($uid)
304
-    {
300
+    public function getByUid($uid) {
305 301
         return $this->result['documents'][$uid];
306 302
     }
307 303
 
@@ -312,8 +308,7 @@  discard block
 block discarded – undo
312 308
      *
313 309
      * @return SolrSearchQuery
314 310
      */
315
-    public function getQuery()
316
-    {
311
+    public function getQuery() {
317 312
         return new SolrSearchQuery($this);
318 313
     }
319 314
 
@@ -324,8 +319,7 @@  discard block
 block discarded – undo
324 319
      *
325 320
      * @return SolrSearch
326 321
      */
327
-    public function getFirst()
328
-    {
322
+    public function getFirst() {
329 323
         return $this[0];
330 324
     }
331 325
 
@@ -336,8 +330,7 @@  discard block
 block discarded – undo
336 330
      *
337 331
      * @return array
338 332
      */
339
-    public function toArray()
340
-    {
333
+    public function toArray() {
341 334
         return array_values($this->result['documents']);
342 335
     }
343 336
 
@@ -350,8 +343,7 @@  discard block
 block discarded – undo
350 343
      *
351 344
      * @return int
352 345
      */
353
-    public function getNumFound()
354
-    {
346
+    public function getNumFound() {
355 347
         return $this->result['numFound'];
356 348
     }
357 349
 
@@ -362,8 +354,7 @@  discard block
 block discarded – undo
362 354
      *
363 355
      * @return void
364 356
      */
365
-    public function prepare()
366
-    {
357
+    public function prepare() {
367 358
         // Prepare query parameters.
368 359
         $params = [];
369 360
         $matches = [];
@@ -479,8 +470,7 @@  discard block
 block discarded – undo
479 470
      *
480 471
      * @return void
481 472
      */
482
-    public function submit($start, $rows, $processResults = true)
483
-    {
473
+    public function submit($start, $rows, $processResults = true) {
484 474
         $params = $this->params;
485 475
         $params['start'] = $start;
486 476
         $params['rows'] = $rows;
@@ -638,8 +628,7 @@  discard block
 block discarded – undo
638 628
      *
639 629
      * @return array The Apache Solr Documents that were fetched
640 630
      */
641
-    protected function searchSolr($parameters = [], $enableCache = true)
642
-    {
631
+    protected function searchSolr($parameters = [], $enableCache = true) {
643 632
         // Set query.
644 633
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
645 634
         $parameters['filterquery'] = isset($parameters['filterquery']) ? $parameters['filterquery'] : [];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return void
98 98
      */
99
-    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null, QueryResult $indexedMetadata = null)
99
+    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = NULL, QueryResult $indexedMetadata = NULL)
100 100
     {
101 101
         $this->documentRepository = $documentRepository;
102 102
         $this->collections = $collections;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function count(): int
129 129
     {
130
-        if ($this->result === null) {
130
+        if ($this->result === NULL) {
131 131
             return 0;
132 132
         }
133 133
 
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
     public function offsetGet($offset)
221 221
     {
222 222
         $idx = $this->result['document_keys'][$offset];
223
-        $document = $this->result['documents'][$idx] ?? null;
223
+        $document = $this->result['documents'][$idx] ?? NULL;
224 224
 
225
-        if ($document !== null) {
225
+        if ($document !== NULL) {
226 226
             // It may happen that a Solr group only includes non-toplevel results,
227 227
             // in which case metadata of toplevel entry isn't yet filled.
228 228
             if (empty($document['metadata'])) {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
             // get title of parent/grandparent/... if empty
238 238
             if (empty($document['title']) && $document['partOf'] > 0) {
239
-                $superiorTitle = AbstractDocument::getTitle($document['partOf'], true);
239
+                $superiorTitle = AbstractDocument::getTitle($document['partOf'], TRUE);
240 240
                 if (!empty($superiorTitle)) {
241 241
                     $document['title'] = '[' . $superiorTitle . ']';
242 242
                 }
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
             if (!empty($this->searchParams['query'])) {
382 382
                 $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
383 383
             }
384
-            $params['fulltext'] = true;
384
+            $params['fulltext'] = TRUE;
385 385
         } else {
386 386
             // Retain given search field if valid.
387 387
             if (!empty($this->searchParams['query'])) {
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         $this->params = $params;
466 466
 
467 467
         // Send off query to get total number of search results in advance
468
-        $this->submit(0, 1, false);
468
+        $this->submit(0, 1, FALSE);
469 469
     }
470 470
 
471 471
     /**
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
      *
480 480
      * @return void
481 481
      */
482
-    public function submit($start, $rows, $processResults = true)
482
+    public function submit($start, $rows, $processResults = TRUE)
483 483
     {
484 484
         $params = $this->params;
485 485
         $params['start'] = $start;
486 486
         $params['rows'] = $rows;
487 487
 
488 488
         // Perform search.
489
-        $result = $this->searchSolr($params, true);
489
+        $result = $this->searchSolr($params, TRUE);
490 490
 
491 491
         // Initialize values
492 492
         $documents = [];
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                 }
512 512
                 if (isset($documents[$doc['uid']])) {
513 513
                     $this->translateLanguageCode($doc);
514
-                    if ($doc['toplevel'] === false) {
514
+                    if ($doc['toplevel'] === FALSE) {
515 515
                         // this maybe a chapter, article, ..., year
516 516
                         if ($doc['type'] === 'year') {
517 517
                             continue;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                             }
538 538
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
539 539
                         }
540
-                    } else if ($doc['toplevel'] === true) {
540
+                    } else if ($doc['toplevel'] === TRUE) {
541 541
                         foreach ($params['listMetadataRecords'] as $indexName => $solrField) {
542 542
                             if (isset($doc['metadata'][$indexName])) {
543 543
                                 $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName];
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                                 $totalChildren = count($children);
553 553
                         
554 554
                                 for ($start = 0; $start < $totalChildren; $start += $batchSize) {
555
-                                    $batch = array_slice($children, $start, $batchSize, true);
555
+                                    $batch = array_slice($children, $start, $batchSize, TRUE);
556 556
                         
557 557
                                     // Fetch metadata for the current batch
558 558
                                     $metadataOf = $this->fetchToplevelMetadataFromSolr([
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $params['filterquery'][] = ['query' => 'toplevel:true'];
619 619
 
620 620
         // Perform search.
621
-        $result = $this->searchSolr($params, true);
621
+        $result = $this->searchSolr($params, TRUE);
622 622
 
623 623
         foreach ($result['documents'] as $doc) {
624 624
             $this->translateLanguageCode($doc);
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
      *
639 639
      * @return array The Apache Solr Documents that were fetched
640 640
      */
641
-    protected function searchSolr($parameters = [], $enableCache = true)
641
+    protected function searchSolr($parameters = [], $enableCache = TRUE)
642 642
     {
643 643
         // Set query.
644 644
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
@@ -657,10 +657,10 @@  discard block
 block discarded – undo
657 657
         }
658 658
 
659 659
         $cacheIdentifier = '';
660
-        $cache = null;
660
+        $cache = NULL;
661 661
         // Calculate cache identifier.
662
-        if ($enableCache === true) {
663
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
662
+        if ($enableCache === TRUE) {
663
+            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE));
664 664
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
665 665
         }
666 666
         $resultSet = [
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             'numberOfToplevels' => 0,
669 669
             'numFound' => 0,
670 670
         ];
671
-        if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) {
671
+        if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) {
672 672
             $selectQuery = $solr->service->createSelect($parameters);
673 673
 
674 674
             $edismax = $selectQuery->getEDisMax();
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
             $grouping = $selectQuery->getGrouping();
690 690
             $grouping->addField('uid');
691 691
             $grouping->setLimit(100); // Results in group (TODO: check)
692
-            $grouping->setNumberOfGroups(true);
692
+            $grouping->setNumberOfGroups(TRUE);
693 693
 
694
-            $fulltextExists = $parameters['fulltext'] ?? false;
695
-            if ($fulltextExists === true) {
694
+            $fulltextExists = $parameters['fulltext'] ?? FALSE;
695
+            if ($fulltextExists === TRUE) {
696 696
                 // get highlighting component and apply settings
697 697
                 $selectQuery->getHighlighting();
698 698
             }
699 699
 
700 700
             $solrRequest = $solr->service->createRequest($selectQuery);
701 701
 
702
-            if ($fulltextExists === true) {
702
+            if ($fulltextExists === TRUE) {
703 703
                 // If it is a fulltext search, enable highlighting.
704 704
                 // field for which highlighting is going to be performed,
705 705
                 // is required if you want to have OCR highlighting
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
             $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups();
727 727
             $resultSet['numFound'] = $uidGroup->getMatches();
728 728
             $highlighting = [];
729
-            if ($fulltextExists === true) {
729
+            if ($fulltextExists === TRUE) {
730 730
                 $data = $result->getData();
731 731
                 $highlighting = $data['ocrHighlighting'];
732 732
             }
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
             }
740 740
 
741 741
             // Save value in cache.
742
-            if (!empty($resultSet['documents']) && $enableCache === true) {
742
+            if (!empty($resultSet['documents']) && $enableCache === TRUE) {
743 743
                 $cache->set($cacheIdentifier, $resultSet);
744 744
             }
745 745
         } else {
Please login to merge, or discard this patch.
Classes/Common/Solr/SolrSearchQuery.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
      */
39 39
     private int $offset;
40 40
 
41
-     /**
42
-     * Constructs SolrSearchQuery instance.
43
-     *
44
-     * @access public
45
-     *
46
-     * @param SolrSearch $solrSearch
47
-     *
48
-     * @return void
49
-     */
41
+        /**
42
+         * Constructs SolrSearchQuery instance.
43
+         *
44
+         * @access public
45
+         *
46
+         * @param SolrSearch $solrSearch
47
+         *
48
+         * @return void
49
+         */
50 50
     public function __construct($solrSearch)
51 51
     {
52 52
         $this->solrSearch = $solrSearch;
Please login to merge, or discard this patch.
Braces   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
  * @property int $limit
19 19
  * @property int $offset
20 20
  */
21
-class SolrSearchQuery implements QueryInterface
22
-{
21
+class SolrSearchQuery implements QueryInterface {
23 22
     /**
24 23
      * @access private
25 24
      * @var SolrSearch
@@ -47,8 +46,7 @@  discard block
 block discarded – undo
47 46
      *
48 47
      * @return void
49 48
      */
50
-    public function __construct($solrSearch)
51
-    {
49
+    public function __construct($solrSearch) {
52 50
         $this->solrSearch = $solrSearch;
53 51
 
54 52
         $this->offset = 0;
@@ -70,8 +68,7 @@  discard block
 block discarded – undo
70 68
      */
71 69
     // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
72 70
     // @phpstan-ignore-next-line
73
-    public function execute($returnRawQueryResult = false)
74
-    {
71
+    public function execute($returnRawQueryResult = false) {
75 72
         $this->solrSearch->submit($this->offset, $this->limit);
76 73
 
77 74
         // solrSearch now only contains the results in range, indexed in [0, n)
@@ -146,8 +143,8 @@  discard block
 block discarded – undo
146 143
     // @phpstan-ignore-next-line
147 144
     public function getQuerySettings() {}
148 145
 
149
-    public function count()
150
-    {// @phpstan-ignore-next-line
146
+    public function count() {
147
+// @phpstan-ignore-next-line
151 148
         // TODO?
152 149
     }
153 150
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
72 72
     // @phpstan-ignore-next-line
73
-    public function execute($returnRawQueryResult = false)
73
+    public function execute($returnRawQueryResult = FALSE)
74 74
     {
75 75
         $this->solrSearch->submit($this->offset, $this->limit);
76 76
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     // @phpstan-ignore-next-line
126 126
     public function logicalNot(ConstraintInterface $constraint) {}
127 127
     // @phpstan-ignore-next-line
128
-    public function equals($propertyName, $operand, $caseSensitive = true) {}
128
+    public function equals($propertyName, $operand, $caseSensitive = TRUE) {}
129 129
     // @phpstan-ignore-next-line
130 130
     public function like($propertyName, $operand) {}
131 131
     // @phpstan-ignore-next-line
Please login to merge, or discard this patch.
Classes/Common/FulltextInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  *
23 23
  * @abstract
24 24
  */
25
-interface FulltextInterface
26
-{
25
+interface FulltextInterface {
27 26
     /**
28 27
      * This extracts raw fulltext data from XML
29 28
      *
Please login to merge, or discard this patch.
Classes/Common/StdOutStream.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@
 block discarded – undo
33 33
      * 
34 34
      * @return void
35 35
      */
36
-    public function emit()
37
-    {
36
+    public function emit() {
38 37
         // Disable output buffering
39 38
         ob_end_flush();
40 39
 
Please login to merge, or discard this patch.
Classes/Common/MetadataInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  *
23 23
  * @abstract
24 24
  */
25
-interface MetadataInterface
26
-{
25
+interface MetadataInterface {
27 26
     /**
28 27
      * This extracts metadata from XML
29 28
      *
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 3 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @access public
34 34
  */
35
-class Indexer
36
-{
35
+class Indexer {
37 36
     /**
38 37
      * @access public
39 38
      * @static
@@ -604,8 +603,7 @@  discard block
 block discarded – undo
604 603
      *
605 604
      * @return array|string
606 605
      */
607
-    private static function removeAppendsFromAuthor($authors)
608
-    {
606
+    private static function removeAppendsFromAuthor($authors) {
609 607
         if (is_array($authors)) {
610 608
             foreach ($authors as $i => $author) {
611 609
                 $splitName = explode(pack('C', 31), $author);
@@ -685,7 +683,6 @@  discard block
 block discarded – undo
685 683
      *
686 684
      * @return void
687 685
      */
688
-    private function __construct()
689
-    {
686
+    private function __construct() {
690 687
     }
691 688
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                         $parent->setCurrentDocument($doc);
114 114
                         $success = self::add($parent, $documentRepository);
115 115
                     } else {
116
-                        Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
116
+                        Helper::log('Could not load parent document with UID '.$document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
117 117
                         return false;
118 118
                     }
119 119
                 }
@@ -196,19 +196,19 @@  discard block
 block discarded – undo
196 196
             } catch (\Exception $e) {
197 197
                 if (!(Environment::isCli())) {
198 198
                     Helper::addMessage(
199
-                        Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
199
+                        Helper::getLanguageService()->getLL('flash.solrException').' '.htmlspecialchars($e->getMessage()),
200 200
                         Helper::getLanguageService()->getLL('flash.error'),
201 201
                         FlashMessage::ERROR,
202 202
                         true,
203 203
                         'core.template.flashMessages'
204 204
                     );
205 205
                 }
206
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
206
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
207 207
                 return false;
208 208
             }
209 209
         }
210 210
 
211
-        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR);
211
+        Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core '.$solrCoreUid, LOG_SEVERITY_ERROR);
212 212
         return false;
213 213
     }
214 214
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         // Sanitize input.
230 230
         $pid = max((int) $pid, 0);
231 231
         if (!$pid) {
232
-            Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR);
232
+            Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR);
233 233
             return '';
234 234
         }
235 235
         // Load metadata configuration.
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $suffix = (in_array($indexName, self::$fields['tokenized']) ? 't' : 'u');
239 239
         $suffix .= (in_array($indexName, self::$fields['stored']) ? 's' : 'u');
240 240
         $suffix .= (in_array($indexName, self::$fields['indexed']) ? 'i' : 'u');
241
-        $indexName .= '_' . $suffix;
241
+        $indexName .= '_'.$suffix;
242 242
         return $indexName;
243 243
     }
244 244
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
                 $solrDoc->setField('title', $metadata['title'][0]);
355 355
                 $solrDoc->setField('volume', $metadata['volume'][0]);
356 356
                 // verify date formatting
357
-                if(strtotime($metadata['date'][0])) {
357
+                if (strtotime($metadata['date'][0])) {
358 358
                     $solrDoc->setField('date', self::getFormattedDate($metadata['date'][0]));
359 359
                 }
360 360
                 $solrDoc->setField('record_id', $metadata['record_id'][0]);
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
                 $solrDoc->setField(self::getIndexFieldName($indexName, $document->getPid()), $data);
518 518
                 if (in_array($indexName, self::$fields['sortables'])) {
519 519
                     // Add sortable fields to index.
520
-                    $solrDoc->setField($indexName . '_sorting', $metadata[$indexName . '_sorting'][0]);
520
+                    $solrDoc->setField($indexName.'_sorting', $metadata[$indexName.'_sorting'][0]);
521 521
                 }
522 522
                 if (in_array($indexName, self::$fields['facets'])) {
523 523
                     // Add facets to index.
524
-                    $solrDoc->setField($indexName . '_faceting', $data);
524
+                    $solrDoc->setField($indexName.'_faceting', $data);
525 525
                 }
526 526
                 if (in_array($indexName, self::$fields['autocomplete'])) {
527 527
                     $autocomplete = array_merge($autocomplete, $data);
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                         $data = self::removeAppendsFromAuthor($data);
558 558
                     }
559 559
                     // Add facets to index.
560
-                    $solrDoc->setField($indexName . '_faceting', $data);
560
+                    $solrDoc->setField($indexName.'_faceting', $data);
561 561
                 }
562 562
             }
563 563
             // Add sorting information to physical sub-elements if applicable.
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
         $update = self::$solr->service->createUpdate();
588 588
         $query = "";
589 589
         if ($field == 'uid' || $field == 'partof') {
590
-            $query = $field . ':' . $value;
590
+            $query = $field.':'.$value;
591 591
         } else {
592
-            $query = $field . ':"' . $value . '"';
592
+            $query = $field.':"'.$value.'"';
593 593
         }
594 594
         $update->addDeleteQuery($query);
595 595
         $update->addCommit();
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
     {
615 615
         $solrDoc = $updateQuery->createDocument();
616 616
         // Create unique identifier from document's UID and unit's XML ID.
617
-        $solrDoc->setField('id', $document->getUid() . $unit['id']);
617
+        $solrDoc->setField('id', $document->getUid().$unit['id']);
618 618
         $solrDoc->setField('uid', $document->getUid());
619 619
         $solrDoc->setField('pid', $document->getPid());
620 620
         $solrDoc->setField('partof', $document->getPartof());
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
     private static function handleException(string $errorMessage): void
694 694
     {
695 695
         if (!(Environment::isCli())) {
696
-            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException') . '<br />' . htmlspecialchars($errorMessage));
696
+            self::addErrorMessage(Helper::getLanguageService()->getLL('flash.solrException').'<br />'.htmlspecialchars($errorMessage));
697 697
         }
698
-        Helper::log('Apache Solr threw exception: "' . $errorMessage . '"', LOG_SEVERITY_ERROR);
698
+        Helper::log('Apache Solr threw exception: "'.$errorMessage.'"', LOG_SEVERITY_ERROR);
699 699
     }
700 700
 
701 701
     /**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @see $fields
68 68
      */
69
-    protected static bool $fieldsLoaded = false;
69
+    protected static bool $fieldsLoaded = FALSE;
70 70
 
71 71
     /**
72 72
      * @access protected
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
     public static function add(Document $document, DocumentRepository $documentRepository): bool
98 98
     {
99 99
         if (in_array($document->getUid(), self::$processedDocs)) {
100
-            return true;
100
+            return TRUE;
101 101
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
102
-            $success = true;
102
+            $success = TRUE;
103 103
             Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf');
104 104
             // Handle multi-volume documents.
105 105
             $parentId = $document->getPartof();
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
                 $parent = $documentRepository->findByUid($parentId);
109 109
                 if ($parent) {
110 110
                     // get XML document of parent
111
-                    $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], true);
112
-                    if ($doc !== null) {
111
+                    $doc = AbstractDocument::getInstance($parent->getLocation(), ['storagePid' => $parent->getPid()], TRUE);
112
+                    if ($doc !== NULL) {
113 113
                         $parent->setCurrentDocument($doc);
114 114
                         $success = self::add($parent, $documentRepository);
115 115
                     } else {
116 116
                         Helper::log('Could not load parent document with UID ' . $document->getCurrentDocument()->parentId, LOG_SEVERITY_ERROR);
117
-                        return false;
117
+                        return FALSE;
118 118
                     }
119 119
                 }
120 120
             }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                 return $success;
162 162
             } catch (\Exception $e) {
163 163
                 self::handleException($e->getMessage());
164
-                return false;
164
+                return FALSE;
165 165
             }
166 166
         } else {
167 167
             if (!(Environment::isCli())) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 );
173 173
             }
174 174
             Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR);
175
-            return false;
175
+            return FALSE;
176 176
         }
177 177
     }
178 178
 
@@ -192,24 +192,24 @@  discard block
 block discarded – undo
192 192
         if (self::solrConnect($solrCoreUid, $input->getOption('pid'))) {
193 193
             try {
194 194
                 self::deleteDocument($field, $input->getOption('doc'));
195
-                return true;
195
+                return TRUE;
196 196
             } catch (\Exception $e) {
197 197
                 if (!(Environment::isCli())) {
198 198
                     Helper::addMessage(
199 199
                         Helper::getLanguageService()->getLL('flash.solrException') . ' ' . htmlspecialchars($e->getMessage()),
200 200
                         Helper::getLanguageService()->getLL('flash.error'),
201 201
                         FlashMessage::ERROR,
202
-                        true,
202
+                        TRUE,
203 203
                         'core.template.flashMessages'
204 204
                     );
205 205
                 }
206 206
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
207
-                return false;
207
+                return FALSE;
208 208
             }
209 209
         }
210 210
 
211 211
         Helper::log('Document not deleted from SOLR - problem with the connection to the SOLR core ' . $solrCoreUid, LOG_SEVERITY_ERROR);
212
-        return false;
212
+        return FALSE;
213 213
     }
214 214
 
215 215
     /**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                     self::$fields['autocomplete'][] = $indexing['index_name'];
306 306
                 }
307 307
             }
308
-            self::$fieldsLoaded = true;
308
+            self::$fieldsLoaded = TRUE;
309 309
         }
310 310
     }
311 311
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      */
324 324
     protected static function processLogical(Document $document, array $logicalUnit): bool
325 325
     {
326
-        $success = true;
326
+        $success = TRUE;
327 327
         $doc = $document->getCurrentDocument();
328 328
         $doc->cPid = $document->getPid();
329 329
         // Get metadata for logical unit.
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                     $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId']));
351 351
                 }
352 352
                 // There can be only one toplevel unit per UID, independently of backend configuration
353
-                $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false);
353
+                $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE);
354 354
                 $solrDoc->setField('title', $metadata['title'][0]);
355 355
                 $solrDoc->setField('volume', $metadata['volume'][0]);
356 356
                 // verify date formatting
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
                     self::$solr->service->update($updateQuery);
387 387
                 } catch (\Exception $e) {
388 388
                     self::handleException($e->getMessage());
389
-                    return false;
389
+                    return FALSE;
390 390
                 }
391 391
             } else {
392 392
                 Helper::log('Tip: If "record_id" field is missing then there is possibility that METS file still contains it but with the wrong source type attribute in "recordIdentifier" element', LOG_SEVERITY_NOTICE);
393
-                return false;
393
+                return FALSE;
394 394
             }
395 395
         }
396 396
         // Check for child elements...
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                     break;
439 439
                 }
440 440
             }
441
-            $solrDoc->setField('toplevel', false);
441
+            $solrDoc->setField('toplevel', FALSE);
442 442
             $solrDoc->setField('type', $physicalUnit['type']);
443 443
             $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']);
444 444
             $solrDoc->setField('location', $document->getLocation());
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
                 self::$solr->service->update($updateQuery);
460 460
             } catch (\Exception $e) {
461 461
                 self::handleException($e->getMessage());
462
-                return false;
462
+                return FALSE;
463 463
             }
464 464
         }
465
-        return true;
465
+        return TRUE;
466 466
     }
467 467
 
468 468
     /**
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
             if ($pid) {
489 489
                 self::loadIndexConf($pid);
490 490
             }
491
-            return true;
491
+            return TRUE;
492 492
         }
493
-        return false;
493
+        return FALSE;
494 494
     }
495 495
 
496 496
     /**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
             $message,
738 738
             Helper::getLanguageService()->getLL($type),
739 739
             $status,
740
-            true,
740
+            TRUE,
741 741
             'core.template.flashMessages'
742 742
         );
743 743
     }
Please login to merge, or discard this patch.