@@ -21,15 +21,13 @@ |
||
| 21 | 21 | * @subpackage dlf |
| 22 | 22 | * @access public |
| 23 | 23 | */ |
| 24 | -class AnnotationController extends AbstractController |
|
| 25 | -{ |
|
| 24 | +class AnnotationController extends AbstractController { |
|
| 26 | 25 | /** |
| 27 | 26 | * The main method of the plugin |
| 28 | 27 | * |
| 29 | 28 | * @return void |
| 30 | 29 | */ |
| 31 | - public function mainAction() |
|
| 32 | - { |
|
| 30 | + public function mainAction() { |
|
| 33 | 31 | $this->loadDocument(); |
| 34 | 32 | |
| 35 | 33 | if ( |
@@ -33,8 +33,8 @@ |
||
| 33 | 33 | $this->loadDocument(); |
| 34 | 34 | |
| 35 | 35 | if ( |
| 36 | - $this->document === null |
|
| 37 | - || $this->document->getCurrentDocument() === null |
|
| 36 | + $this->document === NULL |
|
| 37 | + || $this->document->getCurrentDocument() === NULL |
|
| 38 | 38 | ) { |
| 39 | 39 | // Quit without doing anything if required variables are not set. |
| 40 | 40 | return; |
@@ -18,10 +18,8 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Checks if the given subject is an array. |
| 20 | 20 | */ |
| 21 | -class IsArrayViewHelper extends AbstractViewHelper |
|
| 22 | -{ |
|
| 23 | - public function initializeArguments() |
|
| 24 | - { |
|
| 21 | +class IsArrayViewHelper extends AbstractViewHelper { |
|
| 22 | + public function initializeArguments() { |
|
| 25 | 23 | parent::initializeArguments(); |
| 26 | 24 | $this->registerArgument('subject', 'string', 'The subject'); |
| 27 | 25 | } |
@@ -29,8 +27,7 @@ discard block |
||
| 29 | 27 | /** |
| 30 | 28 | * @return bool |
| 31 | 29 | */ |
| 32 | - public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
|
| 33 | - { |
|
| 30 | + public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { |
|
| 34 | 31 | $subject = $arguments['subject']; |
| 35 | 32 | if ($subject === null) { |
| 36 | 33 | $subject = $renderChildrenClosure(); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
| 33 | 33 | { |
| 34 | 34 | $subject = $arguments['subject']; |
| 35 | - if ($subject === null) { |
|
| 35 | + if ($subject === NULL) { |
|
| 36 | 36 | $subject = $renderChildrenClosure(); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -13,10 +13,8 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
| 15 | 15 | |
| 16 | -class IsInArrayViewHelper extends AbstractViewHelper |
|
| 17 | -{ |
|
| 18 | - public function initializeArguments() |
|
| 19 | - { |
|
| 16 | +class IsInArrayViewHelper extends AbstractViewHelper { |
|
| 17 | + public function initializeArguments() { |
|
| 20 | 18 | parent::initializeArguments(); |
| 21 | 19 | $this->registerArgument('needle', 'mixed', 'The searched value', true); |
| 22 | 20 | $this->registerArgument('haystack', 'array', 'The array', true); |
@@ -27,8 +25,7 @@ discard block |
||
| 27 | 25 | * |
| 28 | 26 | * @return bool |
| 29 | 27 | */ |
| 30 | - public function render() |
|
| 31 | - { |
|
| 28 | + public function render() { |
|
| 32 | 29 | $needle = $this->arguments['needle']; |
| 33 | 30 | $haystack = $this->arguments['haystack']; |
| 34 | 31 | |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | public function initializeArguments() |
| 19 | 19 | { |
| 20 | 20 | parent::initializeArguments(); |
| 21 | - $this->registerArgument('needle', 'mixed', 'The searched value', true); |
|
| 22 | - $this->registerArgument('haystack', 'array', 'The array', true); |
|
| 21 | + $this->registerArgument('needle', 'mixed', 'The searched value', TRUE); |
|
| 22 | + $this->registerArgument('haystack', 'array', 'The array', TRUE); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -13,10 +13,8 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
| 15 | 15 | |
| 16 | -class ImplodeViewHelper extends AbstractViewHelper |
|
| 17 | -{ |
|
| 18 | - public function initializeArguments() |
|
| 19 | - { |
|
| 16 | +class ImplodeViewHelper extends AbstractViewHelper { |
|
| 17 | + public function initializeArguments() { |
|
| 20 | 18 | parent::initializeArguments(); |
| 21 | 19 | $this->registerArgument('value', 'array', 'The array to be imploded', true); |
| 22 | 20 | $this->registerArgument('delimiter', 'string', 'The delimiter ', true); |
@@ -27,8 +25,7 @@ discard block |
||
| 27 | 25 | * |
| 28 | 26 | * @return string |
| 29 | 27 | */ |
| 30 | - public function render() |
|
| 31 | - { |
|
| 28 | + public function render() { |
|
| 32 | 29 | $value = $this->arguments['value']; |
| 33 | 30 | $delimiter = $this->arguments['delimiter']; |
| 34 | 31 | |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | public function initializeArguments() |
| 19 | 19 | { |
| 20 | 20 | parent::initializeArguments(); |
| 21 | - $this->registerArgument('value', 'array', 'The array to be imploded', true); |
|
| 22 | - $this->registerArgument('delimiter', 'string', 'The delimiter ', true); |
|
| 21 | + $this->registerArgument('value', 'array', 'The array to be imploded', TRUE); |
|
| 22 | + $this->registerArgument('delimiter', 'string', 'The delimiter ', TRUE); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -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; |
@@ -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 | } |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) { |
| 614 | 614 | return $metadata; |
| 615 | 615 | } else { |
| 616 | - $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"'); |
|
| 616 | + $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"'); |
|
| 617 | 617 | return []; |
| 618 | 618 | } |
| 619 | 619 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | if (!empty($this->logicalUnits[$id])) { |
| 693 | 693 | return [$this->logicalUnits[$id]['type']]; |
| 694 | 694 | } else { |
| 695 | - $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE'); |
|
| 695 | + $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE'); |
|
| 696 | 696 | if (!empty($struct)) { |
| 697 | 697 | return [(string) $struct[0]]; |
| 698 | 698 | } |
@@ -849,17 +849,17 @@ discard block |
||
| 849 | 849 | if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) { |
| 850 | 850 | $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode); |
| 851 | 851 | if ($values instanceof DOMNodeList && $values->length > 0) { |
| 852 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 852 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values->item(0)->nodeValue); |
|
| 853 | 853 | } elseif (!($values instanceof DOMNodeList)) { |
| 854 | - $metadata[$indexName . '_sorting'][0] = trim((string) $values); |
|
| 854 | + $metadata[$indexName.'_sorting'][0] = trim((string) $values); |
|
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | - if (empty($metadata[$indexName . '_sorting'][0])) { |
|
| 857 | + if (empty($metadata[$indexName.'_sorting'][0])) { |
|
| 858 | 858 | if (is_array($currentMetadata)) { |
| 859 | 859 | $sortingValue = implode(',', array_column($currentMetadata, 0)); |
| 860 | - $metadata[$indexName . '_sorting'][0] = $sortingValue; |
|
| 860 | + $metadata[$indexName.'_sorting'][0] = $sortingValue; |
|
| 861 | 861 | } else { |
| 862 | - $metadata[$indexName . '_sorting'][0] = $currentMetadata; |
|
| 862 | + $metadata[$indexName.'_sorting'][0] = $currentMetadata; |
|
| 863 | 863 | } |
| 864 | 864 | } |
| 865 | 865 | } |
@@ -920,11 +920,11 @@ discard block |
||
| 920 | 920 | return true; |
| 921 | 921 | } |
| 922 | 922 | } else { |
| 923 | - $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"'); |
|
| 923 | + $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"'); |
|
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | } else { |
| 927 | - $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"'); |
|
| 927 | + $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"'); |
|
| 928 | 928 | } |
| 929 | 929 | return false; |
| 930 | 930 | } |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? ''; |
| 1078 | 1078 | $admIds = $this->logicalUnits[$id]['admId'] ?? ''; |
| 1079 | 1079 | } else { |
| 1080 | - $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0]; |
|
| 1080 | + $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0]; |
|
| 1081 | 1081 | if ($mdSec) { |
| 1082 | 1082 | $dmdIds = (string) $mdSec->attributes()->DMDID; |
| 1083 | 1083 | $admIds = (string) $mdSec->attributes()->ADMID; |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | return array_filter( |
| 1109 | 1109 | $allMdIds, |
| 1110 | - function ($element) { |
|
| 1110 | + function($element) { |
|
| 1111 | 1111 | return !empty($element); |
| 1112 | 1112 | } |
| 1113 | 1113 | ); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | */ |
| 1134 | 1134 | public function getStructureDepth(string $logId) |
| 1135 | 1135 | { |
| 1136 | - $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
|
| 1136 | + $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*'); |
|
| 1137 | 1137 | if (!empty($ancestors)) { |
| 1138 | 1138 | return count($ancestors); |
| 1139 | 1139 | } else { |
@@ -1157,9 +1157,9 @@ discard block |
||
| 1157 | 1157 | $this->registerNamespaces($this->mets); |
| 1158 | 1158 | } else { |
| 1159 | 1159 | if (!empty($location)) { |
| 1160 | - $this->logger->error('No METS part found in document with location "' . $location . '".'); |
|
| 1160 | + $this->logger->error('No METS part found in document with location "'.$location.'".'); |
|
| 1161 | 1161 | } elseif (!empty($this->recordId)) { |
| 1162 | - $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".'); |
|
| 1162 | + $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".'); |
|
| 1163 | 1163 | } else { |
| 1164 | 1164 | $this->logger->error('No METS part found in current document.'); |
| 1165 | 1165 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | return true; |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | - $this->logger->error('Could not load XML file from "' . $location . '"'); |
|
| 1183 | + $this->logger->error('Could not load XML file from "'.$location.'"'); |
|
| 1184 | 1184 | return false; |
| 1185 | 1185 | } |
| 1186 | 1186 | |
@@ -1303,10 +1303,10 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) { |
| 1305 | 1305 | $type = (string) $mdType[0]; |
| 1306 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1306 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1307 | 1307 | } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) { |
| 1308 | 1308 | $type = (string) $otherMdType[0]; |
| 1309 | - $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']); |
|
| 1309 | + $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']); |
|
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | if (empty($xml)) { |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | // Get track info wtih begin end 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 | } |
@@ -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; |
@@ -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 | ], |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @abstract |
| 37 | 37 | */ |
| 38 | -abstract class AbstractController extends ActionController implements LoggerAwareInterface |
|
| 39 | -{ |
|
| 38 | +abstract class AbstractController extends ActionController implements LoggerAwareInterface { |
|
| 40 | 39 | use LoggerAwareTrait; |
| 41 | 40 | |
| 42 | 41 | /** |
@@ -236,8 +235,7 @@ discard block |
||
| 236 | 235 | * |
| 237 | 236 | * @return null|string|array |
| 238 | 237 | */ |
| 239 | - protected function getParametersSafely(string $parameterName) |
|
| 240 | - { |
|
| 238 | + protected function getParametersSafely(string $parameterName) { |
|
| 241 | 239 | if ($this->request->hasArgument($parameterName)) { |
| 242 | 240 | return $this->request->getArgument($parameterName); |
| 243 | 241 | } |
@@ -333,8 +331,7 @@ discard block |
||
| 333 | 331 | * |
| 334 | 332 | * @return void |
| 335 | 333 | */ |
| 336 | - public function __construct() |
|
| 337 | - { |
|
| 334 | + public function __construct() { |
|
| 338 | 335 | $this->initialize(); |
| 339 | 336 | } |
| 340 | 337 | |
@@ -375,7 +372,8 @@ discard block |
||
| 375 | 372 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
| 376 | 373 | foreach (range($firstPage, $lastPage) as $i) { |
| 377 | 374 | // detect which pagination is active: ListView or GridView |
| 378 | - if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { // ListView |
|
| 375 | + if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') { |
|
| 376 | +// ListView |
|
| 379 | 377 | $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button |
| 380 | 378 | |
| 381 | 379 | $pages[$i] = [ |
@@ -388,7 +386,8 @@ discard block |
||
| 388 | 386 | if (in_array($i, $aRange)) { |
| 389 | 387 | array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]); |
| 390 | 388 | }; |
| 391 | - } else { // GridView |
|
| 389 | + } else { |
|
| 390 | +// GridView |
|
| 392 | 391 | // to calculate the values for generation the links for the pagination pages |
| 393 | 392 | /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */ |
| 394 | 393 | $itemsPerPage = $paginator->getPublicItemsPerPage(); |
@@ -468,8 +467,7 @@ discard block |
||
| 468 | 467 | * |
| 469 | 468 | * @return AbstractDocument |
| 470 | 469 | */ |
| 471 | - private function getDocumentByUid(int $documentId) |
|
| 472 | - { |
|
| 470 | + private function getDocumentByUid(int $documentId) { |
|
| 473 | 471 | $doc = null; |
| 474 | 472 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
| 475 | 473 | |
@@ -491,8 +489,7 @@ discard block |
||
| 491 | 489 | * |
| 492 | 490 | * @return AbstractDocument |
| 493 | 491 | */ |
| 494 | - protected function getDocumentByUrl(string $documentId) |
|
| 495 | - { |
|
| 492 | + protected function getDocumentByUrl(string $documentId) { |
|
| 496 | 493 | $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
| 497 | 494 | |
| 498 | 495 | if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @access protected |
| 62 | 62 | * @var Document|null This holds the current document |
| 63 | 63 | */ |
| 64 | - protected ?Document $document = null; |
|
| 64 | + protected ?Document $document = NULL; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @access protected |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Try to get document format from database |
| 138 | 138 | if (!empty($documentId)) { |
| 139 | 139 | |
| 140 | - $doc = null; |
|
| 140 | + $doc = NULL; |
|
| 141 | 141 | |
| 142 | 142 | if (MathUtility::canBeInterpretedAsInteger($documentId)) { |
| 143 | 143 | $doc = $this->getDocumentByUid($documentId); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $doc = $this->getDocumentByUrl($documentId); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ($this->document !== null && $doc !== null) { |
|
| 148 | + if ($this->document !== NULL && $doc !== NULL) { |
|
| 149 | 149 | $this->document->setCurrentDocument($doc); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $this->document = $this->documentRepository->findOneByRecordId($this->requestData['recordId']); |
| 155 | 155 | |
| 156 | - if ($this->document !== null) { |
|
| 157 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
| 158 | - if ($doc !== null) { |
|
| 156 | + if ($this->document !== NULL) { |
|
| 157 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
| 158 | + if ($doc !== NULL) { |
|
| 159 | 159 | $this->document->setCurrentDocument($doc); |
| 160 | 160 | } else { |
| 161 | 161 | $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function isDocMissing(): bool |
| 214 | 214 | { |
| 215 | - return $this->document === null || $this->document->getCurrentDocument() === null; |
|
| 215 | + return $this->document === NULL || $this->document->getCurrentDocument() === NULL; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | if ($this->request->hasArgument($parameterName)) { |
| 242 | 242 | return $this->request->getArgument($parameterName); |
| 243 | 243 | } |
| 244 | - return null; |
|
| 244 | + return NULL; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | if (isset($this->settings['multiViewType']) && $this->document->getCurrentDocument()->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
| 314 | 314 | $i = 0; |
| 315 | 315 | foreach ($this->documentArray as $document) { |
| 316 | - if ($document !== null) { |
|
| 316 | + if ($document !== NULL) { |
|
| 317 | 317 | $this->requestData['docPage'][$i] = MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i], 1, $document->numPages, 1); |
| 318 | 318 | $i++; |
| 319 | 319 | } |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | }; |
| 425 | 425 | |
| 426 | 426 | // Safely get the next and previous page numbers |
| 427 | - $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : null; |
|
| 428 | - $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : null; |
|
| 427 | + $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : NULL; |
|
| 428 | + $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : NULL; |
|
| 429 | 429 | |
| 430 | 430 | // 'startRecordNumber' is not required in GridView, only the variant for each loop is required |
| 431 | 431 | // 'endRecordNumber' is not required in both views |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | private function getDocumentByUid(int $documentId) |
| 472 | 472 | { |
| 473 | - $doc = null; |
|
| 473 | + $doc = NULL; |
|
| 474 | 474 | $this->document = $this->documentRepository->findOneByIdAndSettings($documentId); |
| 475 | 475 | |
| 476 | 476 | if ($this->document) { |
| 477 | - $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
|
| 477 | + $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE); |
|
| 478 | 478 | } else { |
| 479 | 479 | $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
| 480 | 480 | } |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | protected function getDocumentByUrl(string $documentId) |
| 495 | 495 | { |
| 496 | - $doc = AbstractDocument::getInstance($documentId, $this->settings, true); |
|
| 496 | + $doc = AbstractDocument::getInstance($documentId, $this->settings, TRUE); |
|
| 497 | 497 | |
| 498 | 498 | if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) { |
| 499 | 499 | $childDocuments = $doc->tableOfContents[0]['children']; |
| 500 | 500 | $i = 0; |
| 501 | 501 | foreach ($childDocuments as $document) { |
| 502 | - $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, true); |
|
| 502 | + $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, TRUE); |
|
| 503 | 503 | if (!isset($this->requestData['docPage'][$i]) && isset(explode('#', $document['points'])[1])) { |
| 504 | 504 | $initPage = explode('#', $document['points'])[1]; |
| 505 | 505 | $this->requestData['docPage'][$i] = $initPage; |
@@ -512,21 +512,21 @@ discard block |
||
| 512 | 512 | if ($this->requestData['multipleSource'] && is_array($this->requestData['multipleSource'])) { |
| 513 | 513 | $i = 0; |
| 514 | 514 | foreach ($this->requestData['multipleSource'] as $location) { |
| 515 | - $document = AbstractDocument::getInstance($location, $this->settings, true); |
|
| 516 | - if ($document !== null) { |
|
| 515 | + $document = AbstractDocument::getInstance($location, $this->settings, TRUE); |
|
| 516 | + if ($document !== NULL) { |
|
| 517 | 517 | $this->documentArray['extra_' . $i] = $document; |
| 518 | 518 | } |
| 519 | 519 | $i++; |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if ($doc !== null) { |
|
| 523 | + if ($doc !== NULL) { |
|
| 524 | 524 | $this->document = GeneralUtility::makeInstance(Document::class); |
| 525 | 525 | |
| 526 | 526 | if ($doc->recordId) { |
| 527 | 527 | // find document from repository by recordId |
| 528 | 528 | $docFromRepository = $this->documentRepository->findOneByRecordId($doc->recordId); |
| 529 | - if ($docFromRepository !== null) { |
|
| 529 | + if ($docFromRepository !== NULL) { |
|
| 530 | 530 | $this->document = $docFromRepository; |
| 531 | 531 | } |
| 532 | 532 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | if ($doc !== null) { |
| 159 | 159 | $this->document->setCurrentDocument($doc); |
| 160 | 160 | } else { |
| 161 | - $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"'); |
|
| 161 | + $this->logger->error('Failed to load document with record ID "'.$this->requestData['recordId'].'"'); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | - $this->logger->error('Invalid ID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
| 165 | + $this->logger->error('Invalid ID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | && !MathUtility::canBeInterpretedAsInteger($this->requestData['id']) |
| 260 | 260 | && !GeneralUtility::isValidUrl($this->requestData['id']) |
| 261 | 261 | ) { |
| 262 | - $this->logger->warning('Invalid ID or URI "' . $this->requestData['id'] . '" for document loading'); |
|
| 262 | + $this->logger->warning('Invalid ID or URI "'.$this->requestData['id'].'" for document loading'); |
|
| 263 | 263 | unset($this->requestData['id']); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | { |
| 320 | 320 | if (empty($this->settings[$setting])) { |
| 321 | 321 | $this->settings[$setting] = $value; |
| 322 | - $this->logger->warning('Setting "' . $setting . '" not set, using default value "' . $value . '". Probably FlexForm for controller "' . get_class($this) . '" is not read.'); |
|
| 322 | + $this->logger->warning('Setting "'.$setting.'" not set, using default value "'.$value.'". Probably FlexForm for controller "'.get_class($this).'" is not read.'); |
|
| 323 | 323 | } else { |
| 324 | 324 | $this->settings[$setting] = (int) $this->settings[$setting]; |
| 325 | 325 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $pages = []; |
| 405 | 405 | $pagesSect = []; |
| 406 | 406 | $aRange = []; |
| 407 | - $nRange = 5; // ToDo: should be made configurable |
|
| 407 | + $nRange = 5; // ToDo: should be made configurable |
|
| 408 | 408 | |
| 409 | 409 | // lower limit of the range |
| 410 | 410 | $nBottom = $currentPageNumber - $nRange; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | // check whether the first screen page is > 1, if yes then points must be added |
| 421 | 421 | if ($aRange[0] > 1) { |
| 422 | - array_push($pagesSect, ['label' => '...','startRecordNumber' => '...']); |
|
| 422 | + array_push($pagesSect, ['label' => '...', 'startRecordNumber' => '...']); |
|
| 423 | 423 | }; |
| 424 | 424 | $lastStartRecordNumberGrid = 0; // due to validity outside the loop |
| 425 | 425 | foreach (range($firstPage, $lastPage) as $i) { |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | // Check if screen page is in range |
| 464 | 464 | if (in_array($i, $aRange)) { |
| 465 | - array_push($pagesSect, ['label' => $i,'startRecordNumber' => $startRecordNumber]); |
|
| 465 | + array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $startRecordNumber]); |
|
| 466 | 466 | }; |
| 467 | 467 | }; |
| 468 | 468 | }; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | if ($this->document) { |
| 526 | 526 | $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true); |
| 527 | 527 | } else { |
| 528 | - $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading'); |
|
| 528 | + $this->logger->error('Invalid UID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading'); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | return $doc; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | foreach ($this->requestData['multipleSource'] as $location) { |
| 564 | 564 | $document = AbstractDocument::getInstance($location, $this->settings, true); |
| 565 | 565 | if ($document !== null) { |
| 566 | - $this->documentArray['extra_' . $i] = $document; |
|
| 566 | + $this->documentArray['extra_'.$i] = $document; |
|
| 567 | 567 | } |
| 568 | 568 | $i++; |
| 569 | 569 | } |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $this->document->setLocation($documentId); |
| 589 | 589 | } else { |
| 590 | - $this->logger->error('Invalid location given "' . $documentId . '" for document loading'); |
|
| 590 | + $this->logger->error('Invalid location given "'.$documentId.'" for document loading'); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | return $doc; |