Passed
Pull Request — master (#123)
by
unknown
06:03 queued 21s
created
Classes/Common/KitodoFlashMessageRenderer.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
  *
28 28
  * @access public
29 29
  */
30
-class KitodoFlashMessageRenderer implements FlashMessageRendererInterface
31
-{
30
+class KitodoFlashMessageRenderer implements FlashMessageRendererInterface {
32 31
     /**
33 32
      * @var array The message severity class names
34 33
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function getClass(FlashMessage $flashMessage): string
101 101
     {
102
-        return 'alert-' . self::$classes[$this->getSeverityAsInt($flashMessage)];
102
+        return 'alert-'.self::$classes[$this->getSeverityAsInt($flashMessage)];
103 103
     }
104 104
 
105 105
     /**
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
         $markup[] = '<div class="typo3-messages">';
135 135
         foreach ($flashMessages as $flashMessage) {
136 136
             $messageTitle = $flashMessage->getTitle();
137
-            $markup[] = '<div class="alert ' . htmlspecialchars($this->getClass($flashMessage)) . '">';
137
+            $markup[] = '<div class="alert '.htmlspecialchars($this->getClass($flashMessage)).'">';
138 138
             $markup[] = '  <div class="media">';
139 139
             $markup[] = '    <div class="media-left">';
140 140
             $markup[] = '      <span class="fa-stack fa-lg">';
141 141
             $markup[] = '        <i class="fa fa-circle fa-stack-2x"></i>';
142
-            $markup[] = '        <i class="fa fa-' . htmlspecialchars($this->getIconName($flashMessage)) . ' fa-stack-1x"></i>';
142
+            $markup[] = '        <i class="fa fa-'.htmlspecialchars($this->getIconName($flashMessage)).' fa-stack-1x"></i>';
143 143
             $markup[] = '      </span>';
144 144
             $markup[] = '    </div>';
145 145
             $markup[] = '    <div class="media-body">';
146 146
             if ($messageTitle !== '') {
147
-                $markup[] = '      <h4 class="alert-title">' . htmlspecialchars($messageTitle) . '</h4>';
147
+                $markup[] = '      <h4 class="alert-title">'.htmlspecialchars($messageTitle).'</h4>';
148 148
             }
149
-            $markup[] = '      <p class="alert-message">' . $flashMessage->getMessage() . '</p>';
149
+            $markup[] = '      <p class="alert-message">'.$flashMessage->getMessage().'</p>';
150 150
             $markup[] = '    </div>';
151 151
             $markup[] = '  </div>';
152 152
             $markup[] = '</div>';
Please login to merge, or discard this patch.
Classes/Common/IiifUrlReader.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @access public
27 27
  */
28
-class IiifUrlReader implements UrlReaderInterface
29
-{
28
+class IiifUrlReader implements UrlReaderInterface {
30 29
     /**
31 30
      * @access protected
32 31
      * @var IiifUrlReader Singleton instance of the class
@@ -36,8 +35,7 @@  discard block
 block discarded – undo
36 35
     /**
37 36
      * @see UrlReaderInterface::getContent()
38 37
      */
39
-    public function getContent($url)
40
-    {
38
+    public function getContent($url) {
41 39
         $fileContents = GeneralUtility::getUrl($url);
42 40
         if ($fileContents !== false) {
43 41
             return $fileContents;
Please login to merge, or discard this patch.
Classes/Common/IiifManifest.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -653,16 +653,16 @@  discard block
 block discarded – undo
653 653
                 if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) {
654 654
                     $values = $iiifResource->jsonPath($resArray['xpath_sorting']);
655 655
                     if (is_string($values)) {
656
-                        $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)];
656
+                        $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)];
657 657
                     } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) {
658 658
                         $metadata[$resArray['index_name']] = [];
659 659
                         foreach ($values->data() as $value) {
660
-                            $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value);
660
+                            $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value);
661 661
                         }
662 662
                     }
663 663
                 }
664
-                if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) {
665
-                    $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0];
664
+                if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
665
+                    $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
666 666
                 }
