@@ -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 | |
@@ -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); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @var bool |
| 88 | 88 | * @access protected |
| 89 | 89 | */ |
| 90 | - protected $hasFulltextSet = false; |
|
| 90 | + protected $hasFulltextSet = FALSE; |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * This holds the original manifest's parsed metadata array with their corresponding |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function establishRecordId($pid) |
| 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. |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @var bool |
| 209 | 209 | * @access protected |
| 210 | 210 | */ |
| 211 | - protected $useGrpsLoaded = false; |
|
| 211 | + protected $useGrpsLoaded = FALSE; |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Holds the configured useGrps as array. |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if (!empty($extConf['fileGrpAudio'])) { |
| 251 | 251 | $this->useGrps['fileGrpAudio'] = GeneralUtility::trimExplode(',', $extConf['fileGrpAudio']); |
| 252 | 252 | } |
| 253 | - $this->useGrpsLoaded = true; |
|
| 253 | + $this->useGrpsLoaded = TRUE; |
|
| 254 | 254 | } |
| 255 | 255 | return array_key_exists($use, $this->useGrps) ? $this->useGrps[$use] : []; |
| 256 | 256 | } |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | // Is there no physical structure array yet? |
| 265 | 265 | if (!$this->physicalStructureLoaded) { |
| 266 | - if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
|
| 267 | - return null; |
|
| 266 | + if ($this->iiif == NULL || !($this->iiif instanceof ManifestInterface)) { |
|
| 267 | + return NULL; |
|
| 268 | 268 | } |
| 269 | 269 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 270 | 270 | $iiifId = $this->iiif->getId(); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $this->physicalStructureInfo[$physSeq[0]]['label'] = $this->iiif->getLabelForDisplay(); |
| 275 | 275 | $this->physicalStructureInfo[$physSeq[0]]['orderlabel'] = $this->iiif->getLabelForDisplay(); |
| 276 | 276 | $this->physicalStructureInfo[$physSeq[0]]['type'] = 'physSequence'; |
| 277 | - $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = null; |
|
| 277 | + $this->physicalStructureInfo[$physSeq[0]]['contentIds'] = NULL; |
|
| 278 | 278 | $fileUseDownload = $this->getUseGroups('fileGrpDownload'); |
| 279 | 279 | $fileUseFulltext = $this->getUseGroups('fileGrpFulltext'); |
| 280 | 280 | $fileUseThumbs = $this->getUseGroups('fileGrpThumbs'); |
@@ -288,13 +288,13 @@ discard block |
||
| 288 | 288 | if (!empty($fileUseFulltext)) { |
| 289 | 289 | $iiifAlto = $this->iiif->getSeeAlsoUrlsForFormat('application/alto+xml'); |
| 290 | 290 | if (empty($iiifAlto)) { |
| 291 | - $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
| 291 | + $iiifAlto = $this->iiif->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
| 292 | 292 | } |
| 293 | 293 | if (!empty($iiifAlto)) { |
| 294 | 294 | $this->mimeTypes[$iiifAlto[0]] = 'application/alto+xml'; |
| 295 | 295 | $this->physicalStructureInfo[$physSeq[0]]['files'][$fileUseFulltext[0]] = $iiifAlto[0]; |
| 296 | - $this->hasFulltext = true; |
|
| 297 | - $this->hasFulltextSet = true; |
|
| 296 | + $this->hasFulltext = TRUE; |
|
| 297 | + $this->hasFulltextSet = TRUE; |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | if (!empty($this->iiif->getDefaultCanvases())) { |
@@ -313,39 +313,39 @@ discard block |
||
| 313 | 313 | // populate structural metadata info |
| 314 | 314 | $elements[$canvasOrder] = $canvas->getId(); |
| 315 | 315 | $this->physicalStructureInfo[$elements[$canvasOrder]]['id'] = $canvas->getId(); |
| 316 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = null; |
|
| 316 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['dmdId'] = NULL; |
|
| 317 | 317 | $this->physicalStructureInfo[$elements[$canvasOrder]]['label'] = $canvas->getLabelForDisplay(); |
| 318 | 318 | $this->physicalStructureInfo[$elements[$canvasOrder]]['orderlabel'] = $canvas->getLabelForDisplay(); |
| 319 | 319 | // assume that a canvas always represents a page |
| 320 | 320 | $this->physicalStructureInfo[$elements[$canvasOrder]]['type'] = 'page'; |
| 321 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = null; |
|
| 322 | - $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = null; |
|
| 321 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['contentIds'] = NULL; |
|
| 322 | + $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = NULL; |
|
| 323 | 323 | if (!empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 324 | 324 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'] = []; |
| 325 | 325 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 326 | 326 | $this->physicalStructureInfo[$elements[$canvasOrder]]['annotationContainers'][] = $annotationContainer->getId(); |
| 327 | 327 | if ($extConf['indexAnnotations']) { |
| 328 | - $this->hasFulltext = true; |
|
| 329 | - $this->hasFulltextSet = true; |
|
| 328 | + $this->hasFulltext = TRUE; |
|
| 329 | + $this->hasFulltextSet = TRUE; |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | if (!empty($fileUseFulltext)) { |
| 334 | 334 | $alto = $canvas->getSeeAlsoUrlsForFormat('application/alto+xml'); |
| 335 | 335 | if (empty($alto)) { |
| 336 | - $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', true); |
|
| 336 | + $alto = $canvas->getSeeAlsoUrlsForProfile('http://www.loc.gov/standards/alto/', TRUE); |
|
| 337 | 337 | } |
| 338 | 338 | if (!empty($alto)) { |
| 339 | 339 | $this->mimeTypes[$alto[0]] = 'application/alto+xml'; |
| 340 | 340 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUseFulltext[0]] = $alto[0]; |
| 341 | - $this->hasFulltext = true; |
|
| 342 | - $this->hasFulltextSet = true; |
|
| 341 | + $this->hasFulltext = TRUE; |
|
| 342 | + $this->hasFulltextSet = TRUE; |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | if (!empty($fileUses)) { |
| 346 | 346 | $image = $canvas->getImageAnnotations()[0]; |
| 347 | 347 | foreach ($fileUses as $fileUse) { |
| 348 | - if ($image->getBody() !== null && $image->getBody() instanceof ContentResourceInterface) { |
|
| 348 | + if ($image->getBody() !== NULL && $image->getBody() instanceof ContentResourceInterface) { |
|
| 349 | 349 | $this->physicalStructureInfo[$elements[$canvasOrder]]['files'][$fileUse] = $image->getBody()->getId(); |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | // Merge and re-index the array to get nice numeric indexes. |
| 365 | 365 | $this->physicalStructure = array_merge($physSeq, $elements); |
| 366 | 366 | } |
| 367 | - $this->physicalStructureLoaded = true; |
|
| 367 | + $this->physicalStructureLoaded = TRUE; |
|
| 368 | 368 | } |
| 369 | 369 | return $this->physicalStructure; |
| 370 | 370 | } |
@@ -389,15 +389,15 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function getFileLocation($id) |
| 391 | 391 | { |
| 392 | - if ($id == null) { |
|
| 393 | - return null; |
|
| 392 | + if ($id == NULL) { |
|
| 393 | + return NULL; |
|
| 394 | 394 | } |
| 395 | 395 | $resource = $this->iiif->getContainedResourceById($id); |
| 396 | 396 | if (isset($resource)) { |
| 397 | 397 | if ($resource instanceof CanvasInterface) { |
| 398 | - return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != null) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 398 | + return (!empty($resource->getImageAnnotations()) && $resource->getImageAnnotations()->getSingleService() != NULL) ? $resource->getImageAnnotations()[0]->getSingleService()->getId() : $id; |
|
| 399 | 399 | } elseif ($resource instanceof ContentResourceInterface) { |
| 400 | - return $resource->getSingleService() != null && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 400 | + return $resource->getSingleService() != NULL && $resource->getSingleService() instanceof Service ? $resource->getSingleService()->getId() : $id; |
|
| 401 | 401 | } elseif ($resource instanceof AbstractImageService) { |
| 402 | 402 | return $resource->getId(); |
| 403 | 403 | } elseif ($resource instanceof AnnotationContainerInterface) { |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } elseif ($fileResource instanceof AnnotationInterface) { |
| 421 | 421 | $format = "application/vnd.kitodo.iiif"; |
| 422 | 422 | } elseif ($fileResource instanceof ContentResourceInterface) { |
| 423 | - if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == null || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 423 | + if ($fileResource->isText() || $fileResource->isImage() && ($fileResource->getSingleService() == NULL || !($fileResource->getSingleService() instanceof AbstractImageService))) { |
|
| 424 | 424 | // Support static images without an image service |
| 425 | 425 | return $fileResource->getFormat(); |
| 426 | 426 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * {@inheritDoc} |
| 439 | 439 | * @see Doc::getLogicalStructure() |
| 440 | 440 | */ |
| 441 | - public function getLogicalStructure($id, $recursive = false) |
|
| 441 | + public function getLogicalStructure($id, $recursive = FALSE) |
|
| 442 | 442 | { |
| 443 | 443 | $details = []; |
| 444 | 444 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | // cache the ranges - they might occur multiple times in the structures "tree" - with full data as well as referenced as id |
| 456 | 456 | $processedStructures = []; |
| 457 | 457 | foreach ($logUnits as $logUnit) { |
| 458 | - if (array_search($logUnit->getId(), $processedStructures) == false) { |
|
| 459 | - $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, true, $processedStructures); |
|
| 458 | + if (array_search($logUnit->getId(), $processedStructures) == FALSE) { |
|
| 459 | + $this->tableOfContents[] = $this->getLogicalStructureInfo($logUnit, TRUE, $processedStructures); |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | } |
@@ -474,13 +474,13 @@ discard block |
||
| 474 | 474 | * @param array $processedStructures: IIIF resources that already have been processed |
| 475 | 475 | * @return array Logical structure array |
| 476 | 476 | */ |
| 477 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
| 477 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = FALSE, &$processedStructures = []) |
|
| 478 | 478 | { |
| 479 | 479 | $details = []; |
| 480 | 480 | $details['id'] = $resource->getId(); |
| 481 | 481 | $details['dmdId'] = ''; |
| 482 | - $details['label'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 483 | - $details['orderlabel'] = $resource->getLabelForDisplay() !== null ? $resource->getLabelForDisplay() : ''; |
|
| 482 | + $details['label'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 483 | + $details['orderlabel'] = $resource->getLabelForDisplay() !== NULL ? $resource->getLabelForDisplay() : ''; |
|
| 484 | 484 | $details['contentIds'] = ''; |
| 485 | 485 | $details['volume'] = ''; |
| 486 | 486 | $details['pagination'] = ''; |
@@ -505,10 +505,10 @@ discard block |
||
| 505 | 505 | $startCanvas = $resource->getStartCanvasOrFirstCanvas(); |
| 506 | 506 | $canvases = $resource->getAllCanvases(); |
| 507 | 507 | } |
| 508 | - if ($startCanvas != null) { |
|
| 508 | + if ($startCanvas != NULL) { |
|
| 509 | 509 | $details['pagination'] = $startCanvas->getLabel(); |
| 510 | 510 | $startCanvasIndex = array_search($startCanvas, $this->iiif->getDefaultCanvases()); |
| 511 | - if ($startCanvasIndex !== false) { |
|
| 511 | + if ($startCanvasIndex !== FALSE) { |
|
| 512 | 512 | $details['points'] = $startCanvasIndex + 1; |
| 513 | 513 | } |
| 514 | 514 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | if ($recursive) { |
| 523 | 523 | $processedStructures[] = $resource->getId(); |
| 524 | 524 | $details['children'] = []; |
| 525 | - if ($resource instanceof ManifestInterface && $resource->getRootRanges() != null) { |
|
| 525 | + if ($resource instanceof ManifestInterface && $resource->getRootRanges() != NULL) { |
|
| 526 | 526 | $rangesToAdd = []; |
| 527 | 527 | $rootRanges = []; |
| 528 | 528 | if (sizeof($this->iiif->getRootRanges()) == 1 && $this->iiif->getRootRanges()[0]->isTopRange()) { |
@@ -534,15 +534,15 @@ discard block |
||
| 534 | 534 | $rootRanges[] = $range; |
| 535 | 535 | } |
| 536 | 536 | foreach ($rootRanges as $range) { |
| 537 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 538 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
| 537 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 538 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | } elseif ($resource instanceof RangeInterface) { |
| 542 | 542 | if (!empty($resource->getAllRanges())) { |
| 543 | 543 | foreach ($resource->getAllRanges() as $range) { |
| 544 | - if ((array_search($range->getId(), $processedStructures) == false)) { |
|
| 545 | - $details['children'][] = $this->getLogicalStructureInfo($range, true, $processedStructures); |
|
| 544 | + if ((array_search($range->getId(), $processedStructures) == FALSE)) { |
|
| 545 | + $details['children'][] = $this->getLogicalStructureInfo($range, TRUE, $processedStructures); |
|
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | } |
@@ -567,15 +567,15 @@ discard block |
||
| 567 | 567 | * |
| 568 | 568 | * @todo This method is still in experimental; the method signature may change. |
| 569 | 569 | */ |
| 570 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
| 570 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = TRUE, $withRights = TRUE, $withRelated = TRUE) |
|
| 571 | 571 | { |
| 572 | 572 | if (!empty($this->originalMetadataArray[$id])) { |
| 573 | 573 | return $this->originalMetadataArray[$id]; |
| 574 | 574 | } |
| 575 | 575 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 576 | 576 | $result = []; |
| 577 | - if ($iiifResource != null) { |
|
| 578 | - if ($iiifResource->getLabel() != null && $iiifResource->getLabel() != "") { |
|
| 577 | + if ($iiifResource != NULL) { |
|
| 578 | + if ($iiifResource->getLabel() != NULL && $iiifResource->getLabel() != "") { |
|
| 579 | 579 | $result['label'] = $iiifResource->getLabel(); |
| 580 | 580 | } |
| 581 | 581 | if (!empty($iiifResource->getMetadata())) { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $iiifResource = $this->iiif->getContainedResourceById($id); |
| 678 | 678 | while ($resArray = $result->fetch()) { |
| 679 | 679 | // Set metadata field's value(s). |
| 680 | - if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != null) { |
|
| 680 | + if ($resArray['format'] > 0 && !empty($resArray['xpath']) && ($values = $iiifResource->jsonPath($resArray['xpath'])) != NULL) { |
|
| 681 | 681 | if (is_string($values)) { |
| 682 | 682 | $metadata[$resArray['index_name']] = [trim((string) $values)]; |
| 683 | 683 | } elseif ($values instanceof JSONPath && is_array($values->data()) && count($values->data()) > 1) { |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | if (!empty($metadata[$resArray['index_name']]) && $resArray['is_sortable']) { |
| 696 | 696 | if ( |
| 697 | 697 | $resArray['format'] > 0 && !empty($resArray['xpath_sorting']) |
| 698 | - && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != null) |
|
| 698 | + && ($values = $iiifResource->jsonPath($resArray['xpath_sorting']) != NULL) |
|
| 699 | 699 | ) { |
| 700 | 700 | if (is_string($values)) { |
| 701 | 701 | $metadata[$resArray['index_name'] . '_sorting'][0] = [trim((string) $values)]; |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $this->smLinkRangeCanvasesRecursively($range); |
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | - $this->smLinksLoaded = true; |
|
| 734 | + $this->smLinksLoaded = TRUE; |
|
| 735 | 735 | } |
| 736 | 736 | return $this->smLinks; |
| 737 | 737 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | foreach ($annotationContainer->getTextAnnotations(Motivation::PAINTING) as $annotation) { |
| 814 | 814 | if ( |
| 815 | 815 | $annotation->getTargetResourceId() == $iiifResource->getId() && |
| 816 | - $annotation->getBody() != null && $annotation->getBody()->getChars() != null |
|
| 816 | + $annotation->getBody() != NULL && $annotation->getBody()->getChars() != NULL |
|
| 817 | 817 | ) { |
| 818 | 818 | $annotationTexts[] = $annotation->getBody()->getChars(); |
| 819 | 819 | } |
@@ -859,21 +859,21 @@ discard block |
||
| 859 | 859 | protected function loadLocation($location) |
| 860 | 860 | { |
| 861 | 861 | $fileResource = GeneralUtility::getUrl($location); |
| 862 | - if ($fileResource !== false) { |
|
| 862 | + if ($fileResource !== FALSE) { |
|
| 863 | 863 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 864 | 864 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 865 | 865 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 866 | 866 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 867 | 867 | $resource = IiifHelper::loadIiifResource($fileResource); |
| 868 | - if ($resource != null) { |
|
| 868 | + if ($resource != NULL) { |
|
| 869 | 869 | if ($resource instanceof ManifestInterface) { |
| 870 | 870 | $this->iiif = $resource; |
| 871 | - return true; |
|
| 871 | + return TRUE; |
|
| 872 | 872 | } |
| 873 | 873 | } |
| 874 | 874 | } |
| 875 | 875 | $this->logger->error('Could not load IIIF manifest from "' . $location . '"'); |
| 876 | - return false; |
|
| 876 | + return FALSE; |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | /** |
@@ -894,9 +894,9 @@ discard block |
||
| 894 | 894 | { |
| 895 | 895 | if ($preloadedDocument instanceof ManifestInterface) { |
| 896 | 896 | $this->iiif = $preloadedDocument; |
| 897 | - return true; |
|
| 897 | + return TRUE; |
|
| 898 | 898 | } |
| 899 | - return false; |
|
| 899 | + return FALSE; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | /** |
@@ -919,22 +919,22 @@ discard block |
||
| 919 | 919 | !empty($canvas->getSeeAlsoUrlsForFormat("application/alto+xml")) || |
| 920 | 920 | !empty($canvas->getSeeAlsoUrlsForProfile("http://www.loc.gov/standards/alto/")) |
| 921 | 921 | ) { |
| 922 | - $this->hasFulltextSet = true; |
|
| 923 | - $this->hasFulltext = true; |
|
| 922 | + $this->hasFulltextSet = TRUE; |
|
| 923 | + $this->hasFulltext = TRUE; |
|
| 924 | 924 | return; |
| 925 | 925 | } |
| 926 | 926 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 927 | 927 | if ($extConf['indexAnnotations'] == 1 && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) { |
| 928 | 928 | foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) { |
| 929 | - if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) { |
|
| 929 | + if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) { |
|
| 930 | 930 | foreach ($textAnnotations as $annotation) { |
| 931 | 931 | if ( |
| 932 | - $annotation->getBody() != null && |
|
| 932 | + $annotation->getBody() != NULL && |
|
| 933 | 933 | $annotation->getBody()->getFormat() == "text/plain" && |
| 934 | - $annotation->getBody()->getChars() != null |
|
| 934 | + $annotation->getBody()->getChars() != NULL |
|
| 935 | 935 | ) { |
| 936 | - $this->hasFulltextSet = true; |
|
| 937 | - $this->hasFulltext = true; |
|
| 936 | + $this->hasFulltextSet = TRUE; |
|
| 937 | + $this->hasFulltext = TRUE; |
|
| 938 | 938 | return; |
| 939 | 939 | } |
| 940 | 940 | } |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | - $this->hasFulltextSet = true; |
|
| 945 | + $this->hasFulltextSet = TRUE; |
|
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | 948 | |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | * {@inheritDoc} |
| 951 | 951 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
| 952 | 952 | */ |
| 953 | - protected function _getThumbnail($forceReload = false) |
|
| 953 | + protected function _getThumbnail($forceReload = FALSE) |
|
| 954 | 954 | { |
| 955 | 955 | return $this->iiif->getThumbnailUrl(); |
| 956 | 956 | } |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
| 985 | 985 | IiifHelper::setMaxThumbnailWidth($conf['iiifThumbnailWidth']); |
| 986 | 986 | $resource = IiifHelper::loadIiifResource($this->asJson); |
| 987 | - if ($resource != null && $resource instanceof ManifestInterface) { |
|
| 987 | + if ($resource != NULL && $resource instanceof ManifestInterface) { |
|
| 988 | 988 | $this->asJson = ''; |
| 989 | 989 | $this->iiif = $resource; |
| 990 | 990 | $this->init(''); |
@@ -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 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | return [ |
| 5 | 5 | \Kitodo\Dlf\Domain\Model\ActionLog::class => [ |