Passed
Pull Request — master (#123)
by
unknown
04:21
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/Region.php 1 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 Region
24
-{
23
+class Region {
25 24
 
26 25
     /**
27 26
      * @access private
@@ -87,8 +86,7 @@  discard block
 block discarded – undo
87 86
      *
88 87
      * @return void
89 88
      */
90
-    public function __construct(int $id, array $region)
91
-    {
89
+    public function __construct(int $id, array $region) {
92 90
         $this->id = $id;
93 91
         $this->pageId = $region['pageIdx'];
94 92
         $this->xBeginPosition = $region['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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 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
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   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -90,8 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return void
92 92
      */
93
-    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null)
94
-    {
93
+    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null) {
95 94
         $this->documentRepository = $documentRepository;
96 95
         $this->collections = $collections;
97 96
         $this->settings = $settings;
@@ -210,8 +209,7 @@  discard block
 block discarded – undo
210 209
      * @return mixed
211 210
      */
212 211
     #[\ReturnTypeWillChange]
213
-    public function offsetGet($offset)
214
-    {
212
+    public function offsetGet($offset) {
215 213
         $idx = $this->result['document_keys'][$offset];
216 214
         $document = $this->result['documents'][$idx] ?? null;
217 215
 
@@ -279,8 +277,7 @@  discard block
 block discarded – undo
279 277
      *
280 278
      * @return mixed
281 279
      */
282
-    public function getSolrResults()
283
-    {
280
+    public function getSolrResults() {
284 281
         return $this->result['solrResults'];
285 282
     }
286 283
 
@@ -293,8 +290,7 @@  discard block
 block discarded – undo
293 290
      *
294 291
      * @return mixed
295 292
      */
296
-    public function getByUid($uid)
297
-    {
293
+    public function getByUid($uid) {
298 294
         return $this->result['documents'][$uid];
299 295
     }
300 296
 
@@ -305,8 +301,7 @@  discard block
 block discarded – undo
305 301
      *
306 302
      * @return SolrSearchQuery
307 303
      */
308
-    public function getQuery()
309
-    {
304
+    public function getQuery() {
310 305
         return new SolrSearchQuery($this);
311 306
     }
312 307
 
@@ -317,8 +312,7 @@  discard block
 block discarded – undo
317 312
      *
318 313
      * @return SolrSearch
319 314
      */
320
-    public function getFirst()
321
-    {
315
+    public function getFirst() {
322 316
         return $this[0];
323 317
     }
324 318
 
@@ -329,8 +323,7 @@  discard block
 block discarded – undo
329 323
      *
330 324
      * @return array
331 325
      */
332
-    public function toArray()
333
-    {
326
+    public function toArray() {
334 327
         return array_values($this->result['documents']);
335 328
     }
336 329
 
@@ -343,8 +336,7 @@  discard block
 block discarded – undo
343 336
      *
344 337
      * @return int
345 338
      */
346
-    public function getNumFound()
347
-    {
339
+    public function getNumFound() {
348 340
         return $this->result['numFound'];
349 341
     }
350 342
 
@@ -355,8 +347,7 @@  discard block
 block discarded – undo
355 347
      *
356 348
      * @return void
357 349
      */
358
-    public function prepare()
359
-    {
350
+    public function prepare() {
360 351
         // Prepare query parameters.
361 352
         $params = [];
362 353
         $matches = [];
@@ -472,8 +463,7 @@  discard block
 block discarded – undo
472 463
      *
473 464
      * @return void
474 465
      */
475
-    public function submit($start, $rows, $processResults = true)
476
-    {
466
+    public function submit($start, $rows, $processResults = true) {
477 467
         $params = $this->params;
478 468
         $params['start'] = $start;
479 469
         $params['rows'] = $rows;
@@ -631,8 +621,7 @@  discard block
 block discarded – undo
631 621
      *
632 622
      * @return array The Apache Solr Documents that were fetched
633 623
      */
634
-    protected function searchSolr($parameters = [], $enableCache = true)
635
-    {
624
+    protected function searchSolr($parameters = [], $enableCache = true) {
636 625
         // Set query.
637 626
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
638 627
         $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
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return void
92 92
      */
93
-    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = null)
93
+    public function __construct(DocumentRepository $documentRepository, $collections, array $settings, array $searchParams, QueryResult $listedMetadata = NULL)
94 94
     {
95 95
         $this->documentRepository = $documentRepository;
96 96
         $this->collections = $collections;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function count(): int
122 122
     {
123
-        if ($this->result === null) {
123
+        if ($this->result === NULL) {
124 124
             return 0;
125 125
         }
126 126
 
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
     public function offsetGet($offset)
214 214
     {
215 215
         $idx = $this->result['document_keys'][$offset];
216
-        $document = $this->result['documents'][$idx] ?? null;
216
+        $document = $this->result['documents'][$idx] ?? NULL;
217 217
 
218
-        if ($document !== null) {
218
+        if ($document !== NULL) {
219 219
             // It may happen that a Solr group only includes non-toplevel results,
220 220
             // in which case metadata of toplevel entry isn't yet filled.
221 221
             if (empty($document['metadata'])) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
             // get title of parent/grandparent/... if empty
231 231
             if (empty($document['title']) && $document['partOf'] > 0) {
232
-                $superiorTitle = AbstractDocument::getTitle($document['partOf'], true);
232
+                $superiorTitle = AbstractDocument::getTitle($document['partOf'], TRUE);
233 233
                 if (!empty($superiorTitle)) {
234 234
                     $document['title'] = '[' . $superiorTitle . ']';
235 235
                 }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             if (!empty($this->searchParams['query'])) {
375 375
                 $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
376 376
             }
377
-            $params['fulltext'] = true;
377
+            $params['fulltext'] = TRUE;
378 378
         } else {
379 379
             // Retain given search field if valid.
380 380
             if (!empty($this->searchParams['query'])) {
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         $this->params = $params;
459 459
 
460 460
         // Send off query to get total number of search results in advance
461
-        $this->submit(0, 1, false);
461
+        $this->submit(0, 1, FALSE);
462 462
     }
463 463
 
464 464
     /**
@@ -472,14 +472,14 @@  discard block
 block discarded – undo
472 472
      *
473 473
      * @return void
474 474
      */
475
-    public function submit($start, $rows, $processResults = true)
475
+    public function submit($start, $rows, $processResults = TRUE)
476 476
     {
477 477
         $params = $this->params;
478 478
         $params['start'] = $start;
479 479
         $params['rows'] = $rows;
480 480
 
481 481
         // Perform search.
482
-        $result = $this->searchSolr($params, true);
482
+        $result = $this->searchSolr($params, TRUE);
483 483
 
484 484
         // Initialize values
485 485
         $documents = [];
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                 }
505 505
                 if (isset($documents[$doc['uid']])) {
506 506
                     $this->translateLanguageCode($doc);
507
-                    if ($doc['toplevel'] === false) {
507
+                    if ($doc['toplevel'] === FALSE) {
508 508
                         // this maybe a chapter, article, ..., year
509 509
                         if ($doc['type'] === 'year') {
510 510
                             continue;
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                             }
531 531
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
532 532
                         }
533
-                    } else if ($doc['toplevel'] === true) {
533
+                    } else if ($doc['toplevel'] === TRUE) {
534 534
                         foreach ($params['listMetadataRecords'] as $indexName => $solrField) {
535 535
                             if (isset($doc['metadata'][$indexName])) {
536 536
                                 $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName];
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
                                 $totalChildren = count($children);
546 546
                         
547 547
                                 for ($start = 0; $start < $totalChildren; $start += $batchSize) {
548
-                                    $batch = array_slice($children, $start, $batchSize, true);
548
+                                    $batch = array_slice($children, $start, $batchSize, TRUE);
549 549
                         
550 550
                                     // Fetch metadata for the current batch
551 551
                                     $metadataOf = $this->fetchToplevelMetadataFromSolr([
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
         $params['filterquery'][] = ['query' => 'toplevel:true'];
612 612
 
613 613
         // Perform search.
614
-        $result = $this->searchSolr($params, true);
614
+        $result = $this->searchSolr($params, TRUE);
615 615
 
616 616
         foreach ($result['documents'] as $doc) {
617 617
             $this->translateLanguageCode($doc);
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
      *
632 632
      * @return array The Apache Solr Documents that were fetched
633 633
      */
634
-    protected function searchSolr($parameters = [], $enableCache = true)
634
+    protected function searchSolr($parameters = [], $enableCache = TRUE)
635 635
     {
636 636
         // Set query.
637 637
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
         }
651 651
 
652 652
         $cacheIdentifier = '';
653
-        $cache = null;
653
+        $cache = NULL;
654 654
         // Calculate cache identifier.
655
-        if ($enableCache === true) {
656
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
655
+        if ($enableCache === 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 = [
@@ -661,23 +661,23 @@  discard block
 block discarded – undo
661 661
             'numberOfToplevels' => 0,
662 662
             'numFound' => 0,
663 663
         ];
664
-        if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) {
664
+        if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) {
665 665
             $selectQuery = $solr->service->createSelect($parameters);
666 666
 
667 667
             $grouping = $selectQuery->getGrouping();
668 668
             $grouping->addField('uid');
669 669
             $grouping->setLimit(100); // Results in group (TODO: check)
670
-            $grouping->setNumberOfGroups(true);
670
+            $grouping->setNumberOfGroups(TRUE);
671 671
 
672
-            $fulltextExists = $parameters['fulltext'] ?? false;
673
-            if ($fulltextExists === true) {
672
+            $fulltextExists = $parameters['fulltext'] ?? FALSE;
673
+            if ($fulltextExists === TRUE) {
674 674
                 // get highlighting component and apply settings
675 675
                 $selectQuery->getHighlighting();
676 676
             }
677 677
 
678 678
             $solrRequest = $solr->service->createRequest($selectQuery);
679 679
 
680
-            if ($fulltextExists === true) {
680
+            if ($fulltextExists === TRUE) {
681 681
                 // If it is a fulltext search, enable highlighting.
682 682
                 // field for which highlighting is going to be performed,
683 683
                 // is required if you want to have OCR highlighting
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups();
705 705
             $resultSet['numFound'] = $uidGroup->getMatches();
706 706
             $highlighting = [];
707
-            if ($fulltextExists === true) {
707
+            if ($fulltextExists === TRUE) {
708 708
                 $data = $result->getData();
709 709
                 $highlighting = $data['ocrHighlighting'];
710 710
             }
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
             }
718 718
 
719 719
             // Save value in cache.
720
-            if (!empty($resultSet['documents']) && $enableCache === true) {
720
+            if (!empty($resultSet['documents']) && $enableCache === TRUE) {
721 721
                 $cache->set($cacheIdentifier, $resultSet);
722 722
             }
723 723
         } 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.