@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct($apiUrl) |
| 26 | 26 | { |
| 27 | - $this->apiUrl = trim($apiUrl, "/ "); |
|
| 27 | + $this->apiUrl = trim($apiUrl, "/ "); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $annotations = []; |
| 61 | 61 | |
| 62 | - $annotationData = $this->requestAnnotions($this->apiUrl . '?target=' . urlencode($id . '/*')); |
|
| 62 | + $annotationData = $this->requestAnnotions($this->apiUrl.'?target='.urlencode($id.'/*')); |
|
| 63 | 63 | |
| 64 | 64 | if (array_key_exists('first', $annotationData)) { |
| 65 | 65 | $annotationPageData = $annotationData['first']; |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | * LICENSE.txt file that was distributed with this source code. |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class AnnotationRequest |
|
| 16 | -{ |
|
| 15 | +class AnnotationRequest { |
|
| 17 | 16 | /** |
| 18 | 17 | * @var string |
| 19 | 18 | */ |
@@ -22,8 +21,7 @@ discard block |
||
| 22 | 21 | /** |
| 23 | 22 | * @param string $apiUrl The url of the annotation server api. |
| 24 | 23 | */ |
| 25 | - public function __construct($apiUrl) |
|
| 26 | - { |
|
| 24 | + public function __construct($apiUrl) { |
|
| 27 | 25 | $this->apiUrl = trim($apiUrl, "/ "); |
| 28 | 26 | } |
| 29 | 27 | |
@@ -55,8 +53,7 @@ discard block |
||
| 55 | 53 | * @param string $id Document id (purl) |
| 56 | 54 | * @return array |
| 57 | 55 | */ |
| 58 | - public function getAll($id) |
|
| 59 | - { |
|
| 56 | + public function getAll($id) { |
|
| 60 | 57 | $annotations = []; |
| 61 | 58 | |
| 62 | 59 | $annotationData = $this->requestAnnotions($this->apiUrl . '?target=' . urlencode($id . '/*')); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $jsonld = Helper::getUrl($url); |
| 40 | 40 | |
| 41 | 41 | if ($jsonld) { |
| 42 | - $annotationData = json_decode($jsonld, true); |
|
| 42 | + $annotationData = json_decode($jsonld, TRUE); |
|
| 43 | 43 | |
| 44 | 44 | if ($annotationData) { |
| 45 | 45 | return $annotationData; |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | * @property-read SimpleXMLElement $mets this holds the XML file's METS part as SimpleXMLElement object |
| 73 | 73 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
| 74 | 74 | */ |
| 75 | -final class MetsDocument extends AbstractDocument |
|
| 76 | -{ |
|
| 75 | +final class MetsDocument extends AbstractDocument { |
|
| 77 | 76 | /** |
| 78 | 77 | * @access protected |
| 79 | 78 | * @var string[] Subsections / tags that may occur within `<mets:amdSec>` |
@@ -286,8 +285,7 @@ discard block |
||
| 286 | 285 | /** |
| 287 | 286 | * This gets the measure beginning of a page |
| 288 | 287 | */ |
| 289 | - public function getPageBeginning($pageId, $fileId) |
|
| 290 | - { |
|
| 288 | + public function getPageBeginning($pageId, $fileId) { |
|
| 291 | 289 | $mets = $this->mets |
| 292 | 290 | ->xpath( |
| 293 | 291 | './mets:structMap[@TYPE="PHYSICAL"]' . |
@@ -482,8 +480,7 @@ discard block |
||
| 482 | 480 | * |
| 483 | 481 | * @return ?string thumbnail or null if not found |
| 484 | 482 | */ |
| 485 | - private function getThumbnail(string $id = '') |
|
| 486 | - { |
|
| 483 | + private function getThumbnail(string $id = '') { |
|
| 487 | 484 | // Load plugin configuration. |
| 488 | 485 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 489 | 486 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
@@ -624,8 +621,7 @@ discard block |
||
| 624 | 621 | * @param DOMNode $parentNode |
| 625 | 622 | * @return array|false |
| 626 | 623 | */ |
| 627 | - private function getSubentries($allSubentries, string $parentIndex, DOMNode $parentNode) |
|
| 628 | - { |
|
| 624 | + private function getSubentries($allSubentries, string $parentIndex, DOMNode $parentNode) { |
|
| 629 | 625 | $domXPath = new DOMXPath($parentNode->ownerDocument); |
| 630 | 626 | $this->registerNamespaces($domXPath); |
| 631 | 627 | $theseSubentries = []; |
@@ -655,8 +651,7 @@ discard block |
||
| 655 | 651 | * @param $subentry |
| 656 | 652 | * @return array |
| 657 | 653 | */ |
| 658 | - private function getSubentryValue($values, $subentry) |
|
| 659 | - { |
|
| 654 | + private function getSubentryValue($values, $subentry) { |
|
| 660 | 655 | $theseSubentries = []; |
| 661 | 656 | if ( |
| 662 | 657 | ($values instanceof DOMNodeList |
@@ -906,8 +901,7 @@ discard block |
||
| 906 | 901 | * |
| 907 | 902 | * @return bool true if extraction successful, false otherwise |
| 908 | 903 | */ |
| 909 | - private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) |
|
| 910 | - { |
|
| 904 | + private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) { |
|
| 911 | 905 | // Is this metadata format supported? |
| 912 | 906 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']])) { |
| 913 | 907 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']]['class'])) { |
@@ -939,8 +933,7 @@ discard block |
||
| 939 | 933 | * |
| 940 | 934 | * @return array additional metadata data queried from database |
| 941 | 935 | */ |
| 942 | - private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) |
|
| 943 | - { |
|
| 936 | + private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) { |
|
| 944 | 937 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
| 945 | 938 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
| 946 | 939 | // Get hidden records, too. |
@@ -1131,8 +1124,7 @@ discard block |
||
| 1131 | 1124 | /** |
| 1132 | 1125 | * @see AbstractDocument::getStructureDepth() |
| 1133 | 1126 | */ |
| 1134 | - public function getStructureDepth(string $logId) |
|
| 1135 | - { |
|
| 1127 | + public function getStructureDepth(string $logId) { |
|
| 1136 | 1128 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
| 1137 | 1129 | if (!empty($ancestors)) { |
| 1138 | 1130 | return count($ancestors); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @see MetsDocument::$mdSec |
| 111 | 111 | */ |
| 112 | - protected bool $mdSecLoaded = false; |
|
| 112 | + protected bool $mdSecLoaded = FALSE; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * @access protected |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @see $fileGrps |
| 133 | 133 | */ |
| 134 | - protected bool $fileGrpsLoaded = false; |
|
| 134 | + protected bool $fileGrpsLoaded = FALSE; |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * @access protected |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @var bool |
| 175 | 175 | * @access protected |
| 176 | 176 | */ |
| 177 | - protected bool $musicalStructureLoaded = false; |
|
| 177 | + protected bool $musicalStructureLoaded = FALSE; |
|
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * The holds the total number of measures |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | return $service->getImageUrl(); |
| 241 | 241 | } |
| 242 | 242 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
| 243 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
| 243 | + $baseURL = $file['location'] . (strpos($file['location'], '?') === FALSE ? '?' : ''); |
|
| 244 | 244 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 245 | 245 | return $baseURL . '&CVT=jpeg'; |
| 246 | 246 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $this->fileInfos[$id]['mimeType'] = $this->getFileMimeType($id); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - return $this->fileInfos[$id] ?? null; |
|
| 266 | + return $this->fileInfos[$id] ?? NULL; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | /** |
| 320 | 320 | * @see AbstractDocument::getLogicalStructure() |
| 321 | 321 | */ |
| 322 | - public function getLogicalStructure(string $id, bool $recursive = false): array |
|
| 322 | + public function getLogicalStructure(string $id, bool $recursive = FALSE): array |
|
| 323 | 323 | { |
| 324 | 324 | $details = []; |
| 325 | 325 | // Is the requested logical unit already loaded? |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * |
| 361 | 361 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
| 362 | 362 | */ |
| 363 | - protected function getLogicalStructureInfo(SimpleXMLElement $structure, bool $recursive = false): array |
|
| 363 | + protected function getLogicalStructureInfo(SimpleXMLElement $structure, bool $recursive = FALSE): array |
|
| 364 | 364 | { |
| 365 | 365 | $attributes = $structure->attributes(); |
| 366 | 366 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | 'pagination' => '', |
| 379 | 379 | 'type' => isset($attributes['TYPE']) ? (string) $attributes['TYPE'] : '', |
| 380 | 380 | 'description' => '', |
| 381 | - 'thumbnailId' => null, |
|
| 381 | + 'thumbnailId' => NULL, |
|
| 382 | 382 | 'files' => [], |
| 383 | 383 | ]; |
| 384 | 384 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $details['children'] = []; |
| 414 | 414 | foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) { |
| 415 | 415 | // Repeat for all children. |
| 416 | - $details['children'][] = $this->getLogicalStructureInfo($child, true); |
|
| 416 | + $details['children'][] = $this->getLogicalStructureInfo($child, TRUE); |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | return $details; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | && array_key_exists($details['id'], $this->smLinks['l2p']) |
| 460 | 460 | ) { |
| 461 | 461 | // Link logical structure to the first corresponding physical page/track. |
| 462 | - $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true), 1); |
|
| 462 | + $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE), 1); |
|
| 463 | 463 | $details['thumbnailId'] = $this->getThumbnail(); |
| 464 | 464 | // Get page/track number of the first page/track related to this structure element. |
| 465 | 465 | $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel']; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $details['points'] = 1; |
| 469 | 469 | $details['thumbnailId'] = $this->getThumbnail(); |
| 470 | 470 | } |
| 471 | - if ($details['thumbnailId'] === null) { |
|
| 471 | + if ($details['thumbnailId'] === NULL) { |
|
| 472 | 472 | unset($details['thumbnailId']); |
| 473 | 473 | } |
| 474 | 474 | } |
@@ -488,14 +488,14 @@ discard block |
||
| 488 | 488 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 489 | 489 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
| 490 | 490 | |
| 491 | - $thumbnail = null; |
|
| 491 | + $thumbnail = NULL; |
|
| 492 | 492 | |
| 493 | 493 | while ($fileGrpThumb = array_shift($fileGrpsThumb)) { |
| 494 | 494 | if (empty($id)) { |
| 495 | - $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? null; |
|
| 495 | + $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? NULL; |
|
| 496 | 496 | } else { |
| 497 | - $parentId = $this->smLinks['l2p'][$id][0] ?? null; |
|
| 498 | - $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? null; |
|
| 497 | + $parentId = $this->smLinks['l2p'][$id][0] ?? NULL; |
|
| 498 | + $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? NULL; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | if (!empty($thumbnail)) { |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | if (empty($theseSubentries)) { |
| 648 | - return false; |
|
| 648 | + return FALSE; |
|
| 649 | 649 | } |
| 650 | 650 | return $theseSubentries; |
| 651 | 651 | } |
@@ -716,13 +716,13 @@ discard block |
||
| 716 | 716 | private function extractAndProcessMetadata(string $dmdId, string $mdSectionType, array &$metadata, int $cPid, array $metadataSections): bool |
| 717 | 717 | { |
| 718 | 718 | if ($this->hasMetadataSection($metadataSections, $mdSectionType, 'dmdSec')) { |
| 719 | - return true; |
|
| 719 | + return TRUE; |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | $metadataExtracted = $this->extractMetadataIfTypeSupported($dmdId, $mdSectionType, $metadata); |
| 723 | 723 | |
| 724 | 724 | if (!$metadataExtracted) { |
| 725 | - return false; |
|
| 725 | + return FALSE; |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | 728 | $additionalMetadata = $this->getAdditionalMetadataFromDatabase($cPid, $dmdId); |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | |
| 734 | 734 | $this->processAdditionalMetadata($additionalMetadata, $domXPath, $domNode, $metadata); |
| 735 | 735 | |
| 736 | - return true; |
|
| 736 | + return TRUE; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | /** |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $obj = GeneralUtility::makeInstance($class); |
| 918 | 918 | if ($obj instanceof MetadataInterface) { |
| 919 | 919 | $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata, GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'general')['useExternalApisForMetadata']); |
| 920 | - return true; |
|
| 920 | + return TRUE; |
|
| 921 | 921 | } |
| 922 | 922 | } else { |
| 923 | 923 | $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | } else { |
| 927 | 927 | $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
| 928 | 928 | } |
| 929 | - return false; |
|
| 929 | + return FALSE; |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | /** |
@@ -1172,16 +1172,16 @@ discard block |
||
| 1172 | 1172 | protected function loadLocation(string $location): bool |
| 1173 | 1173 | { |
| 1174 | 1174 | $fileResource = Helper::getUrl($location); |
| 1175 | - if ($fileResource !== false) { |
|
| 1175 | + if ($fileResource !== FALSE) { |
|
| 1176 | 1176 | $xml = Helper::getXmlFileAsString($fileResource); |
| 1177 | 1177 | // Set some basic properties. |
| 1178 | - if ($xml !== false) { |
|
| 1178 | + if ($xml !== FALSE) { |
|
| 1179 | 1179 | $this->xml = $xml; |
| 1180 | - return true; |
|
| 1180 | + return TRUE; |
|
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | $this->logger->error('Could not load XML file from "' . $location . '"'); |
| 1184 | - return false; |
|
| 1184 | + return FALSE; |
|
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | /** |
@@ -1203,9 +1203,9 @@ discard block |
||
| 1203 | 1203 | |
| 1204 | 1204 | if ($preloadedDocument instanceof SimpleXMLElement) { |
| 1205 | 1205 | $this->xml = $preloadedDocument; |
| 1206 | - return true; |
|
| 1206 | + return TRUE; |
|
| 1207 | 1207 | } |
| 1208 | - return false; |
|
| 1208 | + return FALSE; |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | /** |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) { |
| 1232 | 1232 | $dmdSec = $this->processMdSec($dmdSecTag); |
| 1233 | 1233 | |
| 1234 | - if ($dmdSec !== null) { |
|
| 1234 | + if ($dmdSec !== NULL) { |
|
| 1235 | 1235 | $this->mdSec[$dmdSec['id']] = $dmdSec; |
| 1236 | 1236 | $this->dmdSec[$dmdSec['id']] = $dmdSec; |
| 1237 | 1237 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)? |
| 1249 | 1249 | $mdSec = $this->processMdSec($mdSecTag); |
| 1250 | 1250 | |
| 1251 | - if ($mdSec !== null) { |
|
| 1251 | + if ($mdSec !== NULL) { |
|
| 1252 | 1252 | $this->mdSec[$mdSec['id']] = $mdSec; |
| 1253 | 1253 | |
| 1254 | 1254 | $childIds[] = $mdSec['id']; |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | } |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - $this->mdSecLoaded = true; |
|
| 1264 | + $this->mdSecLoaded = TRUE; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | return $this->mdSec; |
| 1267 | 1267 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | { |
| 1293 | 1293 | $mdId = (string) $element->attributes()->ID; |
| 1294 | 1294 | if (empty($mdId)) { |
| 1295 | - return null; |
|
| 1295 | + return NULL; |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | 1298 | $this->registerNamespaces($element); |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | if (empty($xml)) { |
| 1313 | - return null; |
|
| 1313 | + return NULL; |
|
| 1314 | 1314 | } |
| 1315 | 1315 | |
| 1316 | 1316 | $this->registerNamespaces($xml[0]); |
@@ -1376,9 +1376,9 @@ discard block |
||
| 1376 | 1376 | !empty($extConf['fileGrpFulltext']) |
| 1377 | 1377 | && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== [] |
| 1378 | 1378 | ) { |
| 1379 | - $this->hasFulltext = true; |
|
| 1379 | + $this->hasFulltext = TRUE; |
|
| 1380 | 1380 | } |
| 1381 | - $this->fileGrpsLoaded = true; |
|
| 1381 | + $this->fileGrpsLoaded = TRUE; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | return $this->fileGrps; |
| 1384 | 1384 | } |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | |
| 1440 | 1440 | $this->physicalStructure = $this->getPhysicalElements($elementNodes, $fileUse); |
| 1441 | 1441 | } |
| 1442 | - $this->physicalStructureLoaded = true; |
|
| 1442 | + $this->physicalStructureLoaded = TRUE; |
|
| 1443 | 1443 | |
| 1444 | 1444 | } |
| 1445 | 1445 | |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from; |
| 1553 | 1553 | } |
| 1554 | 1554 | } |
| 1555 | - $this->smLinksLoaded = true; |
|
| 1555 | + $this->smLinksLoaded = TRUE; |
|
| 1556 | 1556 | } |
| 1557 | 1557 | return $this->smLinks; |
| 1558 | 1558 | } |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | /** |
| 1561 | 1561 | * @see AbstractDocument::magicGetThumbnail() |
| 1562 | 1562 | */ |
| 1563 | - protected function magicGetThumbnail(bool $forceReload = false): string |
|
| 1563 | + protected function magicGetThumbnail(bool $forceReload = FALSE): string |
|
| 1564 | 1564 | { |
| 1565 | 1565 | if ( |
| 1566 | 1566 | !$this->thumbnailLoaded |
@@ -1570,14 +1570,14 @@ discard block |
||
| 1570 | 1570 | $cPid = $this->cPid ?: $this->pid; |
| 1571 | 1571 | if (!$cPid) { |
| 1572 | 1572 | $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
| 1573 | - $this->thumbnailLoaded = true; |
|
| 1573 | + $this->thumbnailLoaded = TRUE; |
|
| 1574 | 1574 | return $this->thumbnail; |
| 1575 | 1575 | } |
| 1576 | 1576 | // Load extension configuration. |
| 1577 | 1577 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
| 1578 | 1578 | if (empty($extConf['fileGrpThumbs'])) { |
| 1579 | 1579 | $this->logger->warning('No fileGrp for thumbnails specified'); |
| 1580 | - $this->thumbnailLoaded = true; |
|
| 1580 | + $this->thumbnailLoaded = TRUE; |
|
| 1581 | 1581 | return $this->thumbnail; |
| 1582 | 1582 | } |
| 1583 | 1583 | $strctId = $this->magicGetToplevelId(); |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | } else { |
| 1632 | 1632 | $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
| 1633 | 1633 | } |
| 1634 | - $this->thumbnailLoaded = true; |
|
| 1634 | + $this->thumbnailLoaded = TRUE; |
|
| 1635 | 1635 | } |
| 1636 | 1636 | return $this->thumbnail; |
| 1637 | 1637 | } |
@@ -1709,8 +1709,8 @@ discard block |
||
| 1709 | 1709 | public function __toString(): string |
| 1710 | 1710 | { |
| 1711 | 1711 | $xml = new DOMDocument('1.0', 'utf-8'); |
| 1712 | - $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
|
| 1713 | - $xml->formatOutput = true; |
|
| 1712 | + $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE)); |
|
| 1713 | + $xml->formatOutput = TRUE; |
|
| 1714 | 1714 | return $xml->saveXML(); |
| 1715 | 1715 | } |
| 1716 | 1716 | |
@@ -1725,7 +1725,7 @@ discard block |
||
| 1725 | 1725 | public function __wakeup(): void |
| 1726 | 1726 | { |
| 1727 | 1727 | $xml = Helper::getXmlFileAsString($this->asXML); |
| 1728 | - if ($xml !== false) { |
|
| 1728 | + if ($xml !== FALSE) { |
|
| 1729 | 1729 | $this->asXML = ''; |
| 1730 | 1730 | $this->xml = $xml; |
| 1731 | 1731 | // Rebuild the unserializable properties. |
@@ -1848,7 +1848,7 @@ discard block |
||
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | } |
| 1851 | - $this->musicalStructureLoaded = true; |
|
| 1851 | + $this->musicalStructureLoaded = TRUE; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | return $this->musicalStructure; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $file = $this->getFileInfo($id); |
| 232 | 232 | if ($file['mimeType'] === 'application/vnd.kitodo.iiif') { |
| 233 | - $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'] . 'info.json' : $file['location'] . '/info.json'); |
|
| 233 | + $file['location'] = (strrpos($file['location'], 'info.json') === strlen($file['location']) - 9) ? $file['location'] : (strrpos($file['location'], '/') === strlen($file['location']) ? $file['location'].'info.json' : $file['location'].'/info.json'); |
|
| 234 | 234 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif'); |
| 235 | 235 | IiifHelper::setUrlReader(IiifUrlReader::getInstance()); |
| 236 | 236 | IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']); |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | return $service->getImageUrl(); |
| 241 | 241 | } |
| 242 | 242 | } elseif ($file['mimeType'] === 'application/vnd.netfpx') { |
| 243 | - $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : ''); |
|
| 243 | + $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : ''); |
|
| 244 | 244 | // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server' |
| 245 | - return $baseURL . '&CVT=jpeg'; |
|
| 245 | + return $baseURL.'&CVT=jpeg'; |
|
| 246 | 246 | } |
| 247 | 247 | return $file['location']; |
| 248 | 248 | } |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function getFileLocation(string $id): string |
| 273 | 273 | { |
| 274 | - $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 274 | + $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]'); |
|
| 275 | 275 | if ( |
| 276 | 276 | !empty($id) |
| 277 | 277 | && !empty($location) |
| 278 | 278 | ) { |
| 279 | 279 | return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 280 | 280 | } else { |
| 281 | - $this->logger->warning('There is no file node with @ID "' . $id . '"'); |
|
| 281 | + $this->logger->warning('There is no file node with @ID "'.$id.'"'); |
|
| 282 | 282 | return ''; |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -290,9 +290,9 @@ discard block |
||
| 290 | 290 | { |
| 291 | 291 | $mets = $this->mets |
| 292 | 292 | ->xpath( |
| 293 | - './mets:structMap[@TYPE="PHYSICAL"]' . |
|
| 294 | - '//mets:div[@ID="' . $pageId . '"]' . |
|
| 295 | - '/mets:fptr[@FILEID="' . $fileId . '"]' . |
|
| 293 | + './mets:structMap[@TYPE="PHYSICAL"]'. |
|
| 294 | + '//mets:div[@ID="'.$pageId.'"]'. |
|
| 295 | + '/mets:fptr[@FILEID="'.$fileId.'"]'. |
|
| 296 | 296 | '/mets:area/@BEGIN' |
| 297 | 297 | ); |
| 298 | 298 | return empty($mets) ? '' : $mets[0]->__toString(); |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function getFileMimeType(string $id): string |
| 306 | 306 | { |
| 307 | - $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
|
| 307 | + $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE'); |
|
| 308 | 308 | if ( |
| 309 | 309 | !empty($id) |
| 310 | 310 | && !empty($mimetype) |
| 311 | 311 | ) { |
| 312 | 312 | return (string) $mimetype[0]; |
| 313 | 313 | } else { |
| 314 | - $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified'); |
|
| 314 | + $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified'); |
|
| 315 | 315 | return ''; |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | return $this->logicalUnits[$id]; |
| 332 | 332 | } elseif (!empty($id)) { |
| 333 | 333 | // Get specified logical unit. |
| 334 | - $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]'); |
|
| 334 | + $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]'); |
|
| 335 | 335 | } else { |
| 336 | 336 | // Get all logical units at top level. |
| 337 | 337 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $cPid = max($cPid, 0); |
| 547 | 547 | if ($cPid == 0 && ($this->cPid || $this->pid)) { |
| 548 | 548 | // Retain current PID. |
| 549 | - $cPid = $this->cPid ?: $this->pid; |
|
| 549 | + $cPid = $this->cPid ? : $this->pid; |
|
| 550 | 550 | } |
| 551 | 551 | return $cPid; |
| 552 | 552 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) { |
| 616 | 616 | return $metadata; |
| 617 | 617 | } else { |
| 618 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
| 618 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
| 619 | 619 | return []; |
| 620 | 620 | } |
| 621 | 621 | } |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | if (!empty($this->logicalUnits[$id])) { |
| 695 | 695 | return [$this->logicalUnits[$id]['type']]; |
| 696 | 696 | } else { |
| 697 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 697 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 698 | 698 | if (!empty($struct)) { |
| 699 | 699 | return [(string) $struct[0]]; |
| 700 | 700 | } |
@@ -851,17 +851,17 @@ discard block |
||
| 851 | 851 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 852 | 852 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
| 853 | 853 | if ($values instanceof DOMNodeList && $values->length > 0) { |
| 854 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 854 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 855 | 855 | } elseif (!($values instanceof DOMNodeList)) { |
| 856 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values); |
|
| 856 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values); |
|
| 857 | 857 | } |
| 858 | 858 | } |
| 859 | - if (empty($metadata[$indexName . '_sorting'][0])) { |
|
| 859 | + if (empty($metadata[$indexName.'_sorting'][0])) { |
|
| 860 | 860 | if (is_array($currentMetadata)) { |
| 861 | 861 | $sortingValue = implode(',', array_column($currentMetadata, 0)); |
| 862 | - $metadata[$indexName . '_sorting'][0] = $sortingValue; |
|
| 862 | + $metadata[$indexName.'_sorting'][0] = $sortingValue; |
|
| 863 | 863 | } else { |
| 864 | - $metadata[$indexName . '_sorting'][0] = $currentMetadata; |
|
| 864 | + $metadata[$indexName.'_sorting'][0] = $currentMetadata; |
|
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | } |
@@ -922,11 +922,11 @@ discard block |
||
| 922 | 922 | return true; |
| 923 | 923 | } |
| 924 | 924 | } else { |
| 925 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
| 925 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | } else { |
| 929 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
| 929 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
| 930 | 930 | } |
| 931 | 931 | return false; |
| 932 | 932 | } |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
| 1080 | 1080 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
| 1081 | 1081 | } else { |
| 1082 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
| 1082 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
| 1083 | 1083 | if ($mdSec) { |
| 1084 | 1084 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
| 1085 | 1085 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | |
| 1110 | 1110 | return array_filter( |
| 1111 | 1111 | $allMdIds, |
| 1112 | - function ($element) { |
|
| 1112 | + function($element) { |
|
| 1113 | 1113 | return !empty($element); |
| 1114 | 1114 | } |
| 1115 | 1115 | ); |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | */ |
| 1136 | 1136 | public function getStructureDepth(string $logId) |
| 1137 | 1137 | { |
| 1138 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 1138 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 1139 | 1139 | if (!empty($ancestors)) { |
| 1140 | 1140 | return count($ancestors); |
| 1141 | 1141 | } else { |
@@ -1159,9 +1159,9 @@ discard block |
||
| 1159 | 1159 | $this->registerNamespaces($this->mets); |
| 1160 | 1160 | } else { |
| 1161 | 1161 | if (!empty($location)) { |
| 1162 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 1162 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 1163 | 1163 | } elseif (!empty($this->recordId)) { |
| 1164 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 1164 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 1165 | 1165 | } else { |
| 1166 | 1166 | $this->logger->error('No METS part found in current document.'); |
| 1167 | 1167 | } |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | return true; |
| 1183 | 1183 | } |
| 1184 | 1184 | } |
| 1185 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 1185 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 1186 | 1186 | return false; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
@@ -1305,10 +1305,10 @@ discard block |
||
| 1305 | 1305 | |
| 1306 | 1306 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
| 1307 | 1307 | $type = (string) $mdType[0]; |
| 1308 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1308 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1309 | 1309 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
| 1310 | 1310 | $type = (string) $otherMdType[0]; |
| 1311 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1311 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | 1314 | if (empty($xml)) { |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | // Get track info with begin and extent time for later assignment with musical |
| 1514 | 1514 | if ((string) $elementNode['TYPE'] === 'track') { |
| 1515 | 1515 | foreach ($elementNode->children('http://www.loc.gov/METS/')->fptr as $fptr) { |
| 1516 | - if (isset($fptr->area) && ((string) $fptr->area->attributes()->BETYPE === 'TIME')) { |
|
| 1516 | + if (isset($fptr->area) && ((string) $fptr->area->attributes()->BETYPE === 'TIME')) { |
|
| 1517 | 1517 | // Check if file has valid @USE attribute. |
| 1518 | 1518 | if (!empty($fileUse[(string) $fptr->area->attributes()->FILEID])) { |
| 1519 | 1519 | $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['tracks'][$fileUse[(string) $fptr->area->attributes()->FILEID]] = [ |
@@ -1567,9 +1567,9 @@ discard block |
||
| 1567 | 1567 | || $forceReload |
| 1568 | 1568 | ) { |
| 1569 | 1569 | // Retain current PID. |
| 1570 | - $cPid = $this->cPid ?: $this->pid; |
|
| 1570 | + $cPid = $this->cPid ? : $this->pid; |
|
| 1571 | 1571 | if (!$cPid) { |
| 1572 | - $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions'); |
|
| 1572 | + $this->logger->error('Invalid PID '.$cPid.' for structure definitions'); |
|
| 1573 | 1573 | $this->thumbnailLoaded = true; |
| 1574 | 1574 | return $this->thumbnail; |
| 1575 | 1575 | } |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | if (!empty($resArray['thumbnail'])) { |
| 1607 | 1607 | $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid); |
| 1608 | 1608 | // Check if this document has a structure element of the desired type. |
| 1609 | - $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID'); |
|
| 1609 | + $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID'); |
|
| 1610 | 1610 | if (!empty($strctIds)) { |
| 1611 | 1611 | $strctId = (string) $strctIds[0]; |
| 1612 | 1612 | } |
@@ -1629,7 +1629,7 @@ discard block |
||
| 1629 | 1629 | } |
| 1630 | 1630 | } |
| 1631 | 1631 | } else { |
| 1632 | - $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database'); |
|
| 1632 | + $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database'); |
|
| 1633 | 1633 | } |
| 1634 | 1634 | $this->thumbnailLoaded = true; |
| 1635 | 1635 | } |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | { |
| 1676 | 1676 | if (empty($this->parentHref)) { |
| 1677 | 1677 | // Get the closest ancestor of the current document which has a MPTR child. |
| 1678 | - $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1678 | + $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr'); |
|
| 1679 | 1679 | if (!empty($parentMptr)) { |
| 1680 | 1680 | $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href; |
| 1681 | 1681 | } |
@@ -130,11 +130,11 @@ |
||
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | } elseif ($annotationTarget->getObjectId()) { |
| 133 | - $objectTargetPages = []; |
|
| 133 | + $objectTargetPages = []; |
|
| 134 | 134 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physInfo) { |
| 135 | - $order = $physInfo['order']; |
|
| 135 | + $order = $physInfo['order']; |
|
| 136 | 136 | if ($order) { |
| 137 | - $objectTargetPages[] = $order; |
|
| 137 | + $objectTargetPages[] = $order; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | if ($objectTargetPages) { |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | ]; |
| 109 | 109 | } else { |
| 110 | 110 | $this->logger->warning( |
| 111 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
| 112 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
| 111 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
| 112 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
| 113 | 113 | ); |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | ]; |
| 126 | 126 | } else { |
| 127 | 127 | $this->logger->warning( |
| 128 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
| 129 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
| 128 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
| 129 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | } elseif ($annotationTarget->getObjectId()) { |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | 147 | $this->logger->warning( |
| 148 | - ' No target pages found! Annotation: "' . $annotation->getId() . '", ' |
|
| 149 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
| 148 | + ' No target pages found! Annotation: "'.$annotation->getId().'", ' |
|
| 149 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | } else { |
| 153 | 153 | $this->logger->warning( |
| 154 | - 'Invalid target! Annotation: "' . $annotation->getId() . '", ' |
|
| 155 | - . 'Target: "' . $annotationTarget->getUrl() . '"' |
|
| 154 | + 'Invalid target! Annotation: "'.$annotation->getId().'", ' |
|
| 155 | + . 'Target: "'.$annotationTarget->getUrl().'"' |
|
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | $intervalTo = \DateTime::createFromFormat('U.u', $to); |
| 268 | 268 | } |
| 269 | 269 | foreach ($tracks as $index => $track) { |
| 270 | - $begin = new DateTime("1970-01-01 " . $track['begin']); |
|
| 271 | - $extent = new DateTime("1970-01-01 " . $track['extent']); |
|
| 270 | + $begin = new DateTime("1970-01-01 ".$track['begin']); |
|
| 271 | + $extent = new DateTime("1970-01-01 ".$track['extent']); |
|
| 272 | 272 | $diff = (new DateTime("1970-01-01 00:00:00"))->diff($extent); |
| 273 | - $end = (new DateTime("1970-01-01 " . $track['begin']))->add($diff); |
|
| 273 | + $end = (new DateTime("1970-01-01 ".$track['begin']))->add($diff); |
|
| 274 | 274 | if ( |
| 275 | 275 | !( |
| 276 | 276 | $intervalFrom < $end && ( |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @access public |
| 30 | 30 | */ |
| 31 | -class DocumentAnnotation |
|
| 32 | -{ |
|
| 31 | +class DocumentAnnotation { |
|
| 33 | 32 | /** |
| 34 | 33 | * @var null|DocumentAnnotation |
| 35 | 34 | */ |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | * @param array $annotationData |
| 56 | 55 | * @param Document $document |
| 57 | 56 | */ |
| 58 | - private function __construct($annotationData, $document) |
|
| 59 | - { |
|
| 57 | + private function __construct($annotationData, $document) { |
|
| 60 | 58 | $this->annotationData = $annotationData; |
| 61 | 59 | $this->document = $document; |
| 62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
@@ -67,8 +65,7 @@ discard block |
||
| 67 | 65 | * |
| 68 | 66 | * @return Annotation[]|array |
| 69 | 67 | */ |
| 70 | - public function getAnnotations() |
|
| 71 | - { |
|
| 68 | + public function getAnnotations() { |
|
| 72 | 69 | if (empty($this->annotationData)) { |
| 73 | 70 | return []; |
| 74 | 71 | } |
@@ -168,8 +165,7 @@ discard block |
||
| 168 | 165 | * @param string $logicalId |
| 169 | 166 | * @return array |
| 170 | 167 | */ |
| 171 | - protected function getPagesByLogicalId($logicalId) |
|
| 172 | - { |
|
| 168 | + protected function getPagesByLogicalId($logicalId) { |
|
| 173 | 169 | $pages = []; |
| 174 | 170 | if ( |
| 175 | 171 | array_key_exists('l2p', $this->document->getCurrentDocument()->smLinks) && |
@@ -193,8 +189,7 @@ discard block |
||
| 193 | 189 | * @param string $physicalId |
| 194 | 190 | * @return array |
| 195 | 191 | */ |
| 196 | - protected function getPagesByPhysicalId($physicalId) |
|
| 197 | - { |
|
| 192 | + protected function getPagesByPhysicalId($physicalId) { |
|
| 198 | 193 | $pages = []; |
| 199 | 194 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
| 200 | 195 | $order = $physicalInfo['order']; |
@@ -217,8 +212,7 @@ discard block |
||
| 217 | 212 | * @param string $fileId |
| 218 | 213 | * @return array |
| 219 | 214 | */ |
| 220 | - protected function getPagesByFileId($fileId) |
|
| 221 | - { |
|
| 215 | + protected function getPagesByFileId($fileId) { |
|
| 222 | 216 | $pages = []; |
| 223 | 217 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
| 224 | 218 | if ( |
@@ -243,8 +237,7 @@ discard block |
||
| 243 | 237 | * @param string $range |
| 244 | 238 | * @return array |
| 245 | 239 | */ |
| 246 | - protected function getAudioPagesByFileId($fileId, $range = null) |
|
| 247 | - { |
|
| 240 | + protected function getAudioPagesByFileId($fileId, $range = null) { |
|
| 248 | 241 | $tracks = []; |
| 249 | 242 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
| 250 | 243 | if (array_key_exists('tracks', $physicalInfo) && is_array($physicalInfo['tracks'])) { |
@@ -299,8 +292,7 @@ discard block |
||
| 299 | 292 | * @param string $range |
| 300 | 293 | * @return array |
| 301 | 294 | */ |
| 302 | - protected function getMeasurePagesByFileId($fileId, $range = null) |
|
| 303 | - { |
|
| 295 | + protected function getMeasurePagesByFileId($fileId, $range = null) { |
|
| 304 | 296 | // Get all measures referencing the fileid |
| 305 | 297 | $measures = []; |
| 306 | 298 | // Get the related page numbers |
@@ -355,8 +347,7 @@ discard block |
||
| 355 | 347 | * |
| 356 | 348 | * @return array |
| 357 | 349 | */ |
| 358 | - public function getVerovioRelevantAnnotations() |
|
| 359 | - { |
|
| 350 | + public function getVerovioRelevantAnnotations() { |
|
| 360 | 351 | $annotations = []; |
| 361 | 352 | /** @var Annotation $annotation */ |
| 362 | 353 | foreach ($this->getAnnotations() as $annotation) { |
@@ -373,8 +364,7 @@ discard block |
||
| 373 | 364 | * @param Document $document |
| 374 | 365 | * @return array |
| 375 | 366 | */ |
| 376 | - protected static function loadData($document) |
|
| 377 | - { |
|
| 367 | + protected static function loadData($document) { |
|
| 378 | 368 | $annotationData = []; |
| 379 | 369 | $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
| 380 | 370 | $apiBaseUrl = $conf['annotationServerUrl']; |
@@ -393,8 +383,7 @@ discard block |
||
| 393 | 383 | * @return DocumentAnnotation|null |
| 394 | 384 | * |
| 395 | 385 | */ |
| 396 | - public static function getInstance($document) |
|
| 397 | - { |
|
| 386 | + public static function getInstance($document) { |
|
| 398 | 387 | if (self::$instance == null) { |
| 399 | 388 | $annotationData = self::loadData($document); |
| 400 | 389 | self::$instance = new DocumentAnnotation($annotationData, $document); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $targetPages[] = [ |
| 91 | 91 | 'target' => $annotationTarget, |
| 92 | 92 | 'pages' => $meiTargetPages, |
| 93 | - 'verovioRelevant' => true |
|
| 93 | + 'verovioRelevant' => TRUE |
|
| 94 | 94 | ]; |
| 95 | 95 | } elseif ( |
| 96 | 96 | $audioTargetPages = $this->getAudioPagesByFileId( |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $range |
| 244 | 244 | * @return array |
| 245 | 245 | */ |
| 246 | - protected function getAudioPagesByFileId($fileId, $range = null) |
|
| 246 | + protected function getAudioPagesByFileId($fileId, $range = NULL) |
|
| 247 | 247 | { |
| 248 | 248 | $tracks = []; |
| 249 | 249 | foreach ($this->document->getCurrentDocument()->physicalStructureInfo as $physicalInfo) { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $from = sprintf('%02.6f', (empty($from) ? "0" : $from)); |
| 262 | 262 | $intervalFrom = \DateTime::createFromFormat('U.u', $from); |
| 263 | 263 | if (empty($to)) { |
| 264 | - $intervalTo = null; |
|
| 264 | + $intervalTo = NULL; |
|
| 265 | 265 | } else { |
| 266 | 266 | $to = sprintf('%02.6f', $to); |
| 267 | 267 | $intervalTo = \DateTime::createFromFormat('U.u', $to); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | if ( |
| 275 | 275 | !( |
| 276 | 276 | $intervalFrom < $end && ( |
| 277 | - $intervalTo === null || $intervalTo > $begin |
|
| 277 | + $intervalTo === NULL || $intervalTo > $begin |
|
| 278 | 278 | ) |
| 279 | 279 | ) |
| 280 | 280 | ) { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | // Get the related page numbers |
| 286 | 286 | $trackPages = []; |
| 287 | 287 | foreach ($tracks as $track) { |
| 288 | - if ($track['order'] !== null) { |
|
| 288 | + if ($track['order'] !== NULL) { |
|
| 289 | 289 | $trackPages[] = $track['order']; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param string $range |
| 300 | 300 | * @return array |
| 301 | 301 | */ |
| 302 | - protected function getMeasurePagesByFileId($fileId, $range = null) |
|
| 302 | + protected function getMeasurePagesByFileId($fileId, $range = NULL) |
|
| 303 | 303 | { |
| 304 | 304 | // Get all measures referencing the fileid |
| 305 | 305 | $measures = []; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | public static function getInstance($document) |
| 397 | 397 | { |
| 398 | - if (self::$instance == null) { |
|
| 398 | + if (self::$instance == NULL) { |
|
| 399 | 399 | $annotationData = self::loadData($document); |
| 400 | 400 | self::$instance = new DocumentAnnotation($annotationData, $document); |
| 401 | 401 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_metadata.wrap', |
| 88 | 88 | 'config' => [ |
| 89 | 89 | 'behaviour' => [ |
| 90 | - 'allowLanguageSynchronization' => true |
|
| 90 | + 'allowLanguageSynchronization' => TRUE |
|
| 91 | 91 | ], |
| 92 | 92 | 'type' => 'text', |
| 93 | 93 | 'cols' => 48, |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | 'wrap' => 'off', |
| 96 | 96 | 'eval' => 'trim', |
| 97 | 97 | 'default' => "key.wrap = <strong>|:</strong>\nvalue.required = 1\nvalue.wrap = <span>|</span>\nall.wrap = <li>|</li>", |
| 98 | - 'fixedFont' => true, |
|
| 99 | - 'enableTabulator' => true |
|
| 98 | + 'fixedFont' => TRUE, |
|
| 99 | + 'enableTabulator' => TRUE |
|
| 100 | 100 | ], |
| 101 | 101 | ], |
| 102 | 102 | ], |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (!empty($model)) { |
| 70 | - $embedded3dViewerUrl .= '&model=' . $model; |
|
| 70 | + $embedded3dViewerUrl .= '&model='.$model; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (!empty($this->requestData['viewer'])) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (!empty($viewer)) { |
| 80 | - $embedded3dViewerUrl .= '&viewer=' . $viewer; |
|
| 80 | + $embedded3dViewerUrl .= '&viewer='.$viewer; |
|
| 81 | 81 | } |
| 82 | 82 | return $embedded3dViewerUrl; |
| 83 | 83 | } |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @access public |
| 23 | 23 | */ |
| 24 | -class Embedded3dViewerController extends AbstractController |
|
| 25 | -{ |
|
| 24 | +class Embedded3dViewerController extends AbstractController { |
|
| 26 | 25 | |
| 27 | 26 | const MIDDLEWARE_DLF_EMBEDDED_3D_VIEWER_PREFIX = '/?middleware=dlf/embedded3dviewer'; |
| 28 | 27 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $modelInfo = PathUtility::pathinfo($parameters['model']); |
| 70 | 70 | $modelFormat = $modelInfo["extension"]; |
| 71 | 71 | if (empty($modelFormat)) { |
| 72 | - return $this->warningResponse('Model path "' . $parameters['model'] . '" has no extension format', $request); |
|
| 72 | + return $this->warningResponse('Model path "'.$parameters['model'].'" has no extension format', $request); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (empty($parameters['viewer'])) { |
@@ -88,30 +88,30 @@ discard block |
||
| 88 | 88 | $defaultStorage = $storageRepository->getDefaultStorage(); |
| 89 | 89 | |
| 90 | 90 | if (!$defaultStorage->hasFolder(self::VIEWER_FOLDER)) { |
| 91 | - return $this->errorResponse('Required folder "' . self::VIEWER_FOLDER . '" was not found in the default storage "' . $defaultStorage->getName() . '"', $request); |
|
| 91 | + return $this->errorResponse('Required folder "'.self::VIEWER_FOLDER.'" was not found in the default storage "'.$defaultStorage->getName().'"', $request); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $viewerModules = $defaultStorage->getFolder(self::VIEWER_FOLDER); |
| 95 | 95 | if (!$viewerModules->hasFolder($viewer)) { |
| 96 | - return $this->errorResponse('Viewer folder "' . $viewer . '" was not found under the folder "' . self::VIEWER_FOLDER . '"', $request); |
|
| 96 | + return $this->errorResponse('Viewer folder "'.$viewer.'" was not found under the folder "'.self::VIEWER_FOLDER.'"', $request); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $viewerFolder = $viewerModules->getSubfolder($viewer); |
| 100 | 100 | if (!$viewerFolder->hasFile(self::VIEWER_CONFIG_YML)) { |
| 101 | - return $this->errorResponse('Viewer folder "' . $viewer . '" does not contain a file named "' . self::VIEWER_CONFIG_YML . '"', $request); |
|
| 101 | + return $this->errorResponse('Viewer folder "'.$viewer.'" does not contain a file named "'.self::VIEWER_CONFIG_YML.'"', $request); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** @var YamlFileLoader $yamlFileLoader */ |
| 105 | 105 | $yamlFileLoader = GeneralUtility::makeInstance(YamlFileLoader::class); |
| 106 | - $viewerConfigPath = $defaultStorage->getName() . "/" . self::VIEWER_FOLDER . "/" . $viewer . "/"; |
|
| 107 | - $config = $yamlFileLoader->load($viewerConfigPath . self::VIEWER_CONFIG_YML)["viewer"]; |
|
| 106 | + $viewerConfigPath = $defaultStorage->getName()."/".self::VIEWER_FOLDER."/".$viewer."/"; |
|
| 107 | + $config = $yamlFileLoader->load($viewerConfigPath.self::VIEWER_CONFIG_YML)["viewer"]; |
|
| 108 | 108 | |
| 109 | 109 | if (!isset($config["supportedModelFormats"]) || empty($config["supportedModelFormats"])) { |
| 110 | - return $this->errorResponse('Required key "supportedModelFormats" does not exist in the file "' . self::VIEWER_CONFIG_YML . '" of viewer "' . $viewer . '" or has no value', $request); |
|
| 110 | + return $this->errorResponse('Required key "supportedModelFormats" does not exist in the file "'.self::VIEWER_CONFIG_YML.'" of viewer "'.$viewer.'" or has no value', $request); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (array_search(strtolower($modelFormat), array_map('strtolower', $config["supportedModelFormats"])) === false) { |
| 114 | - return $this->warningResponse('Viewer "' . $viewer . '" does not support the model format "' . $modelFormat . '"', $request); |
|
| 114 | + return $this->warningResponse('Viewer "'.$viewer.'" does not support the model format "'.$modelFormat.'"', $request); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $html = $this->getViewerHtml($config, $viewerConfigPath, $viewerFolder, $parameters['model'], $modelInfo); |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | return $this->errorResponse('Required key "supportedModelFormats" does not exist in the file "' . self::VIEWER_CONFIG_YML . '" of viewer "' . $viewer . '" or has no value', $request); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (array_search(strtolower($modelFormat), array_map('strtolower', $config["supportedModelFormats"])) === false) { |
|
| 113 | + if (array_search(strtolower($modelFormat), array_map('strtolower', $config["supportedModelFormats"])) === FALSE) { |
|
| 114 | 114 | return $this->warningResponse('Viewer "' . $viewer . '" does not support the model format "' . $modelFormat . '"', $request); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -91,12 +91,12 @@ |
||
| 91 | 91 | $solr = Solr::getInstance($input->getOption('solr')); |
| 92 | 92 | // Connect to Solr server. |
| 93 | 93 | if (!$solr->ready) { |
| 94 | - $io->error('ERROR: Connection to Solr core ("' . $input->getOption('solr') . '") not possible \n'); |
|
| 94 | + $io->error('ERROR: Connection to Solr core ("'.$input->getOption('solr').'") not possible \n'); |
|
| 95 | 95 | return BaseCommand::FAILURE; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if (!$solr->optimize($input->getOption('commit'), $input->getOption('optimize'))) { |
| 99 | - $io->error('ERROR: Optimizing the Solr core ("' . $input->getOption('solr') . '") not possible \n'); |
|
| 99 | + $io->error('ERROR: Optimizing the Solr core ("'.$input->getOption('solr').'") not possible \n'); |
|
| 100 | 100 | return BaseCommand::FAILURE; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -27,8 +27,7 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @access public |
| 29 | 29 | */ |
| 30 | -class OptimizeCommand extends Command |
|
| 31 | -{ |
|
| 30 | +class OptimizeCommand extends Command { |
|
| 32 | 31 | |
| 33 | 32 | /** |
| 34 | 33 | * Configure the command by defining the name, options and arguments |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | ) |
| 51 | 51 | ->addOption( |
| 52 | 52 | 'commit', |
| 53 | - null, |
|
| 53 | + NULL, |
|
| 54 | 54 | InputOption::VALUE_NONE, |
| 55 | 55 | 'If this option is set, the commit command is sent.' |
| 56 | 56 | ) |
| 57 | 57 | ->addOption( |
| 58 | 58 | 'optimize', |
| 59 | - null, |
|
| 59 | + NULL, |
|
| 60 | 60 | InputOption::VALUE_NONE, |
| 61 | 61 | 'If this option is set, the optimize command is sent.' |
| 62 | 62 | ); |
@@ -23,10 +23,8 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class DeleteTask extends BaseTask |
|
| 27 | -{ |
|
| 28 | - public function execute() |
|
| 29 | - { |
|
| 26 | +class DeleteTask extends BaseTask { |
|
| 27 | + public function execute() { |
|
| 30 | 28 | $inputArray = []; |
| 31 | 29 | $inputArray['-d'] = $this->doc; |
| 32 | 30 | $inputArray['-p'] = $this->pid; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $inputArray['-p'] = $this->pid; |
| 33 | 33 | $inputArray['-s'] = $this->solr; |
| 34 | 34 | if (!empty($this->softCommit)) { |
| 35 | - $inputArray['--softCommit'] = true; |
|
| 35 | + $inputArray['--softCommit'] = TRUE; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $deleteCommand = GeneralUtility::makeInstance(\Kitodo\Dlf\Command\DeleteCommand::class); |
@@ -23,10 +23,8 @@ |
||
| 23 | 23 | * |
| 24 | 24 | * @access public |
| 25 | 25 | */ |
| 26 | -class OptimizeTask extends BaseTask |
|
| 27 | -{ |
|
| 28 | - public function execute() |
|
| 29 | - { |
|
| 26 | +class OptimizeTask extends BaseTask { |
|
| 27 | + public function execute() { |
|
| 30 | 28 | $inputArray = []; |
| 31 | 29 | $inputArray['-s'] = $this->solr; |
| 32 | 30 | if (!empty($this->commit)) { |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | $inputArray = []; |
| 31 | 31 | $inputArray['-s'] = $this->solr; |
| 32 | 32 | if (!empty($this->commit)) { |
| 33 | - $inputArray['--commit'] = true; |
|
| 33 | + $inputArray['--commit'] = TRUE; |
|
| 34 | 34 | } |
| 35 | 35 | if (!empty($this->optimize)) { |
| 36 | - $inputArray['--optimize'] = true; |
|
| 36 | + $inputArray['--optimize'] = TRUE; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $optimizeCommand = GeneralUtility::makeInstance(\Kitodo\Dlf\Command\OptimizeCommand::class); |