667 667
             }
668 668
         }
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
                     }
773 773
                 }
774 774
             } else {
775
-                $this->logger->warning('Invalid structure resource @id "' . $id . '"');
775
+                $this->logger->warning('Invalid structure resource @id "'.$id.'"');
776 776
                 return $rawText;
777 777
             }
778 778
             $this->rawTextArray[$id] = $rawText;
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
                 return true;
818 818
             }
819 819
         }
820
-        $this->logger->error('Could not load IIIF manifest from "' . $location . '"');
820
+        $this->logger->error('Could not load IIIF manifest from "'.$location.'"');
821 821
         return false;
822 822
     }
823 823
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
  * @property array $mimeTypes this holds the mime types of linked resources in the manifest (extracted during parsing) for later us
76 76
  * 
77 77
  */
78
-final class IiifManifest extends AbstractDocument
79
-{
78
+final class IiifManifest extends AbstractDocument {
80 79
     /**
81 80
      * @access protected
82 81
      * @var string This holds the manifest file as string for serialization purposes
@@ -229,8 +228,7 @@  discard block
 block discarded – undo
229 228
      *
230 229
      * @return array|string
231 230
      */
232
-    protected function getUseGroups(string $use)
233
-    {
231
+    protected function getUseGroups(string $use) {
234 232
         if (!$this->useGrpsLoaded) {
235 233
             // Get configured USE attributes.
236 234
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @access protected
102 102
      * @var bool Document has already been analyzed if it contains fulltext for the Solr index
103 103
      */
104
-    protected bool $hasFulltextSet = false;
104
+    protected bool $hasFulltextSet = FALSE;
105 105
 
106 106
     /**
107 107
      * @access protected
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     protected function establishRecordId(int $pid): void
122 122
     {
123
-        if ($this->iiif !== null) {
123
+        if ($this->iiif !== NULL) {
124 124
             /*
125 125
              *  FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss
126 126
              *  if the plugin that actually loads the manifest allows content from other pages.
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * @var bool
208 208
      * @access protected
209 209
      */
210
-    protected bool $useGrpsLoaded = false;
210
+    protected bool $useGrpsLoaded = FALSE;
211 211
 
212 212
     /**
213 213
      * Holds the configured useGrps as array.
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             if (!empty($extConf['fileGrpAudio'])) {
250 250
                 $this->useGrps['fileGrpAudio'] = GeneralUtility::trimExplode(',', $extConf['fileGrpAudio']);
251 251
             }
252
-            $this->useGrpsLoaded = true;
252
+            $this->useGrpsLoaded = TRUE;
253 253
         }
254 254
         return array_key_exists($use, $this->useGrps) ? $this->useGrps[$use] : [];
255 255
     }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     {
262 262
         // Is there no physical structure array yet?
263 263
         if (!$this->physicalStructureLoaded) {
264
-            if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) {
264
+            if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) {
265 265
                 return [];
266 266
             }
267 267
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif');
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             $this->physicalStructureInfo[$iiifId]['label'] = $this->iiif->getLabelForDisplay();
272 272
             $this->physicalStructureInfo[$iiifId]['orderlabel'] = $this->iiif->getLabelForDisplay();
273 273
             $this->physicalStructureInfo[$iiifId]['type'] = 'physSequence';
274
-            $this->physicalStructureInfo[$iiifId]['contentIds'] = null;
274
+            $this->physicalStructureInfo[$iiifId]['contentIds'] = NULL;
275 275
 
276 276
             $this->setFileUseDownload($iiifId, $this->iiif);
277 277
             $this->setFileUseFulltext($iiifId, $this->iiif);
@@ -296,20 +296,20 @@  discard block
 block discarded – undo
296 296
                     // populate structural metadata info
297 297
                     $elements[$canvasOrder] = $canvas->getId();
298 298
                     $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId();
299
-                    $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null;
299
+                    $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = NULL;
300 300
                     $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay();
301 301
                     $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay();
302 302
                     // assume that a canvas always represents a page
303 303
                     $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page';
304
-                    $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null;
305
-                    $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null;
304
+                    $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = NULL;
305
+                    $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL;
306 306
                     if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
307 307
                         $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = [];
308 308
                         foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) {
309 309
                             $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId();
310 310
                             if ($extConf['indexAnnotations']) {
311
-                                $this->hasFulltext = true;
312
-                                $this->hasFulltextSet = true;
311
+                                $this->hasFulltext = TRUE;
312
+                                $this->hasFulltextSet = TRUE;
313 313
                             }
314 314
                         }
315 315
                     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                     if (!empty($fileUses)) {
320 320
                         $image = $canvas->getImageAnnotations()[0];
321 321
                         foreach ($fileUses as $fileUse) {
322
-                            if ($image->getBody() !== null && $image->getBody() instanceof ContentResourceInterface) {
322
+                            if ($image->getBody() !== NULL && $image->getBody() instanceof ContentResourceInterface) {
323 323
                                 $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId();
324 324
                             }
325 325
                         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 array_unshift($elements, $iiifId);
336 336
                 $this->physicalStructure = $elements;
337 337
             }
338
-            $this->physicalStructureLoaded = true;
338
+            $this->physicalStructureLoaded = TRUE;
339 339
         }
340 340
         return $this->physicalStructure;
341 341
     }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $this->fileInfos[$id]['mimeType'] = $this->getFileMimeType($id);
367 367
         }
368 368
 
369
-        return $this->fileInfos[$id] ?? null;
369
+        return $this->fileInfos[$id] ?? NULL;
370 370
     }
371 371
 
372 372
     /**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public function getFileLocation(string $id): string
376 376
     {
377
-        if ($id == null) {
377
+        if ($id == NULL) {
378 378
             return '';
379 379
         }
380 380
         $resource = $this->iiif->getContainedResourceById($id);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             if ($resource instanceof CanvasInterface) {
383 383
                 // TODO: Cannot call method getSingleService() on array<Ubl\Iiif\Presentation\Common\Model\Resources\AnnotationInterface>.
384 384
                 // @phpstan-ignore-next-line
385
-                return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id;
385
+                return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id;
386 386
             } elseif ($resource instanceof ContentResourceInterface) {
387 387
                 return $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id;
388 388
             } elseif ($resource instanceof AbstractImageService) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         } elseif ($fileResource instanceof AnnotationInterface) {
406 406
             $format = "application/vnd.kitodo.iiif";
407 407
         } elseif ($fileResource instanceof ContentResourceInterface) {
408
-            if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) {
408
+            if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) {
409 409
                 // Support static images without an image service
410 410
                 return $fileResource->getFormat();
411 411
             }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     /**
423 423
      * @see AbstractDocument::getLogicalStructure()
424 424
      */
425
-    public function getLogicalStructure(string $id, bool $recursive = false): array
425
+    public function getLogicalStructure(string $id, bool $recursive = FALSE): array
426 426
     {
427 427
         $details = [];
428 428
         if (!$recursive && !empty($this->logicalUnits[$id])) {
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
                 // cache the ranges - they might occur multiple times in the structures "tree" - with full data as well as referenced as id
442 442
                 $processedStructures = [];
443 443
                 foreach ($logUnits as $logUnit) {
444
-                    if (array_search($logUnit->getId(), $processedStructures) == false) {
445
-                        $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures);
444
+                    if (array_search($logUnit->getId(), $processedStructures) == FALSE) {
445
+                        $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures);
446 446
                     }
447 447
                 }
448 448
             }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
      *
462 462
      * @return array Logical structure array
463 463
      */
464
-    protected function getLogicalStructureInfo(IiifResourceInterface $resource, bool $recursive = false, array &$processedStructures = []): array
464
+    protected function getLogicalStructureInfo(IiifResourceInterface $resource, bool $recursive = FALSE, array &$processedStructures = []): array
465 465
     {
466 466
         $details = [];
467 467
         $details['id'] = $resource->getId();
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         if (isset($startCanvas)) {
492 492
             $details['pagination'] = $startCanvas->getLabel();
493 493
             $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases());
494
-            if ($startCanvasIndex !== false) {
494
+            if ($startCanvasIndex !== FALSE) {
495 495
                 $details['points'] = $startCanvasIndex + 1;
496 496
             }
497 497
         }
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         if ($recursive) {
506 506
             $processedStructures[] = $resource->getId();
507 507
             $details['children'] = [];
508
-            if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) {
508
+            if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) {
509 509
                 $rangesToAdd = [];
510 510
                 $rootRanges = [];
511 511
                 if (count($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) {
@@ -517,15 +517,15 @@  discard block
 block discarded – undo
517 517
                     $rootRanges[] = $range;
518 518
                 }
519 519
                 foreach ($rootRanges as $range) {
520
-                    if ((array_search($range->getId(), $processedStructures) == false)) {
521
-                        $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures);
520
+                    if ((array_search($range->getId(), $processedStructures) == FALSE)) {
521
+                        $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures);
522 522
                     }
523 523
                 }
524 524
             } elseif ($resource instanceof RangeInterface) {
525 525
                 if (!empty($resource->getAllRanges())) {
526 526
                     foreach ($resource->getAllRanges() as $range) {
527
-                        if ((array_search($range->getId(), $processedStructures) == false)) {
528
-                            $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures);
527
+                        if ((array_search($range->getId(), $processedStructures) == FALSE)) {
528
+                            $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures);
529 529
                         }
530 530
                     }
531 531
                 }
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
      *
550 550
      * @todo This method is still in experimental; the method signature may change.
551 551
      */
552
-    public function getManifestMetadata(string $id, bool $withDescription = true, bool $withRights = true, bool $withRelated = true): array
552
+    public function getManifestMetadata(string $id, bool $withDescription = TRUE, bool $withRights = TRUE, bool $withRelated = TRUE): array
553 553
     {
554 554
         if (!empty($this->originalMetadataArray[$id])) {
555 555
             return $this->originalMetadataArray[$id];
556 556
         }
557 557
         $iiifResource = $this->iiif->getContainedResourceById($id);
558 558
         $result = [];
559
-        if ($iiifResource != null) {
559
+        if ($iiifResource != NULL) {
560 560
             if (!empty($iiifResource->getLabel())) {
561 561
                 $result['label'] = $iiifResource->getLabel();
562 562
             }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                     $this->smLinkRangeCanvasesRecursively($range);
690 690
                 }
691 691
             }
692
-            $this->smLinksLoaded = true;
692
+            $this->smLinksLoaded = TRUE;
693 693
         }
694 694
         return $this->smLinks;
695 695
     }
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
     protected function loadLocation(string $location): bool
807 807
     {
808 808
         $fileResource = GeneralUtility::getUrl($location);
809
-        if ($fileResource !== false) {
809
+        if ($fileResource !== FALSE) {
810 810
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif');
811 811
             IiifHelper::setUrlReader(IiifUrlReader::getInstance());
812 812
             IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']);
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
             $resource = IiifHelper::loadIiifResource($fileResource);
815 815
             if ($resource instanceof ManifestInterface) {
816 816
                 $this->iiif = $resource;
817
-                return true;
817
+                return TRUE;
818 818
             }
819 819
         }
820 820
         $this->logger->error('Could not load IIIF manifest from "' . $location . '"');
821
-        return false;
821
+        return FALSE;
822 822
     }
823 823
 
824 824
     /**
@@ -837,9 +837,9 @@  discard block
 block discarded – undo
837 837
     {
838 838
         if ($preloadedDocument instanceof ManifestInterface) {
839 839
             $this->iiif = $preloadedDocument;
840
-            return true;
840
+            return TRUE;
841 841
         }
842
-        return false;
842
+        return FALSE;
843 843
     }
844 844
 
845 845
     /**
@@ -861,23 +861,23 @@  discard block
 block discarded – undo
861 861
                     !empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) ||
862 862
                     !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/"))
863 863
                 ) {
864
-                    $this->hasFulltextSet = true;
865
-                    $this->hasFulltext = true;
864
+                    $this->hasFulltextSet = TRUE;
865
+                    $this->hasFulltext = TRUE;
866 866
                     return;
867 867
                 }
868 868
                 $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif');
869 869
                 if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
870 870
                     foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) {
871 871
                         $textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING);
872
-                        if ($textAnnotations != null) {
872
+                        if ($textAnnotations != NULL) {
873 873
                             foreach ($textAnnotations as $annotation) {
874 874
                                 if (
875
-                                    $annotation->getBody() != null &&
875
+                                    $annotation->getBody() != NULL &&
876 876
                                     $annotation->getBody()->getFormat() == "text/plain" &&
877
-                                    $annotation->getBody()->getChars() != null
877
+                                    $annotation->getBody()->getChars() != NULL
878 878
                                 ) {
879
-                                    $this->hasFulltextSet = true;
880
-                                    $this->hasFulltext = true;
879
+                                    $this->hasFulltextSet = TRUE;
880
+                                    $this->hasFulltext = TRUE;
881 881
                                     return;
882 882
                                 }
883 883
                             }
@@ -885,14 +885,14 @@  discard block
 block discarded – undo
885 885
                     }
886 886
                 }
887 887
             }
888
-            $this->hasFulltextSet = true;
888
+            $this->hasFulltextSet = TRUE;
889 889
         }
890 890
     }
891 891
 
892 892
     /**
893 893
      * @see AbstractDocument::magicGetThumbnail()
894 894
      */
895
-    protected function magicGetThumbnail(bool $forceReload = false): string
895
+    protected function magicGetThumbnail(bool $forceReload = FALSE): string
896 896
     {
897 897
         return $this->iiif->getThumbnailUrl();
898 898
     }
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
             foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) {
930 930
                 if (
931 931
                     $annotation->getTargetResourceId() == $iiifId &&
932
-                    $annotation->getBody() != null && $annotation->getBody()->getChars() != null
932
+                    $annotation->getBody() != NULL && $annotation->getBody()->getChars() != NULL
933 933
                 ) {
934 934
                     $annotationTexts[] = $annotation->getBody()->getChars();
935 935
                 }
@@ -977,13 +977,13 @@  discard block
 block discarded – undo
977 977
         if (!empty($fileUseFulltext)) {
978 978
             $alto = $iiif->getSeeAlsoUrlsForFormat('application/alto+xml');
979 979
             if (empty($alto)) {
980
-                $alto = $iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true);
980
+                $alto = $iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE);
981 981
             }
982 982
             if (!empty($alto)) {
983 983
                 $this->mimeTypes[$alto[0]] = 'application/alto+xml';
984 984
                 $this->physicalStructureInfo[$iiifId]['files'][$fileUseFulltext[0]] = $alto[0];
985
-                $this->hasFulltext = true;
986
-                $this->hasFulltextSet = true;
985
+                $this->hasFulltext = TRUE;
986
+                $this->hasFulltextSet = TRUE;
987 987
             }
988 988
         }
989 989
     }
Please login to merge, or discard this patch.
Classes/Common/Solr/SearchResult/Page.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 Page
24
-{
23
+class Page {
25 24
 
26 25
     /**
27 26
      * @access private
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      */
60
-    public function __construct(int $id, array $page)
61
-    {
59
+    public function __construct(int $id, array $page) {
62 60
         $this->id = $id;
63 61
         $this->name = $page['id'];
64 62
         $this->width = $page['width'];
Please login to merge, or discard this patch.
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   +17 added lines, -17 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.
@@ -669,22 +669,22 @@  discard block
 block discarded – undo
669 669
 
670 670
         // commit the index
671 671
         if ($commit) {
672
-            $update->addCommit(false);
672
+            $update->addCommit(FALSE);
673 673
         }
674 674
 
675 675
         // optimize the index
676 676
         if ($optimize) {
677
-            $update->addOptimize(false);
677
+            $update->addOptimize(FALSE);
678 678
         }
679 679
 
680 680
         // this executes the query and returns the result
681 681
         $result = $this->service->update($update);
682 682
 
683 683
         if ($result->getStatus()) {
684
-            return false;
684
+            return FALSE;
685 685
         }
686 686
 
687
-        return true;
687
+        return TRUE;
688 688
     }
689 689
 
690 690
     /**
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
         $result = $this->service->execute($query);
703 703
 
704 704
         if ($result->getResponse()->getStatusCode() == 400) {
705
-            return false;
705
+            return FALSE;
706 706
         }
707 707
 
708
-        return true;
708
+        return TRUE;
709 709
     }
710 710
 }
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.
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.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             // in which case metadata of toplevel entry isn't yet filled.
229 229
             if (empty($document['metadata'])) {
230 230
                 $document['metadata'] = $this->fetchToplevelMetadataFromSolr([
231
-                    'query' => 'uid:' . $document['uid'],
231
+                    'query' => 'uid:'.$document['uid'],
232 232
                     'start' => 0,
233 233
                     'rows' => 1,
234 234
                     'sort' => ['score' => 'desc'],
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             if (empty($document['title']) && $document['partOf'] > 0) {
240 240
                 $superiorTitle = AbstractDocument::getTitle($document['partOf'], true);
241 241
                 if (!empty($superiorTitle)) {
242
-                    $document['title'] = '[' . $superiorTitle . ']';
242
+                    $document['title'] = '['.$superiorTitle.']';
243 243
                 }
244 244
             }
245 245
         }
@@ -374,13 +374,13 @@  discard block
 block discarded – undo
374 374
         // Set search query.
375 375
         if (
376 376
             !empty($this->searchParams['fulltext'])
377
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query'] ?? ''), $matches)
377
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query'] ?? ''), $matches)
378 378
         ) {
379 379
             // If the query already is a fulltext query e.g using the facets
380 380
             $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1];
381 381
             // Search in fulltext field if applicable. Query must not be empty!
382 382
             if (!empty($this->searchParams['query'])) {
383
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
383
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')';
384 384
             }
385 385
             $params['fulltext'] = true;
386 386
         } else {
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
                         in_array($this->searchParams['extOperator'][$i], $allowedOperators)
404 404
                     ) {
405 405
                         if (!empty($query)) {
406
-                            $query .= ' ' . $this->searchParams['extOperator'][$i] . ' ';
406
+                            $query .= ' '.$this->searchParams['extOperator'][$i].' ';
407 407
                         }
408
-                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')';
408
+                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')';
409 409
                     }
410 410
                 }
411 411
             }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         // Add filter query for date search
415 415
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
416 416
             // combine dateFrom and dateTo into range search
417
-            $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
417
+            $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
418 418
         }
419 419
 
420 420
         // Add filter query for faceting.
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
         ) {
432 432
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
433 433
             $params['filterquery'][]['query'] = '_query_:"{!join from='
434
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
435
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
436
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from='
437
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
438
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR '
439
-                . $fields['uid'] . ':' . $this->searchParams['documentId'];
434
+                . $fields['uid'].' to='.$fields['partof'].'}'
435
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
436
+                . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from='
437
+                . $fields['uid'].' to='.$fields['partof'].'}'
438
+                . $fields['uid'].':'.$this->searchParams['documentId'].' OR '
439
+                . $fields['uid'].':'.$this->searchParams['documentId'];
440 440
         }
441 441
 
442 442
         // if collections are given, we prepare the collection query string
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
         if ($this->listedMetadata) {
457 457
             foreach ($this->listedMetadata as $metadata) {
458 458
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
459
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
460
-                    $params['fields'] .= ',' . $listMetadataRecord;
459
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
460
+                    $params['fields'] .= ','.$listMetadataRecord;
461 461
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
462 462
                 }
463 463
             }
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                             if ($this->searchParams['fulltext'] == '1') {
533 533
                                 $searchResult['snippet'] = $doc['snippet'];
534 534
                                 $searchResult['highlight'] = $doc['highlight'];
535
-                                $searchResult['highlight_word'] = preg_replace('/^;|;$/', '',       // remove ; at beginning or end
536
-                                                                  preg_replace('/;+/', ';',         // replace any multiple of ; with a single ;
535
+                                $searchResult['highlight_word'] = preg_replace('/^;|;$/', '', // remove ; at beginning or end
536
+                                                                  preg_replace('/;+/', ';', // replace any multiple of ; with a single ;
537 537
                                                                   preg_replace('/[{~\d*}{\s+}{^=*\d+.*\d*}`~!@#$%\^&*()_|+-=?;:\'",.<>\{\}\[\]\\\]/', ';', $this->searchParams['query']))); // replace search operators and special characters with ;
538 538
                             }
539 539
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                         
558 558
                                     // Fetch metadata for the current batch
559 559
                                     $metadataOf = $this->fetchToplevelMetadataFromSolr([
560
-                                        'query' => 'partof:' . $doc['uid'],
560
+                                        'query' => 'partof:'.$doc['uid'],
561 561
                                         'start' => $start,
562 562
                                         'rows' => min($batchSize, $totalChildren - $start),
563 563
                                     ]);
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
         if ($this->listedMetadata) {
610 610
             foreach ($this->listedMetadata as $metadata) {
611 611
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
612
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
613
-                    $params['fields'] .= ',' . $listMetadataRecord;
612
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
613
+                    $params['fields'] .= ','.$listMetadataRecord;
614 614
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
615 615
                 }
616 616
             }
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
         $cache = null;
662 662
         // Calculate cache identifier.
663 663
         if ($enableCache === true) {
664
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
664
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
665 665
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
666 666
         }
667 667
         $resultSet = [
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
             if ($this->indexedMetadata) {
680 680
                 foreach ($this->indexedMetadata as $metadata) {
681 681
                     if ($metadata->getIndexIndexed()) {
682
-                        $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . 'i';
683
-                        $queryFields .= $listMetadataRecord . '^' . $metadata->getIndexBoost() . ' ';
682
+                        $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').'i';
683
+                        $queryFields .= $listMetadataRecord.'^'.$metadata->getIndexBoost().' ';
684 684
                     }
685 685
                 }
686 686
             }
@@ -766,24 +766,24 @@  discard block
 block discarded – undo
766 766
         foreach ($this->collections as $collection) {
767 767
             // check for virtual collections query string
768 768
             if ($collection->getIndexSearch()) {
769
-                $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collection->getIndexSearch() . ')' : ' OR (' . $collection->getIndexSearch() . ')';
769
+                $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collection->getIndexSearch().')' : ' OR ('.$collection->getIndexSearch().')';
770 770
             } else {
771
-                $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collection->getIndexName() . '"' : ' OR "' . $collection->getIndexName() . '"';
771
+                $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collection->getIndexName().'"' : ' OR "'.$collection->getIndexName().'"';
772 772
             }
773 773
         }
774 774
 
775 775
         // distinguish between simple collection browsing and actual searching within the collection(s)
776 776
         if (!empty($collectionsQueryString)) {
777 777
             if (empty($query)) {
778
-                $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)';
778
+                $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)';
779 779
             } else {
780
-                $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))';
780
+                $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))';
781 781
             }
782 782
         }
783 783
 
784 784
         // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately
785 785
         if (!empty($virtualCollectionsQueryString)) {
786
-            $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')';
786
+            $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')';
787 787
         }
788 788
 
789 789
         // combine both query strings into a single filterquery via OR if both are given, otherwise pass either of those
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
     private function translateLanguageCode(&$doc): void
862 862
     {
863 863
         if (is_array($doc['metadata']) && array_key_exists('language', $doc['metadata'])) {
864
-            foreach($doc['metadata']['language'] as $indexName => $language) {
864
+            foreach ($doc['metadata']['language'] as $indexName => $language) {
865 865
                 $doc['metadata']['language'][$indexName] = Helper::getLanguageName($language);
866 866
             }
867 867
         }
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.