@@ -23,10 +23,8 @@ |
||
23 | 23 | * @subpackage dlf |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class DocumentTypeProvider extends AbstractProvider |
|
27 | -{ |
|
28 | - public function __construct() |
|
29 | - { |
|
26 | +class DocumentTypeProvider extends AbstractProvider { |
|
27 | + public function __construct() { |
|
30 | 28 | $this->expressionLanguageProviders = [ |
31 | 29 | DocumentTypeFunctionProvider::class |
32 | 30 | ]; |
@@ -24,8 +24,7 @@ |
||
24 | 24 | * @subpackage dlf |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class SolrCoreStatus extends AbstractNode |
|
28 | -{ |
|
27 | +class SolrCoreStatus extends AbstractNode { |
|
29 | 28 | /** |
30 | 29 | * Shows Solr core status for given 'index_name' |
31 | 30 | * |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $uptimeInSeconds = floor($response->getUptime() / 1000); |
56 | 56 | $dateTimeFrom = new \DateTime('@0'); |
57 | 57 | $dateTimeTo = new \DateTime("@$uptimeInSeconds"); |
58 | - $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a ' . Helper::getLanguageService()->getLL('flash.days') . ', %H:%I:%S'); |
|
58 | + $uptime = $dateTimeFrom->diff($dateTimeTo)->format('%a '.Helper::getLanguageService()->getLL('flash.days').', %H:%I:%S'); |
|
59 | 59 | $numDocuments = $response->getNumberOfDocuments(); |
60 | 60 | $startTime = $response->getStartTime() ? strftime('%c', $response->getStartTime()->getTimestamp()) : 'N/A'; |
61 | 61 | $lastModified = $response->getLastModified() ? strftime('%c', $response->getLastModified()->getTimestamp()) : 'N/A'; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | * @subpackage dlf |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class EditInProductionWarning extends AbstractNode |
|
27 | -{ |
|
26 | +class EditInProductionWarning extends AbstractNode { |
|
28 | 27 | /** |
29 | 28 | * Generates warning message when editing 'index_name' field |
30 | 29 | * |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
695 | 695 | ) { |
696 | 696 | if (is_string($values)) { |
697 | - $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
|
697 | + $metadata[$resArray['index_name'].'_sorting'][0] = [trim((string) $values)]; |
|
698 | 698 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
699 | 699 | $metadata[$resArray['index_name']] = []; |
700 | 700 | foreach ($values->data() as $value) { |
701 | - $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $value); |
|
701 | + $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $value); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | } |
705 | - if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) { |
|
706 | - $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
705 | + if (empty($metadata[$resArray['index_name'].'_sorting'][0])) { |
|
706 | + $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0]; |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | } |
832 | 832 | } |
833 | 833 | } else { |
834 | - $this->logger->warning('Invalid structure resource @id "' . $id . '"'); |
|
834 | + $this->logger->warning('Invalid structure resource @id "'.$id.'"'); |
|
835 | 835 | return $rawText; |
836 | 836 | } |
837 | 837 | $this->rawTextArray[$id] = $rawText; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | } |
883 | - $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
|
883 | + $this->logger->error('Could not load IIIF manifest from "'.$location.'"'); |
|
884 | 884 | return false; |
885 | 885 | } |
886 | 886 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @var bool |
87 | 87 | * @access protected |
88 | 88 | */ |
89 | - protected $hasFulltextSet = false; |
|
89 | + protected $hasFulltextSet = FALSE; |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * This holds the original manifest's parsed metadata array with their corresponding |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function establishRecordId($pid) |
121 | 121 | { |
122 | - if ($this->iiif !== null) { |
|
122 | + if ($this->iiif !== NULL) { |
|
123 | 123 | /* |
124 | 124 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
125 | 125 | * if the plugin that actually loads the manifest allows content from other pages. |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @var bool |
204 | 204 | * @access protected |
205 | 205 | */ |
206 | - protected $useGrpsLoaded = false; |
|
206 | + protected $useGrpsLoaded = FALSE; |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * Holds the configured useGrps as array. |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | if (!empty($extConf['fileGrpAudio'])) { |
246 | 246 | $this->useGrps['fileGrpAudio'] = GeneralUtility::trimExplode(',', $extConf['fileGrpAudio']); |
247 | 247 | } |
248 | - $this->useGrpsLoaded = true; |
|
248 | + $this->useGrpsLoaded = TRUE; |
|
249 | 249 | } |
250 | 250 | return array_key_exists($use, $this->useGrps) ? $this->useGrps[$use] : []; |
251 | 251 | } |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | { |
259 | 259 | // Is there no physical structure array yet? |
260 | 260 | if (!$this->physicalStructureLoaded) { |
261 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
262 | - return null; |
|
261 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
262 | + return NULL; |
|
263 | 263 | } |
264 | 264 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
265 | 265 | $iiifId = $this->iiif->getId(); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
270 | 270 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
271 | 271 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
272 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
272 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
273 | 273 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
274 | 274 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
275 | 275 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -283,13 +283,13 @@ discard block |
||
283 | 283 | if (!empty($fileUseFulltext)) { |
284 | 284 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat('application/alto+xml'); |
285 | 285 | if (empty($iiifAlto)) { |
286 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
286 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
287 | 287 | } |
288 | 288 | if (!empty($iiifAlto)) { |
289 | 289 | $this->mimeTypes[$iiifAlto[0]] = 'application/alto+xml'; |
290 | 290 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext[0]] = $iiifAlto[0]; |
291 | - $this->hasFulltext = true; |
|
292 | - $this->hasFulltextSet = true; |
|
291 | + $this->hasFulltext = TRUE; |
|
292 | + $this->hasFulltextSet = TRUE; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -308,39 +308,39 @@ discard block |
||
308 | 308 | // populate structural metadata info |
309 | 309 | $elements[$canvasOrder] = $canvas->getId(); |
310 | 310 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
311 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
311 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = NULL; |
|
312 | 312 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
313 | 313 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
314 | 314 | // assume that a canvas always represents a page |
315 | 315 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
316 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
317 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
316 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = NULL; |
|
317 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
318 | 318 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
319 | 319 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = []; |
320 | 320 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
321 | 321 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
322 | 322 | if ($extConf['indexAnnotations']) { |
323 | - $this->hasFulltext = true; |
|
324 | - $this->hasFulltextSet = true; |
|
323 | + $this->hasFulltext = TRUE; |
|
324 | + $this->hasFulltextSet = TRUE; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | } |
328 | 328 | if (!empty($fileUseFulltext)) { |
329 | 329 | $alto = $canvas->getSeeAlsoUrlsForFormat('application/alto+xml'); |
330 | 330 | if (empty($alto)) { |
331 | - $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
331 | + $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
332 | 332 | } |
333 | 333 | if (!empty($alto)) { |
334 | 334 | $this->mimeTypes[$alto[0]] = 'application/alto+xml'; |
335 | 335 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext[0]] = $alto[0]; |
336 | - $this->hasFulltext = true; |
|
337 | - $this->hasFulltextSet = true; |
|
336 | + $this->hasFulltext = TRUE; |
|
337 | + $this->hasFulltextSet = TRUE; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | if (!empty($fileUses)) { |
341 | 341 | $image = $canvas->getImageAnnotations()[0]; |
342 | 342 | foreach ($fileUses as $fileUse) { |
343 | - if ($image->getBody() !== null && $image->getBody() instanceof ContentResourceInterface) { |
|
343 | + if ($image->getBody() !== NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
344 | 344 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
345 | 345 | } |
346 | 346 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Merge and re-index the array to get nice numeric indexes. |
360 | 360 | $this->physicalStructure = array_merge($physSeq, $elements); |
361 | 361 | } |
362 | - $this->physicalStructureLoaded = true; |
|
362 | + $this->physicalStructureLoaded = TRUE; |
|
363 | 363 | } |
364 | 364 | return $this->physicalStructure; |
365 | 365 | } |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function getFileLocation($id) |
386 | 386 | { |
387 | - if ($id == null) { |
|
388 | - return null; |
|
387 | + if ($id == NULL) { |
|
388 | + return NULL; |
|
389 | 389 | } |
390 | 390 | $resource = $this->iiif->getContainedResourceById($id); |
391 | 391 | if (isset($resource)) { |
392 | 392 | if ($resource instanceof CanvasInterface) { |
393 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
393 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
394 | 394 | } elseif ($resource instanceof ContentResourceInterface) { |
395 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
395 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
396 | 396 | } elseif ($resource instanceof AbstractImageService) { |
397 | 397 | return $resource->getId(); |
398 | 398 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | } elseif ($fileResource instanceof AnnotationInterface) { |
416 | 416 | $format = "application/vnd.kitodo.iiif"; |
417 | 417 | } elseif ($fileResource instanceof ContentResourceInterface) { |
418 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
418 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
419 | 419 | // Support static images without an image service |
420 | 420 | return $fileResource->getFormat(); |
421 | 421 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * {@inheritDoc} |
434 | 434 | * @see Doc::getLogicalStructure() |
435 | 435 | */ |
436 | - public function getLogicalStructure($id, $recursive = false) |
|
436 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
437 | 437 | { |
438 | 438 | $details = []; |
439 | 439 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | // cache the ranges - they might occure multiple times in the structures "tree" - with full data as well as referenced as id |
451 | 451 | $processedStructures = []; |
452 | 452 | foreach ($logUnits as $logUnit) { |
453 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
454 | - $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures); |
|
453 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
454 | + $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | * @param array $processedStructures: IIIF resources that already have been processed |
470 | 470 | * @return array Logical structure array |
471 | 471 | */ |
472 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
472 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) |
|
473 | 473 | { |
474 | 474 | $details = []; |
475 | 475 | $details['id'] = $resource->getId(); |
476 | 476 | $details['dmdId'] = ''; |
477 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
478 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
477 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
478 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
479 | 479 | $details['contentIds'] = ''; |
480 | 480 | $details['volume'] = ''; |
481 | 481 | $details['pagination'] = ''; |
@@ -500,10 +500,10 @@ discard block |
||
500 | 500 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
501 | 501 | $canvases = $resource->getAllCanvases(); |
502 | 502 | } |
503 | - if ($startCanvas != null) { |
|
503 | + if ($startCanvas != NULL) { |
|
504 | 504 | $details['pagination'] = $startCanvas->getLabel(); |
505 | 505 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
506 | - if ($startCanvasIndex !== false) { |
|
506 | + if ($startCanvasIndex !== FALSE) { |
|
507 | 507 | $details['points'] = $startCanvasIndex + 1; |
508 | 508 | } |
509 | 509 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($recursive) { |
518 | 518 | $processedStructures[] = $resource->getId(); |
519 | 519 | $details['children'] = []; |
520 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
520 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
521 | 521 | $rangesToAdd = []; |
522 | 522 | $rootRanges = []; |
523 | 523 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -529,15 +529,15 @@ discard block |
||
529 | 529 | $rootRanges[] = $range; |
530 | 530 | } |
531 | 531 | foreach ($rootRanges as $range) { |
532 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
533 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
532 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
533 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
534 | 534 | } |
535 | 535 | } |
536 | 536 | } elseif ($resource instanceof RangeInterface) { |
537 | 537 | if (!empty($resource->getAllRanges())) { |
538 | 538 | foreach ($resource->getAllRanges() as $range) { |
539 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
540 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
539 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
540 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | } |
@@ -562,15 +562,15 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @todo This method is still in experimental; the method signature may change. |
564 | 564 | */ |
565 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
565 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) |
|
566 | 566 | { |
567 | 567 | if (!empty($this->originalMetadataArray[$id])) { |
568 | 568 | return $this->originalMetadataArray[$id]; |
569 | 569 | } |
570 | 570 | $iiifResource = $this->iiif->getContainedResourceById($id); |
571 | 571 | $result = []; |
572 | - if ($iiifResource != null) { |
|
573 | - if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
572 | + if ($iiifResource != NULL) { |
|
573 | + if ($iiifResource->getLabel() != NULL && $iiifResource->getLabel() != "") { |
|
574 | 574 | $result['label'] = $iiifResource->getLabel(); |
575 | 575 | } |
576 | 576 | if (!empty($iiifResource->getMetadata())) { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | $iiifResource = $this->iiif->getContainedResourceById($id); |
673 | 673 | while ($resArray = $result->fetch()) { |
674 | 674 | // Set metadata field's value(s). |
675 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
675 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
676 | 676 | if (is_string($values)) { |
677 | 677 | $metadata[$resArray['index_name']] = [trim((string) $values)]; |
678 | 678 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
691 | 691 | if ( |
692 | 692 | $resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
693 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
|
693 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL) |
|
694 | 694 | ) { |
695 | 695 | if (is_string($values)) { |
696 | 696 | $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $this->smLinkRangeCanvasesRecursively($range); |
727 | 727 | } |
728 | 728 | } |
729 | - $this->smLinksLoaded = true; |
|
729 | + $this->smLinksLoaded = TRUE; |
|
730 | 730 | } |
731 | 731 | return $this->smLinks; |
732 | 732 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
809 | 809 | if ( |
810 | 810 | $annotation->getTargetResourceId() == $iiifResource->getId() && |
811 | - $annotation->getBody() != null && $annotation->getBody()->getChars() != null |
|
811 | + $annotation->getBody() != NULL && $annotation->getBody()->getChars() != NULL |
|
812 | 812 | ) { |
813 | 813 | $annotationTexts[] = $annotation->getBody()->getChars(); |
814 | 814 | } |
@@ -854,21 +854,21 @@ discard block |
||
854 | 854 | protected function loadLocation($location) |
855 | 855 | { |
856 | 856 | $fileResource = GeneralUtility::getUrl($location); |
857 | - if ($fileResource !== false) { |
|
857 | + if ($fileResource !== FALSE) { |
|
858 | 858 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
859 | 859 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
860 | 860 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
861 | 861 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
862 | 862 | $resource = IiifHelper::loadIiifResource($fileResource); |
863 | - if ($resource != null) { |
|
863 | + if ($resource != NULL) { |
|
864 | 864 | if ($resource instanceof ManifestInterface) { |
865 | 865 | $this->iiif = $resource; |
866 | - return true; |
|
866 | + return TRUE; |
|
867 | 867 | } |
868 | 868 | } |
869 | 869 | } |
870 | 870 | $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
871 | - return false; |
|
871 | + return FALSE; |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | /** |
@@ -889,9 +889,9 @@ discard block |
||
889 | 889 | { |
890 | 890 | if ($preloadedDocument instanceof ManifestInterface) { |
891 | 891 | $this->iiif = $preloadedDocument; |
892 | - return true; |
|
892 | + return TRUE; |
|
893 | 893 | } |
894 | - return false; |
|
894 | + return FALSE; |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | /** |
@@ -914,22 +914,22 @@ discard block |
||
914 | 914 | !empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
915 | 915 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/")) |
916 | 916 | ) { |
917 | - $this->hasFulltextSet = true; |
|
918 | - $this->hasFulltext = true; |
|
917 | + $this->hasFulltextSet = TRUE; |
|
918 | + $this->hasFulltext = TRUE; |
|
919 | 919 | return; |
920 | 920 | } |
921 | 921 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
922 | 922 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
923 | 923 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
924 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
924 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
925 | 925 | foreach ($textAnnotations as $annotation) { |
926 | 926 | if ( |
927 | - $annotation->getBody() != null && |
|
927 | + $annotation->getBody() != NULL && |
|
928 | 928 | $annotation->getBody()->getFormat() == "text/plain" && |
929 | - $annotation->getBody()->getChars() != null |
|
929 | + $annotation->getBody()->getChars() != NULL |
|
930 | 930 | ) { |
931 | - $this->hasFulltextSet = true; |
|
932 | - $this->hasFulltext = true; |
|
931 | + $this->hasFulltextSet = TRUE; |
|
932 | + $this->hasFulltext = TRUE; |
|
933 | 933 | return; |
934 | 934 | } |
935 | 935 | } |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | } |
938 | 938 | } |
939 | 939 | } |
940 | - $this->hasFulltextSet = true; |
|
940 | + $this->hasFulltextSet = TRUE; |
|
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | * {@inheritDoc} |
946 | 946 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
947 | 947 | */ |
948 | - protected function _getThumbnail($forceReload = false) |
|
948 | + protected function _getThumbnail($forceReload = FALSE) |
|
949 | 949 | { |
950 | 950 | return $this->iiif->getThumbnailUrl(); |
951 | 951 | } |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
980 | 980 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
981 | 981 | $resource = IiifHelper::loadIiifResource($this->asJson); |
982 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
982 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
983 | 983 | $this->asJson = ''; |
984 | 984 | $this->iiif = $resource; |
985 | 985 | $this->init(''); |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | * @property-read string $thumbnail This holds the document's thumbnail location |
57 | 57 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
58 | 58 | */ |
59 | -final class IiifManifest extends Doc |
|
60 | -{ |
|
59 | +final class IiifManifest extends Doc { |
|
61 | 60 | /** |
62 | 61 | * This holds the manifest file as string for serialization purposes |
63 | 62 | * @see __sleep() / __wakeup() |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | * {@inheritDoc} |
119 | 118 | * @see Doc::establishRecordId() |
120 | 119 | */ |
121 | - protected function establishRecordId($pid) |
|
122 | - { |
|
120 | + protected function establishRecordId($pid) { |
|
123 | 121 | if ($this->iiif !== null) { |
124 | 122 | /* |
125 | 123 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -174,8 +172,7 @@ discard block |
||
174 | 172 | * {@inheritDoc} |
175 | 173 | * @see Doc::getDocument() |
176 | 174 | */ |
177 | - protected function getDocument() |
|
178 | - { |
|
175 | + protected function getDocument() { |
|
179 | 176 | return $this->iiif; |
180 | 177 | } |
181 | 178 | |
@@ -188,8 +185,7 @@ discard block |
||
188 | 185 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
189 | 186 | * the resource is a Presentation API 2 / 3 resource |
190 | 187 | */ |
191 | - public function getIiifVersion() |
|
192 | - { |
|
188 | + public function getIiifVersion() { |
|
193 | 189 | if (!isset($this->iiifVersion)) { |
194 | 190 | if ($this->iiif instanceof AbstractIiifResource1) { |
195 | 191 | $this->iiifVersion = 'IIIF1'; |
@@ -230,8 +226,7 @@ discard block |
||
230 | 226 | * |
231 | 227 | * @return array|string |
232 | 228 | */ |
233 | - protected function getUseGroups($use) |
|
234 | - { |
|
229 | + protected function getUseGroups($use) { |
|
235 | 230 | if (!$this->useGrpsLoaded) { |
236 | 231 | // Get configured USE attributes. |
237 | 232 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -259,8 +254,7 @@ discard block |
||
259 | 254 | * {@inheritDoc} |
260 | 255 | * @see Doc::_getPhysicalStructure() |
261 | 256 | */ |
262 | - protected function _getPhysicalStructure() |
|
263 | - { |
|
257 | + protected function _getPhysicalStructure() { |
|
264 | 258 | // Is there no physical structure array yet? |
265 | 259 | if (!$this->physicalStructureLoaded) { |
266 | 260 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -373,8 +367,7 @@ discard block |
||
373 | 367 | * {@inheritDoc} |
374 | 368 | * @see Doc::getDownloadLocation() |
375 | 369 | */ |
376 | - public function getDownloadLocation($id) |
|
377 | - { |
|
370 | + public function getDownloadLocation($id) { |
|
378 | 371 | $fileLocation = $this->getFileLocation($id); |
379 | 372 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
380 | 373 | if ($resource instanceof AbstractImageService) { |
@@ -387,8 +380,7 @@ discard block |
||
387 | 380 | * {@inheritDoc} |
388 | 381 | * @see Doc::getFileLocation() |
389 | 382 | */ |
390 | - public function getFileLocation($id) |
|
391 | - { |
|
383 | + public function getFileLocation($id) { |
|
392 | 384 | if ($id == null) { |
393 | 385 | return null; |
394 | 386 | } |
@@ -412,8 +404,7 @@ discard block |
||
412 | 404 | * {@inheritDoc} |
413 | 405 | * @see Doc::getFileMimeType() |
414 | 406 | */ |
415 | - public function getFileMimeType($id) |
|
416 | - { |
|
407 | + public function getFileMimeType($id) { |
|
417 | 408 | $fileResource = $this->iiif->getContainedResourceById($id); |
418 | 409 | if ($fileResource instanceof CanvasInterface) { |
419 | 410 | $format = "application/vnd.kitodo.iiif"; |
@@ -438,8 +429,7 @@ discard block |
||
438 | 429 | * {@inheritDoc} |
439 | 430 | * @see Doc::getLogicalStructure() |
440 | 431 | */ |
441 | - public function getLogicalStructure($id, $recursive = false) |
|
442 | - { |
|
432 | + public function getLogicalStructure($id, $recursive = false) { |
|
443 | 433 | $details = []; |
444 | 434 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
445 | 435 | return $this->logicalUnits[$id]; |
@@ -474,8 +464,7 @@ discard block |
||
474 | 464 | * @param array $processedStructures: IIIF resources that already have been processed |
475 | 465 | * @return array Logical structure array |
476 | 466 | */ |
477 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
478 | - { |
|
467 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
479 | 468 | $details = []; |
480 | 469 | $details['id'] = $resource->getId(); |
481 | 470 | $details['dmdId'] = ''; |
@@ -567,8 +556,7 @@ discard block |
||
567 | 556 | * |
568 | 557 | * @todo This method is still in experimental; the method signature may change. |
569 | 558 | */ |
570 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
571 | - { |
|
559 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
572 | 560 | if (!empty($this->originalMetadataArray[$id])) { |
573 | 561 | return $this->originalMetadataArray[$id]; |
574 | 562 | } |
@@ -610,8 +598,7 @@ discard block |
||
610 | 598 | * {@inheritDoc} |
611 | 599 | * @see Doc::getMetadata() |
612 | 600 | */ |
613 | - public function getMetadata($id, $cPid = 0) |
|
614 | - { |
|
601 | + public function getMetadata($id, $cPid = 0) { |
|
615 | 602 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
616 | 603 | return $this->metadataArray[$id]; |
617 | 604 | } |
@@ -718,8 +705,7 @@ discard block |
||
718 | 705 | * {@inheritDoc} |
719 | 706 | * @see Doc::_getSmLinks() |
720 | 707 | */ |
721 | - protected function _getSmLinks() |
|
722 | - { |
|
708 | + protected function _getSmLinks() { |
|
723 | 709 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
724 | 710 | if (!empty($this->iiif->getDefaultCanvases())) { |
725 | 711 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -743,8 +729,7 @@ discard block |
||
743 | 729 | * |
744 | 730 | * @param RangeInterface $range: Current range whose canvases shall be linked |
745 | 731 | */ |
746 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
747 | - { |
|
732 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
748 | 733 | // map range's canvases including all child ranges' canvases |
749 | 734 | if (!$range->isTopRange()) { |
750 | 735 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -767,8 +752,7 @@ discard block |
||
767 | 752 | * @param CanvasInterface $canvas |
768 | 753 | * @param IiifResourceInterface $resource |
769 | 754 | */ |
770 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
771 | - { |
|
755 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
772 | 756 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
773 | 757 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
774 | 758 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -780,8 +764,7 @@ discard block |
||
780 | 764 | * @see Doc::getFullText() |
781 | 765 | */ |
782 | 766 | //TODO: rewrite it to get full OCR |
783 | - public function getFullText($id) |
|
784 | - { |
|
767 | + public function getFullText($id) { |
|
785 | 768 | $rawText = ''; |
786 | 769 | // Get text from raw text array if available. |
787 | 770 | if (!empty($this->rawTextArray[$id])) { |
@@ -838,8 +821,7 @@ discard block |
||
838 | 821 | * |
839 | 822 | * @return IiifResourceInterface |
840 | 823 | */ |
841 | - public function getIiif() |
|
842 | - { |
|
824 | + public function getIiif() { |
|
843 | 825 | return $this->iiif; |
844 | 826 | } |
845 | 827 | |
@@ -847,8 +829,7 @@ discard block |
||
847 | 829 | * {@inheritDoc} |
848 | 830 | * @see Doc::init() |
849 | 831 | */ |
850 | - protected function init($location) |
|
851 | - { |
|
832 | + protected function init($location) { |
|
852 | 833 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
853 | 834 | } |
854 | 835 | |
@@ -856,8 +837,7 @@ discard block |
||
856 | 837 | * {@inheritDoc} |
857 | 838 | * @see Doc::loadLocation() |
858 | 839 | */ |
859 | - protected function loadLocation($location) |
|
860 | - { |
|
840 | + protected function loadLocation($location) { |
|
861 | 841 | $fileResource = GeneralUtility::getUrl($location); |
862 | 842 | if ($fileResource !== false) { |
863 | 843 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -880,8 +860,7 @@ discard block |
||
880 | 860 | * {@inheritDoc} |
881 | 861 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
882 | 862 | */ |
883 | - protected function prepareMetadataArray($cPid) |
|
884 | - { |
|
863 | + protected function prepareMetadataArray($cPid) { |
|
885 | 864 | $id = $this->iiif->getId(); |
886 | 865 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
887 | 866 | } |
@@ -890,8 +869,7 @@ discard block |
||
890 | 869 | * {@inheritDoc} |
891 | 870 | * @see Doc::setPreloadedDocument() |
892 | 871 | */ |
893 | - protected function setPreloadedDocument($preloadedDocument) |
|
894 | - { |
|
872 | + protected function setPreloadedDocument($preloadedDocument) { |
|
895 | 873 | if ($preloadedDocument instanceof ManifestInterface) { |
896 | 874 | $this->iiif = $preloadedDocument; |
897 | 875 | return true; |
@@ -903,8 +881,7 @@ discard block |
||
903 | 881 | * {@inheritDoc} |
904 | 882 | * @see Docu::ensureHasFulltextIsSet() |
905 | 883 | */ |
906 | - protected function ensureHasFulltextIsSet() |
|
907 | - { |
|
884 | + protected function ensureHasFulltextIsSet() { |
|
908 | 885 | /* |
909 | 886 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
910 | 887 | * Example: |
@@ -950,8 +927,7 @@ discard block |
||
950 | 927 | * {@inheritDoc} |
951 | 928 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
952 | 929 | */ |
953 | - protected function _getThumbnail($forceReload = false) |
|
954 | - { |
|
930 | + protected function _getThumbnail($forceReload = false) { |
|
955 | 931 | return $this->iiif->getThumbnailUrl(); |
956 | 932 | } |
957 | 933 | |
@@ -959,8 +935,7 @@ discard block |
||
959 | 935 | * {@inheritDoc} |
960 | 936 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
961 | 937 | */ |
962 | - protected function _getToplevelId() |
|
963 | - { |
|
938 | + protected function _getToplevelId() { |
|
964 | 939 | if (empty($this->toplevelId)) { |
965 | 940 | if (isset($this->iiif)) { |
966 | 941 | $this->toplevelId = $this->iiif->getId(); |
@@ -977,8 +952,7 @@ discard block |
||
977 | 952 | * |
978 | 953 | * @return void |
979 | 954 | */ |
980 | - public function __wakeup() |
|
981 | - { |
|
955 | + public function __wakeup() { |
|
982 | 956 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
983 | 957 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
984 | 958 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -998,8 +972,7 @@ discard block |
||
998 | 972 | * |
999 | 973 | * @return string[] |
1000 | 974 | */ |
1001 | - public function __sleep() |
|
1002 | - { |
|
975 | + public function __sleep() { |
|
1003 | 976 | // TODO implement serializiation in IIIF library |
1004 | 977 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
1005 | 978 | $this->asJson = json_encode($jsonArray); |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Region |
|
24 | -{ |
|
23 | +class Region { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the region |
@@ -105,8 +104,7 @@ discard block |
||
105 | 104 | * |
106 | 105 | * @return void |
107 | 106 | */ |
108 | - public function __construct($id, $region) |
|
109 | - { |
|
107 | + public function __construct($id, $region) { |
|
110 | 108 | $this->id = $id; |
111 | 109 | $this->pageId = $region['pageIdx']; |
112 | 110 | $this->xBeginPosition = $region['ulx']; |
@@ -125,8 +123,7 @@ discard block |
||
125 | 123 | * |
126 | 124 | * @return int The region's identifier |
127 | 125 | */ |
128 | - public function getId() |
|
129 | - { |
|
126 | + public function getId() { |
|
130 | 127 | return $this->id; |
131 | 128 | } |
132 | 129 | |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return int The region's page identifier |
139 | 136 | */ |
140 | - public function getPageId() |
|
141 | - { |
|
137 | + public function getPageId() { |
|
142 | 138 | return $this->pageId; |
143 | 139 | } |
144 | 140 | |
@@ -149,8 +145,7 @@ discard block |
||
149 | 145 | * |
150 | 146 | * @return int The region's horizontal beginning position |
151 | 147 | */ |
152 | - public function getXBeginPosition() |
|
153 | - { |
|
148 | + public function getXBeginPosition() { |
|
154 | 149 | return $this->xBeginPosition; |
155 | 150 | } |
156 | 151 | |
@@ -161,8 +156,7 @@ discard block |
||
161 | 156 | * |
162 | 157 | * @return int The region's horizontal ending position |
163 | 158 | */ |
164 | - public function getXEndPosition() |
|
165 | - { |
|
159 | + public function getXEndPosition() { |
|
166 | 160 | return $this->xEndPosition; |
167 | 161 | } |
168 | 162 | |
@@ -173,8 +167,7 @@ discard block |
||
173 | 167 | * |
174 | 168 | * @return int The region's vertical beginning position |
175 | 169 | */ |
176 | - public function getYBeginPosition() |
|
177 | - { |
|
170 | + public function getYBeginPosition() { |
|
178 | 171 | return $this->yBeginPosition; |
179 | 172 | } |
180 | 173 | |
@@ -185,8 +178,7 @@ discard block |
||
185 | 178 | * |
186 | 179 | * @return int The region's vertical ending position |
187 | 180 | */ |
188 | - public function getYEndPosition() |
|
189 | - { |
|
181 | + public function getYEndPosition() { |
|
190 | 182 | return $this->yEndPosition; |
191 | 183 | } |
192 | 184 | |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * |
198 | 190 | * @return int The region's width |
199 | 191 | */ |
200 | - public function getWidth() |
|
201 | - { |
|
192 | + public function getWidth() { |
|
202 | 193 | return $this->width; |
203 | 194 | } |
204 | 195 | |
@@ -209,8 +200,7 @@ discard block |
||
209 | 200 | * |
210 | 201 | * @return int The region's height |
211 | 202 | */ |
212 | - public function getHeight() |
|
213 | - { |
|
203 | + public function getHeight() { |
|
214 | 204 | return $this->height; |
215 | 205 | } |
216 | 206 | |
@@ -221,8 +211,7 @@ discard block |
||
221 | 211 | * |
222 | 212 | * @return string The region's text |
223 | 213 | */ |
224 | - public function getText() |
|
225 | - { |
|
214 | + public function getText() { |
|
226 | 215 | return $this->text; |
227 | 216 | } |
228 | 217 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Page |
|
24 | -{ |
|
23 | +class Page { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the page |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function __construct($id, $page) |
|
69 | - { |
|
67 | + public function __construct($id, $page) { |
|
70 | 68 | $this->id = $id; |
71 | 69 | $this->name = $page['id']; |
72 | 70 | $this->width = $page['width']; |
@@ -80,8 +78,7 @@ discard block |
||
80 | 78 | * |
81 | 79 | * @return int The page's identifier |
82 | 80 | */ |
83 | - public function getId() |
|
84 | - { |
|
81 | + public function getId() { |
|
85 | 82 | return $this->id; |
86 | 83 | } |
87 | 84 | |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | * |
93 | 90 | * @return string The page's name |
94 | 91 | */ |
95 | - public function getName() |
|
96 | - { |
|
92 | + public function getName() { |
|
97 | 93 | return $this->name; |
98 | 94 | } |
99 | 95 | |
@@ -104,8 +100,7 @@ discard block |
||
104 | 100 | * |
105 | 101 | * @return int The page's width |
106 | 102 | */ |
107 | - public function getWidth() |
|
108 | - { |
|
103 | + public function getWidth() { |
|
109 | 104 | return $this->width; |
110 | 105 | } |
111 | 106 | |
@@ -116,8 +111,7 @@ discard block |
||
116 | 111 | * |
117 | 112 | * @return int The page's height |
118 | 113 | */ |
119 | - public function getHeight() |
|
120 | - { |
|
114 | + public function getHeight() { |
|
121 | 115 | return $this->height; |
122 | 116 | } |
123 | 117 | } |
@@ -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 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Highlight |
|
24 | -{ |
|
23 | +class Highlight { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier in form 'w_h_x_y' |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * |
81 | 80 | * @return void |
82 | 81 | */ |
83 | - public function __construct($highlight) |
|
84 | - { |
|
82 | + public function __construct($highlight) { |
|
85 | 83 | $this->parentRegionId = $highlight['parentRegionIdx']; |
86 | 84 | $this->xBeginPosition = $highlight['ulx']; |
87 | 85 | $this->xEndPosition = $highlight['lrx']; |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return string The highlight's identifier |
99 | 97 | */ |
100 | - public function getId() |
|
101 | - { |
|
98 | + public function getId() { |
|
102 | 99 | return $this->id; |
103 | 100 | } |
104 | 101 | |
@@ -109,8 +106,7 @@ discard block |
||
109 | 106 | * |
110 | 107 | * @return int The highlight's horizontal beginning position |
111 | 108 | */ |
112 | - public function getXBeginPosition() |
|
113 | - { |
|
109 | + public function getXBeginPosition() { |
|
114 | 110 | return $this->xBeginPosition; |
115 | 111 | } |
116 | 112 | |
@@ -121,8 +117,7 @@ discard block |
||
121 | 117 | * |
122 | 118 | * @return int The highlight's horizontal ending position |
123 | 119 | */ |
124 | - public function getXEndPosition() |
|
125 | - { |
|
120 | + public function getXEndPosition() { |
|
126 | 121 | return $this->xEndPosition; |
127 | 122 | } |
128 | 123 | |
@@ -133,8 +128,7 @@ discard block |
||
133 | 128 | * |
134 | 129 | * @return int The highlight's vertical beginning position |
135 | 130 | */ |
136 | - public function getYBeginPosition() |
|
137 | - { |
|
131 | + public function getYBeginPosition() { |
|
138 | 132 | return $this->yBeginPosition; |
139 | 133 | } |
140 | 134 | |
@@ -145,8 +139,7 @@ discard block |
||
145 | 139 | * |
146 | 140 | * @return int The highlight's vertical ending position |
147 | 141 | */ |
148 | - public function getYEndPosition() |
|
149 | - { |
|
142 | + public function getYEndPosition() { |
|
150 | 143 | return $this->yEndPosition; |
151 | 144 | } |
152 | 145 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function getWord($attributes) |
103 | 103 | { |
104 | - return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
|
104 | + return htmlspecialchars((string) $attributes['CONTENT']).' '; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | */ |
116 | 116 | private function getCoordinates($attributes) |
117 | 117 | { |
118 | - return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
|
118 | + return (string) $attributes['HPOS'].' '.(string) $attributes['VPOS'].' '.(string) $attributes['WIDTH'].' '.(string) $attributes['HEIGHT']; |
|
119 | 119 | } |
120 | 120 | } |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string The raw unformatted fulltext |
35 | 35 | */ |
36 | - public function getRawText(\SimpleXMLElement $xml) |
|
37 | - { |
|
36 | + public function getRawText(\SimpleXMLElement $xml) { |
|
38 | 37 | $rawText = ''; |
39 | 38 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
40 | 39 | // Get all (presumed) words of the text. |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | * |
55 | 54 | * @return string The unformatted fulltext in MiniOCR format |
56 | 55 | */ |
57 | - public function getTextAsMiniOcr(\SimpleXMLElement $xml) |
|
58 | - { |
|
56 | + public function getTextAsMiniOcr(\SimpleXMLElement $xml) { |
|
59 | 57 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
60 | 58 | |
61 | 59 | // get all text blocks |
@@ -99,8 +97,7 @@ discard block |
||
99 | 97 | * |
100 | 98 | * @return string The parsed word extracted from attribute |
101 | 99 | */ |
102 | - private function getWord($attributes) |
|
103 | - { |
|
100 | + private function getWord($attributes) { |
|
104 | 101 | return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
105 | 102 | } |
106 | 103 | |
@@ -113,8 +110,7 @@ discard block |
||
113 | 110 | * |
114 | 111 | * @return string The parsed word coordinates extracted from attribute |
115 | 112 | */ |
116 | - private function getCoordinates($attributes) |
|
117 | - { |
|
113 | + private function getCoordinates($attributes) { |
|
118 | 114 | return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
119 | 115 | } |
120 | 116 | } |
@@ -23,8 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | use StreamDecoratorTrait; |
25 | 25 | |
26 | - public function emit() |
|
27 | - { |
|
26 | + public function emit() { |
|
28 | 27 | // Disable output buffering |
29 | 28 | ob_end_flush(); |
30 | 29 |