@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * LICENSE.txt file that was distributed with this source code. |
13 | 13 | */ |
14 | 14 | |
15 | -class Annotation |
|
16 | -{ |
|
15 | +class Annotation { |
|
17 | 16 | /** |
18 | 17 | * The complete data of the annotation |
19 | 18 | * |
@@ -30,8 +29,7 @@ discard block |
||
30 | 29 | /** |
31 | 30 | * @param array $data |
32 | 31 | */ |
33 | - public function __construct($data) |
|
34 | - { |
|
32 | + public function __construct($data) { |
|
35 | 33 | $this->data = $data; |
36 | 34 | } |
37 | 35 | |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | * |
41 | 39 | * @return array |
42 | 40 | */ |
43 | - public function getRawData() |
|
44 | - { |
|
41 | + public function getRawData() { |
|
45 | 42 | return $this->data; |
46 | 43 | } |
47 | 44 | |
@@ -50,8 +47,7 @@ discard block |
||
50 | 47 | * |
51 | 48 | * @return string |
52 | 49 | */ |
53 | - public function getId() |
|
54 | - { |
|
50 | + public function getId() { |
|
55 | 51 | return $this->data['id'] ?? ''; |
56 | 52 | } |
57 | 53 | |
@@ -60,8 +56,7 @@ discard block |
||
60 | 56 | * |
61 | 57 | * @return string |
62 | 58 | */ |
63 | - public function getTitle() |
|
64 | - { |
|
59 | + public function getTitle() { |
|
65 | 60 | return $this->data['title'] ?? ''; |
66 | 61 | } |
67 | 62 | |
@@ -70,8 +65,7 @@ discard block |
||
70 | 65 | * |
71 | 66 | * @return array |
72 | 67 | */ |
73 | - public function getBody() |
|
74 | - { |
|
68 | + public function getBody() { |
|
75 | 69 | $body = $this->data['body'] ?? ''; |
76 | 70 | |
77 | 71 | if (is_array($body)) { |
@@ -85,8 +79,7 @@ discard block |
||
85 | 79 | * Gets the name of the annotation creator |
86 | 80 | * @return string |
87 | 81 | */ |
88 | - public function getCreatorName() |
|
89 | - { |
|
82 | + public function getCreatorName() { |
|
90 | 83 | return $this->data['creator']['displayName'] ?? ''; |
91 | 84 | } |
92 | 85 | |
@@ -94,8 +87,7 @@ discard block |
||
94 | 87 | * Gets the creation date of the annotation |
95 | 88 | * @return string |
96 | 89 | */ |
97 | - public function getCreated() |
|
98 | - { |
|
90 | + public function getCreated() { |
|
99 | 91 | return $this->data['created'] ?? ''; |
100 | 92 | } |
101 | 93 | |
@@ -103,8 +95,7 @@ discard block |
||
103 | 95 | * Gets the modification date of the annotation |
104 | 96 | * @return string |
105 | 97 | */ |
106 | - public function getModified() |
|
107 | - { |
|
98 | + public function getModified() { |
|
108 | 99 | return $this->data['modified'] ?? ''; |
109 | 100 | } |
110 | 101 | |
@@ -113,8 +104,7 @@ discard block |
||
113 | 104 | * |
114 | 105 | * @return AnnotationTarget[] |
115 | 106 | */ |
116 | - public function getTargets() |
|
117 | - { |
|
107 | + public function getTargets() { |
|
118 | 108 | if (is_string($this->data['target'])) { |
119 | 109 | return [new AnnotationTarget($this->data['target'])]; |
120 | 110 | } |
@@ -133,8 +123,7 @@ discard block |
||
133 | 123 | * @param array $targetPages |
134 | 124 | * @return void |
135 | 125 | */ |
136 | - public function setTargetPages($targetPages) |
|
137 | - { |
|
126 | + public function setTargetPages($targetPages) { |
|
138 | 127 | $this->targetPages = $targetPages; |
139 | 128 | } |
140 | 129 | |
@@ -143,8 +132,7 @@ discard block |
||
143 | 132 | * |
144 | 133 | * @return array |
145 | 134 | */ |
146 | - public function getTargetPages() |
|
147 | - { |
|
135 | + public function getTargetPages() { |
|
148 | 136 | return $this->targetPages; |
149 | 137 | } |
150 | 138 | |
@@ -153,8 +141,7 @@ discard block |
||
153 | 141 | * |
154 | 142 | * @return array |
155 | 143 | */ |
156 | - public function getPageNumbers() |
|
157 | - { |
|
144 | + public function getPageNumbers() { |
|
158 | 145 | $pages = []; |
159 | 146 | if (is_array($this->targetPages)) { |
160 | 147 | foreach ($this->targetPages as $target) { |
@@ -170,8 +157,7 @@ discard block |
||
170 | 157 | * |
171 | 158 | * @return array |
172 | 159 | */ |
173 | - public function getPageTargets() |
|
174 | - { |
|
160 | + public function getPageTargets() { |
|
175 | 161 | $pageTargets = []; |
176 | 162 | if (is_array($this->targetPages)) { |
177 | 163 | foreach ($this->targetPages as $target) { |
@@ -189,8 +175,7 @@ discard block |
||
189 | 175 | * |
190 | 176 | * @return array |
191 | 177 | */ |
192 | - public function getPageAudioRanges() |
|
193 | - { |
|
178 | + public function getPageAudioRanges() { |
|
194 | 179 | $ranges = []; |
195 | 180 | if (is_array($this->getPageTargets())) { |
196 | 181 | foreach ($this->getPageTargets() as $pageNumber => $targets) { |
@@ -209,8 +194,7 @@ discard block |
||
209 | 194 | * |
210 | 195 | * @return array |
211 | 196 | */ |
212 | - public function getPageScoreRanges() |
|
213 | - { |
|
197 | + public function getPageScoreRanges() { |
|
214 | 198 | $ranges = []; |
215 | 199 | if (is_array($this->getPageTargets())) { |
216 | 200 | foreach ($this->getPageTargets() as $pageNumber => $targets) { |
@@ -229,8 +213,7 @@ discard block |
||
229 | 213 | * |
230 | 214 | * @return array |
231 | 215 | */ |
232 | - public function getPageFacsimileRanges() |
|
233 | - { |
|
216 | + public function getPageFacsimileRanges() { |
|
234 | 217 | $ranges = []; |
235 | 218 | if (is_array($this->getPageTargets())) { |
236 | 219 | foreach ($this->getPageTargets() as $pageNumber => $targets) { |
@@ -250,8 +233,7 @@ discard block |
||
250 | 233 | * |
251 | 234 | * @return bool |
252 | 235 | */ |
253 | - public function isVerovioRelevant() |
|
254 | - { |
|
236 | + public function isVerovioRelevant() { |
|
255 | 237 | foreach ($this->targetPages as $target) { |
256 | 238 | if (array_key_exists('verovioRelevant', $target) && $target['verovioRelevant']) { |
257 | 239 | return true; |
@@ -254,10 +254,10 @@ |
||
254 | 254 | { |
255 | 255 | foreach ($this->targetPages as $target) { |
256 | 256 | if (array_key_exists('verovioRelevant', $target) && $target['verovioRelevant']) { |
257 | - return true; |
|
257 | + return TRUE; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - return false; |
|
261 | + return FALSE; |
|
262 | 262 | } |
263 | 263 | } |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @access public |
32 | 32 | */ |
33 | -class MetadataFormat extends AbstractEntity |
|
34 | -{ |
|
33 | +class MetadataFormat extends AbstractEntity { |
|
35 | 34 | /** |
36 | 35 | * @access protected |
37 | 36 | * @var int UID of the ``tx_dlf_metadata`` that is encoded by this metadata entry. |
@@ -76,14 +75,12 @@ discard block |
||
76 | 75 | /** |
77 | 76 | * constructor |
78 | 77 | */ |
79 | - public function __construct() |
|
80 | - { |
|
78 | + public function __construct() { |
|
81 | 79 | // Do not remove the next line: It would break the functionality |
82 | 80 | $this->initStorageObjects(); |
83 | 81 | } |
84 | 82 | |
85 | - protected function initStorageObjects() |
|
86 | - { |
|
83 | + protected function initStorageObjects() { |
|
87 | 84 | $this->subentries = new ObjectStorage(); |
88 | 85 | } |
89 | 86 | |
@@ -151,8 +148,7 @@ discard block |
||
151 | 148 | $this->xpathSorting = $xpathSorting; |
152 | 149 | } |
153 | 150 | |
154 | - public function getSubentries() |
|
155 | - { |
|
151 | + public function getSubentries() { |
|
156 | 152 | return $this->subentries; |
157 | 153 | } |
158 | 154 | |
@@ -168,8 +164,7 @@ discard block |
||
168 | 164 | * |
169 | 165 | * @return void |
170 | 166 | */ |
171 | - public function addSubentry(MetadataSubentry $subentry) |
|
172 | - { |
|
167 | + public function addSubentry(MetadataSubentry $subentry) { |
|
173 | 168 | $this->subentries->attach($subentry); |
174 | 169 | } |
175 | 170 | |
@@ -180,8 +175,7 @@ discard block |
||
180 | 175 | * |
181 | 176 | * @return void |
182 | 177 | */ |
183 | - public function removeSubentry(MetadataSubentry $subentryToRemove) |
|
184 | - { |
|
178 | + public function removeSubentry(MetadataSubentry $subentryToRemove) { |
|
185 | 179 | $this->subentries->detach($subentryToRemove); |
186 | 180 | } |
187 | 181 |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class ToolboxController extends AbstractController |
|
28 | -{ |
|
27 | +class ToolboxController extends AbstractController { |
|
29 | 28 | |
30 | 29 | /** |
31 | 30 | * @access private |
@@ -208,8 +207,7 @@ discard block |
||
208 | 207 | * |
209 | 208 | * @return void |
210 | 209 | */ |
211 | - public function renderScoreTool() |
|
212 | - { |
|
210 | + public function renderScoreTool() { |
|
213 | 211 | if ( |
214 | 212 | $this->isDocMissingOrEmpty() |
215 | 213 | || empty($this->extConf['files']['fileGrpScore']) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | private function renderToolByName(string $tool): void |
121 | 121 | { |
122 | 122 | $this->$tool(); |
123 | - $this->view->assign($tool, true); |
|
123 | + $this->view->assign($tool, TRUE); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | |
143 | 143 | $annotationContainers = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$this->requestData['page']]]['annotationContainers']; |
144 | 144 | if ( |
145 | - $annotationContainers != null |
|
145 | + $annotationContainers != NULL |
|
146 | 146 | && count($annotationContainers) > 0 |
147 | 147 | ) { |
148 | - $this->view->assign('annotationTool', true); |
|
148 | + $this->view->assign('annotationTool', TRUE); |
|
149 | 149 | } else { |
150 | - $this->view->assign('annotationTool', false); |
|
150 | + $this->view->assign('annotationTool', FALSE); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | $this->setPage(); |
197 | 197 | |
198 | 198 | if (!$this->isFullTextEmpty()) { |
199 | - $this->view->assign('fulltext', true); |
|
199 | + $this->view->assign('fulltext', TRUE); |
|
200 | 200 | $this->view->assign('activateFullTextInitially', MathUtility::forceIntegerInRange($this->settings['activateFullTextInitially'], 0, 1, 0)); |
201 | 201 | } else { |
202 | - $this->view->assign('fulltext', false); |
|
202 | + $this->view->assign('fulltext', FALSE); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | } |
232 | 232 | } |
233 | 233 | if (!empty($scoreFile)) { |
234 | - $this->view->assign('score', true); |
|
234 | + $this->view->assign('score', TRUE); |
|
235 | 235 | $this->view->assign('activateScoreInitially', MathUtility::forceIntegerInRange($this->settings['activateScoreInitially'], 0, 1, 0)); |
236 | 236 | } else { |
237 | - $this->view->assign('score', false); |
|
237 | + $this->view->assign('score', FALSE); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // Set parent element for initialization. |
321 | 321 | $parentContainer = !empty($this->settings['parentContainer']) ? $this->settings['parentContainer'] : '.tx-dlf-imagemanipulationtool'; |
322 | 322 | |
323 | - $this->view->assign('imageManipulation', true); |
|
323 | + $this->view->assign('imageManipulation', TRUE); |
|
324 | 324 | $this->view->assign('parentContainer', $parentContainer); |
325 | 325 | } |
326 | 326 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | { |
484 | 484 | $id = $this->document->getUid(); |
485 | 485 | |
486 | - if ($id !== null && $id > 0) { |
|
486 | + if ($id !== NULL && $id > 0) { |
|
487 | 487 | // we found the document uid |
488 | 488 | return (string) $id; |
489 | 489 | } else { |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | while ($fileGrpFulltext = array_shift($fileGrpsFulltext)) { |
540 | 540 | $files = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$this->requestData['page']]]['files']; |
541 | 541 | if (!empty($files[$fileGrpFulltext])) { |
542 | - return false; |
|
542 | + return FALSE; |
|
543 | 543 | } |
544 | 544 | } |
545 | - return true; |
|
545 | + return TRUE; |
|
546 | 546 | } |
547 | 547 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->renderToolByName('renderScoreTool'); |
107 | 107 | break; |
108 | 108 | default: |
109 | - $this->logger->warning('Incorrect tool configuration: "' . $this->settings['tools'] . '". Tool "' . $tool . '" does not exist.'); |
|
109 | + $this->logger->warning('Incorrect tool configuration: "'.$this->settings['tools'].'". Tool "'.$tool.'" does not exist.'); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $file['url'] = $this->currentDocument->getDownloadLocation($fileId); |
319 | 319 | $file['mimetype'] = $this->currentDocument->getFileMimeType($fileId); |
320 | 320 | } else { |
321 | - $this->logger->warning('File not found in fileGrp "' . $fileGrp . '"'); |
|
321 | + $this->logger->warning('File not found in fileGrp "'.$fileGrp.'"'); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | return $file; |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | empty($firstPageLink) |
427 | 427 | && empty($secondPageLink) |
428 | 428 | ) { |
429 | - $this->logger->warning('File not found in fileGrps "' . $this->extConf['files']['fileGrpDownload'] . '"'); |
|
429 | + $this->logger->warning('File not found in fileGrps "'.$this->extConf['files']['fileGrpDownload'].'"'); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | if (!empty($firstPageLink)) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | if (empty($workLink)) { |
467 | - $this->logger->warning('File not found in fileGrps "' . $this->extConf['files']['fileGrpDownload'] . '"'); |
|
467 | + $this->logger->warning('File not found in fileGrps "'.$this->extConf['files']['fileGrpDownload'].'"'); |
|
468 | 468 | } |
469 | 469 | return $workLink; |
470 | 470 | } |
@@ -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 | } |