@@ -23,8 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class StdWrapViewHelper extends AbstractViewHelper |
|
27 | -{ |
|
26 | +class StdWrapViewHelper extends AbstractViewHelper { |
|
28 | 27 | /** |
29 | 28 | * @access protected |
30 | 29 | * @var bool |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @access protected |
30 | 30 | * @var bool |
31 | 31 | */ |
32 | - protected $escapeOutput = false; |
|
32 | + protected $escapeOutput = FALSE; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Initializes arguments. |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | public function initializeArguments(): void |
42 | 42 | { |
43 | 43 | parent::initializeArguments(); |
44 | - $this->registerArgument('wrap', 'string', 'The wrap information', true); |
|
45 | - $this->registerArgument('data', 'array', 'Data for the content object', false); |
|
44 | + $this->registerArgument('wrap', 'string', 'The wrap information', TRUE); |
|
45 | + $this->registerArgument('data', 'array', 'Data for the content object', FALSE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -39,8 +39,7 @@ |
||
39 | 39 | * |
40 | 40 | * @access public |
41 | 41 | */ |
42 | -class MetadataWrapVariableViewHelper extends AbstractViewHelper |
|
43 | -{ |
|
42 | +class MetadataWrapVariableViewHelper extends AbstractViewHelper { |
|
44 | 43 | /** |
45 | 44 | * @access public |
46 | 45 | * |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function initializeArguments(): void |
50 | 50 | { |
51 | - $this->registerArgument('name', 'string', 'Name of variable to create', true); |
|
51 | + $this->registerArgument('name', 'string', 'Name of variable to create', TRUE); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class JsFooterViewHelper extends AbstractViewHelper |
|
29 | -{ |
|
28 | +class JsFooterViewHelper extends AbstractViewHelper { |
|
30 | 29 | /** |
31 | 30 | * Initialize arguments. |
32 | 31 | * |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public function initializeArguments(): void |
36 | 36 | { |
37 | 37 | parent::initializeArguments(); |
38 | - $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', true); |
|
38 | + $this->registerArgument('inlineCode', 'string', 'Inline JavaScript', TRUE); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -15,8 +15,7 @@ |
||
15 | 15 | use Kitodo\Dlf\Common\Solr\SolrSearch; |
16 | 16 | use TYPO3\CMS\Core\Pagination\AbstractPaginator; |
17 | 17 | |
18 | -class SolrPaginator extends AbstractPaginator |
|
19 | -{ |
|
18 | +class SolrPaginator extends AbstractPaginator { |
|
20 | 19 | /** |
21 | 20 | * @var SolrSearch |
22 | 21 | */ |
@@ -653,16 +653,16 @@ discard block |
||
653 | 653 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
654 | 654 | $values = $iiifResource->jsonPath($resArray['xpath_sorting']); |
655 | 655 | if (is_string($values)) { |
656 | - $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
|
656 | + $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)]; |
|
657 | 657 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
658 | 658 | $metadata[$resArray['index_name']] = []; |
659 | 659 | foreach ($values->data() as $value) { |
660 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value); |
|
660 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
664 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
665 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
664 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
665 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | } |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | } |
773 | 773 | } |
774 | 774 | } else { |
775 | - $this->logger->warning('Invalid structure resource @id "' . $id . '"'); |
|
775 | + $this->logger->warning('Invalid structure resource @id "'.$id.'"'); |
|
776 | 776 | return $rawText; |
777 | 777 | } |
778 | 778 | $this->rawTextArray[$id] = $rawText; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | return true; |
818 | 818 | } |
819 | 819 | } |
820 | - $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
|
820 | + $this->logger->error('Could not load IIIF manifest from "'.$location.'"'); |
|
821 | 821 | return false; |
822 | 822 | } |
823 | 823 |
@@ -75,8 +75,7 @@ discard block |
||
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 |
||
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'); |
@@ -101,7 +101,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -20,8 +20,7 @@ discard block |
||
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 |
||
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']; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $this->xEndPosition = $highlight['lrx']; |
88 | 88 | $this->yBeginPosition = $highlight['uly']; |
89 | 89 | $this->yEndPosition = $highlight['lry']; |
90 | - $this->id = $this->xBeginPosition . '_' . $this->yBeginPosition; |
|
90 | + $this->id = $this->xBeginPosition.'_'.$this->yBeginPosition; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -20,8 +20,7 @@ discard block |
||
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 |
||
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']; |
@@ -22,8 +22,7 @@ discard block |
||
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 |
||
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']]; |
@@ -65,7 +65,7 @@ discard block |
||
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 |
||
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])) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | // Get next available core name if none given. |
129 | 129 | if (empty($core)) { |
130 | - $core = 'dlfCore' . self::getNextCoreNumber(); |
|
130 | + $core = 'dlfCore'.self::getNextCoreNumber(); |
|
131 | 131 | } |
132 | 132 | // Get Solr service instance. |
133 | 133 | $solr = self::getInstance($core); |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | ->execute(); |
218 | 218 | |
219 | 219 | while ($resArray = $result->fetchAssociative()) { |
220 | - $fields[] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . ($resArray['index_stored'] ? 's' : 'u') . 'i'; |
|
220 | + $fields[] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').($resArray['index_stored'] ? 's' : 'u').'i'; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // Check if queried field is valid. |
224 | 224 | $splitQuery = explode(':', $query, 2); |
225 | 225 | if (in_array($splitQuery[0], $fields)) { |
226 | - $query = $splitQuery[0] . ':(' . self::escapeQuery(trim($splitQuery[1], '()')) . ')'; |
|
226 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
227 | 227 | } else { |
228 | 228 | $query = self::escapeQuery($query); |
229 | 229 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | { |
331 | 331 | $number = max($number, 0); |
332 | 332 | // Check if core already exists. |
333 | - $solr = self::getInstance('dlfCore' . $number); |
|
333 | + $solr = self::getInstance('dlfCore'.$number); |
|
334 | 334 | if (!$solr->ready) { |
335 | 335 | return $number; |
336 | 336 | } else { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $parameters['start'] = 0; |
389 | 389 | $parameters['rows'] = $this->limit; |
390 | 390 | // Calculate cache identifier. |
391 | - $cacheIdentifier = Helper::digest($this->core . print_r(array_merge($this->params, $parameters), true)); |
|
391 | + $cacheIdentifier = Helper::digest($this->core.print_r(array_merge($this->params, $parameters), true)); |
|
392 | 392 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr'); |
393 | 393 | $resultSet = []; |
394 | 394 | $entry = $cache->get($cacheIdentifier); |
@@ -520,12 +520,12 @@ discard block |
||
520 | 520 | */ |
521 | 521 | public function __get(string $var) |
522 | 522 | { |
523 | - $method = 'magicGet' . ucfirst($var); |
|
523 | + $method = 'magicGet'.ucfirst($var); |
|
524 | 524 | if ( |
525 | 525 | !property_exists($this, $var) |
526 | 526 | || !method_exists($this, $method) |
527 | 527 | ) { |
528 | - $this->logger->warning('There is no getter function for property "' . $var . '"'); |
|
528 | + $this->logger->warning('There is no getter function for property "'.$var.'"'); |
|
529 | 529 | return null; |
530 | 530 | } else { |
531 | 531 | return $this->$method(); |
@@ -558,12 +558,12 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function __set(string $var, $value): void |
560 | 560 | { |
561 | - $method = 'magicSet' . ucfirst($var); |
|
561 | + $method = 'magicSet'.ucfirst($var); |
|
562 | 562 | if ( |
563 | 563 | !property_exists($this, $var) |
564 | 564 | || !method_exists($this, $method) |
565 | 565 | ) { |
566 | - $this->logger->warning('There is no setter function for property "' . $var . '"'); |
|
566 | + $this->logger->warning('There is no setter function for property "'.$var.'"'); |
|
567 | 567 | } else { |
568 | 568 | $this->$method($value); |
569 | 569 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | 'scheme' => $this->config['scheme'], |
604 | 604 | 'host' => $this->config['host'], |
605 | 605 | 'port' => $this->config['port'], |
606 | - 'path' => '/' . $this->config['path'], |
|
606 | + 'path' => '/'.$this->config['path'], |
|
607 | 607 | 'core' => $core, |
608 | 608 | 'username' => $this->config['username'], |
609 | 609 | 'password' => $this->config['password'] |
@@ -42,8 +42,7 @@ discard block |
||
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 |
||
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 |
||
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. |
@@ -56,7 +56,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |