@@ -24,8 +24,8 @@ |
||
| 24 | 24 | 'suggests' => [] |
| 25 | 25 | ], |
| 26 | 26 | 'state' => 'stable', |
| 27 | - 'uploadfolder' => false, |
|
| 28 | - 'clearCacheOnLoad' => false, |
|
| 27 | + 'uploadfolder' => FALSE, |
|
| 28 | + 'clearCacheOnLoad' => FALSE, |
|
| 29 | 29 | 'author' => 'Sebastian Meyer (Maintainer)', |
| 30 | 30 | 'author_email' => '[email protected]', |
| 31 | 31 | 'author_company' => 'Kitodo. Key to digital objects e. V.', |
@@ -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 | |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @property-read string $thumbnail This holds the document's thumbnail location |
| 56 | 56 | * @property-read string $toplevelId This holds the toplevel manifest's @id |
| 57 | 57 | */ |
| 58 | -final class IiifManifest extends Document |
|
| 59 | -{ |
|
| 58 | +final class IiifManifest extends Document { |
|
| 60 | 59 | /** |
| 61 | 60 | * This holds the manifest file as string for serialization purposes |
| 62 | 61 | * @see __sleep() / __wakeup() |
@@ -117,8 +116,7 @@ discard block |
||
| 117 | 116 | * {@inheritDoc} |
| 118 | 117 | * @see Doc::establishRecordId() |
| 119 | 118 | */ |
| 120 | - protected function establishRecordId($pid) |
|
| 121 | - { |
|
| 119 | + protected function establishRecordId($pid) { |
|
| 122 | 120 | if ($this->iiif !== null) { |
| 123 | 121 | /* |
| 124 | 122 | * FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss |
@@ -169,8 +167,7 @@ discard block |
||
| 169 | 167 | * {@inheritDoc} |
| 170 | 168 | * @see Doc::getDocument() |
| 171 | 169 | */ |
| 172 | - protected function getDocument() |
|
| 173 | - { |
|
| 170 | + protected function getDocument() { |
|
| 174 | 171 | return $this->iiif; |
| 175 | 172 | } |
| 176 | 173 | |
@@ -183,8 +180,7 @@ discard block |
||
| 183 | 180 | * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if |
| 184 | 181 | * the resource is a Presentation API 2 / 3 resource |
| 185 | 182 | */ |
| 186 | - public function getIiifVersion() |
|
| 187 | - { |
|
| 183 | + public function getIiifVersion() { |
|
| 188 | 184 | if (!isset($this->iiifVersion)) { |
| 189 | 185 | if ($this->iiif instanceof AbstractIiifResource1) { |
| 190 | 186 | $this->iiifVersion = 'IIIF1'; |
@@ -225,8 +221,7 @@ discard block |
||
| 225 | 221 | * |
| 226 | 222 | * @return array|string |
| 227 | 223 | */ |
| 228 | - protected function getUseGroups($use) |
|
| 229 | - { |
|
| 224 | + protected function getUseGroups($use) { |
|
| 230 | 225 | if (!$this->useGrpsLoaded) { |
| 231 | 226 | // Get configured USE attributes. |
| 232 | 227 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -254,8 +249,7 @@ discard block |
||
| 254 | 249 | * {@inheritDoc} |
| 255 | 250 | * @see Doc::_getPhysicalStructure() |
| 256 | 251 | */ |
| 257 | - protected function _getPhysicalStructure() |
|
| 258 | - { |
|
| 252 | + protected function _getPhysicalStructure() { |
|
| 259 | 253 | // Is there no physical structure array yet? |
| 260 | 254 | if (!$this->physicalStructureLoaded) { |
| 261 | 255 | if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) { |
@@ -368,8 +362,7 @@ discard block |
||
| 368 | 362 | * {@inheritDoc} |
| 369 | 363 | * @see Doc::getDownloadLocation() |
| 370 | 364 | */ |
| 371 | - public function getDownloadLocation($id) |
|
| 372 | - { |
|
| 365 | + public function getDownloadLocation($id) { |
|
| 373 | 366 | $fileLocation = $this->getFileLocation($id); |
| 374 | 367 | $resource = $this->iiif->getContainedResourceById($fileLocation); |
| 375 | 368 | if ($resource instanceof AbstractImageService) { |
@@ -382,8 +375,7 @@ discard block |
||
| 382 | 375 | * {@inheritDoc} |
| 383 | 376 | * @see Doc::getFileLocation() |
| 384 | 377 | */ |
| 385 | - public function getFileLocation($id) |
|
| 386 | - { |
|
| 378 | + public function getFileLocation($id) { |
|
| 387 | 379 | if ($id == null) { |
| 388 | 380 | return null; |
| 389 | 381 | } |
@@ -407,8 +399,7 @@ discard block |
||
| 407 | 399 | * {@inheritDoc} |
| 408 | 400 | * @see Doc::getFileMimeType() |
| 409 | 401 | */ |
| 410 | - public function getFileMimeType($id) |
|
| 411 | - { |
|
| 402 | + public function getFileMimeType($id) { |
|
| 412 | 403 | $fileResource = $this->iiif->getContainedResourceById($id); |
| 413 | 404 | if ($fileResource instanceof CanvasInterface) { |
| 414 | 405 | $format = "application/vnd.kitodo.iiif"; |
@@ -433,8 +424,7 @@ discard block |
||
| 433 | 424 | * {@inheritDoc} |
| 434 | 425 | * @see Doc::getLogicalStructure() |
| 435 | 426 | */ |
| 436 | - public function getLogicalStructure($id, $recursive = false) |
|
| 437 | - { |
|
| 427 | + public function getLogicalStructure($id, $recursive = false) { |
|
| 438 | 428 | $details = []; |
| 439 | 429 | if (!$recursive && !empty($this->logicalUnits[$id])) { |
| 440 | 430 | return $this->logicalUnits[$id]; |
@@ -469,8 +459,7 @@ discard block |
||
| 469 | 459 | * @param array $processedStructures: IIIF resources that already have been processed |
| 470 | 460 | * @return array Logical structure array |
| 471 | 461 | */ |
| 472 | - protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) |
|
| 473 | - { |
|
| 462 | + protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) { |
|
| 474 | 463 | $details = []; |
| 475 | 464 | $details['id'] = $resource->getId(); |
| 476 | 465 | $details['dmdId'] = ''; |
@@ -562,8 +551,7 @@ discard block |
||
| 562 | 551 | * |
| 563 | 552 | * @todo This method is still in experimental; the method signature may change. |
| 564 | 553 | */ |
| 565 | - public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) |
|
| 566 | - { |
|
| 554 | + public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) { |
|
| 567 | 555 | if (!empty($this->originalMetadataArray[$id])) { |
| 568 | 556 | return $this->originalMetadataArray[$id]; |
| 569 | 557 | } |
@@ -605,8 +593,7 @@ discard block |
||
| 605 | 593 | * {@inheritDoc} |
| 606 | 594 | * @see Doc::getMetadata() |
| 607 | 595 | */ |
| 608 | - public function getMetadata($id, $cPid = 0) |
|
| 609 | - { |
|
| 596 | + public function getMetadata($id, $cPid = 0) { |
|
| 610 | 597 | if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) { |
| 611 | 598 | return $this->metadataArray[$id]; |
| 612 | 599 | } |
@@ -713,8 +700,7 @@ discard block |
||
| 713 | 700 | * {@inheritDoc} |
| 714 | 701 | * @see Doc::_getSmLinks() |
| 715 | 702 | */ |
| 716 | - protected function _getSmLinks() |
|
| 717 | - { |
|
| 703 | + protected function _getSmLinks() { |
|
| 718 | 704 | if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) { |
| 719 | 705 | if (!empty($this->iiif->getDefaultCanvases())) { |
| 720 | 706 | foreach ($this->iiif->getDefaultCanvases() as $canvas) { |
@@ -738,8 +724,7 @@ discard block |
||
| 738 | 724 | * |
| 739 | 725 | * @param RangeInterface $range: Current range whose canvases shall be linked |
| 740 | 726 | */ |
| 741 | - private function smLinkRangeCanvasesRecursively(RangeInterface $range) |
|
| 742 | - { |
|
| 727 | + private function smLinkRangeCanvasesRecursively(RangeInterface $range) { |
|
| 743 | 728 | // map range's canvases including all child ranges' canvases |
| 744 | 729 | if (!$range->isTopRange()) { |
| 745 | 730 | foreach ($range->getAllCanvasesRecursively() as $canvas) { |
@@ -762,8 +747,7 @@ discard block |
||
| 762 | 747 | * @param CanvasInterface $canvas |
| 763 | 748 | * @param IiifResourceInterface $resource |
| 764 | 749 | */ |
| 765 | - private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) |
|
| 766 | - { |
|
| 750 | + private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) { |
|
| 767 | 751 | $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId(); |
| 768 | 752 | if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) { |
| 769 | 753 | $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId(); |
@@ -775,8 +759,7 @@ discard block |
||
| 775 | 759 | * @see Doc::getFullText() |
| 776 | 760 | */ |
| 777 | 761 | //TODO: rewrite it to get full OCR |
| 778 | - public function getFullText($id) |
|
| 779 | - { |
|
| 762 | + public function getFullText($id) { |
|
| 780 | 763 | $rawText = ''; |
| 781 | 764 | // Get text from raw text array if available. |
| 782 | 765 | if (!empty($this->rawTextArray[$id])) { |
@@ -833,8 +816,7 @@ discard block |
||
| 833 | 816 | * |
| 834 | 817 | * @return IiifResourceInterface |
| 835 | 818 | */ |
| 836 | - public function getIiif() |
|
| 837 | - { |
|
| 819 | + public function getIiif() { |
|
| 838 | 820 | return $this->iiif; |
| 839 | 821 | } |
| 840 | 822 | |
@@ -842,8 +824,7 @@ discard block |
||
| 842 | 824 | * {@inheritDoc} |
| 843 | 825 | * @see Doc::init() |
| 844 | 826 | */ |
| 845 | - protected function init($location) |
|
| 846 | - { |
|
| 827 | + protected function init($location) { |
|
| 847 | 828 | // Nothing to do here, at the moment |
| 848 | 829 | } |
| 849 | 830 | |
@@ -851,8 +832,7 @@ discard block |
||
| 851 | 832 | * {@inheritDoc} |
| 852 | 833 | * @see Doc::loadLocation() |
| 853 | 834 | */ |
| 854 | - protected function loadLocation($location) |
|
| 855 | - { |
|
| 835 | + protected function loadLocation($location) { |
|
| 856 | 836 | $fileResource = GeneralUtility::getUrl($location); |
| 857 | 837 | if ($fileResource !== false) { |
| 858 | 838 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -875,8 +855,7 @@ discard block |
||
| 875 | 855 | * {@inheritDoc} |
| 876 | 856 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
| 877 | 857 | */ |
| 878 | - protected function prepareMetadataArray($cPid) |
|
| 879 | - { |
|
| 858 | + protected function prepareMetadataArray($cPid) { |
|
| 880 | 859 | $id = $this->iiif->getId(); |
| 881 | 860 | $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid); |
| 882 | 861 | } |
@@ -885,8 +864,7 @@ discard block |
||
| 885 | 864 | * {@inheritDoc} |
| 886 | 865 | * @see Doc::setPreloadedDocument() |
| 887 | 866 | */ |
| 888 | - protected function setPreloadedDocument($preloadedDocument) |
|
| 889 | - { |
|
| 867 | + protected function setPreloadedDocument($preloadedDocument) { |
|
| 890 | 868 | if ($preloadedDocument instanceof ManifestInterface) { |
| 891 | 869 | $this->iiif = $preloadedDocument; |
| 892 | 870 | return true; |
@@ -898,8 +876,7 @@ discard block |
||
| 898 | 876 | * {@inheritDoc} |
| 899 | 877 | * @see Docu::ensureHasFulltextIsSet() |
| 900 | 878 | */ |
| 901 | - protected function ensureHasFulltextIsSet() |
|
| 902 | - { |
|
| 879 | + protected function ensureHasFulltextIsSet() { |
|
| 903 | 880 | /* |
| 904 | 881 | * TODO Check annotations and annotation lists of canvas for ALTO documents. |
| 905 | 882 | * Example: |
@@ -945,8 +922,7 @@ discard block |
||
| 945 | 922 | * {@inheritDoc} |
| 946 | 923 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
| 947 | 924 | */ |
| 948 | - protected function _getThumbnail($forceReload = false) |
|
| 949 | - { |
|
| 925 | + protected function _getThumbnail($forceReload = false) { |
|
| 950 | 926 | return $this->iiif->getThumbnailUrl(); |
| 951 | 927 | } |
| 952 | 928 | |
@@ -954,8 +930,7 @@ discard block |
||
| 954 | 930 | * {@inheritDoc} |
| 955 | 931 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
| 956 | 932 | */ |
| 957 | - protected function _getToplevelId() |
|
| 958 | - { |
|
| 933 | + protected function _getToplevelId() { |
|
| 959 | 934 | if (empty($this->toplevelId)) { |
| 960 | 935 | if (isset($this->iiif)) { |
| 961 | 936 | $this->toplevelId = $this->iiif->getId(); |
@@ -972,8 +947,7 @@ discard block |
||
| 972 | 947 | * |
| 973 | 948 | * @return void |
| 974 | 949 | */ |
| 975 | - public function __wakeup() |
|
| 976 | - { |
|
| 950 | + public function __wakeup() { |
|
| 977 | 951 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
| 978 | 952 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 979 | 953 | IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']); |
@@ -992,8 +966,7 @@ discard block |
||
| 992 | 966 | * |
| 993 | 967 | * @return string[] |
| 994 | 968 | */ |
| 995 | - public function __sleep() |
|
| 996 | - { |
|
| 969 | + public function __sleep() { |
|
| 997 | 970 | // TODO implement serializiation in IIIF library |
| 998 | 971 | $jsonArray = $this->iiif->getOriginalJsonArray(); |
| 999 | 972 | $this->asJson = json_encode($jsonArray); |
@@ -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(''); |
@@ -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 | } |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | private function getQuery($fields, $parameters) |
| 122 | 122 | { |
| 123 | - return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']); |
|
| 123 | + return $fields['fulltext'].':('.Solr::escapeQuery((string) $parameters['q']).') AND '.$fields['uid'].':'.$this->getUid($parameters['uid']); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -28,16 +28,14 @@ discard block |
||
| 28 | 28 | * @subpackage dlf |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class SearchInDocument |
|
| 32 | -{ |
|
| 31 | +class SearchInDocument { |
|
| 33 | 32 | /** |
| 34 | 33 | * The main method of the eID script |
| 35 | 34 | * |
| 36 | 35 | * @param ServerRequestInterface $request |
| 37 | 36 | * @return ResponseInterface JSON response of search suggestions |
| 38 | 37 | */ |
| 39 | - public function main(ServerRequestInterface $request) |
|
| 40 | - { |
|
| 38 | + public function main(ServerRequestInterface $request) { |
|
| 41 | 39 | $output = [ |
| 42 | 40 | 'documents' => [], |
| 43 | 41 | 'numFound' => 0 |
@@ -118,8 +116,7 @@ discard block |
||
| 118 | 116 | * |
| 119 | 117 | * @return string SOLR query |
| 120 | 118 | */ |
| 121 | - private function getQuery($fields, $parameters) |
|
| 122 | - { |
|
| 119 | + private function getQuery($fields, $parameters) { |
|
| 123 | 120 | return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']); |
| 124 | 121 | } |
| 125 | 122 | |
@@ -133,8 +130,7 @@ discard block |
||
| 133 | 130 | * |
| 134 | 131 | * @return int|string uid of the document |
| 135 | 132 | */ |
| 136 | - private function getUid($uid) |
|
| 137 | - { |
|
| 133 | + private function getUid($uid) { |
|
| 138 | 134 | return is_numeric($uid) ? intval($uid) : $uid; |
| 139 | 135 | } |
| 140 | 136 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | ]; |
| 45 | 45 | // Get input parameters and decrypt core name. |
| 46 | 46 | $parameters = $request->getParsedBody(); |
| 47 | - if ($parameters === null) { |
|
| 47 | + if ($parameters === NULL) { |
|
| 48 | 48 | throw new \InvalidArgumentException('No parameters passed!', 1632322297); |
| 49 | 49 | } |
| 50 | 50 | $encrypted = (string) $parameters['encrypted']; |
@@ -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 | } |