Passed
Pull Request — master (#123)
by
unknown
05:25
created
Classes/Domain/Model/Annotation.php 2 patches
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -254,10 +254,10 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Classes/Domain/Model/MetadataFormat.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Classes/Controller/ToolboxController.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'])
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     private function renderToolByName(string $tool): void
128 128
     {
129 129
         $this->$tool();
130
-        $this->view->assign($tool, true);
130
+        $this->view->assign($tool, TRUE);
131 131
     }
132 132
 
133 133
     /**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 
176 176
         $annotationContainers = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$this->requestData['page']]]['annotationContainers'];
177 177
         if (
178
-            $annotationContainers != null
178
+            $annotationContainers != NULL
179 179
             && count($annotationContainers) > 0
180 180
         ) {
181
-            $this->view->assign('annotationTool', true);
181
+            $this->view->assign('annotationTool', TRUE);
182 182
         } else {
183
-            $this->view->assign('annotationTool', false);
183
+            $this->view->assign('annotationTool', FALSE);
184 184
         }
185 185
     }
186 186
 
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
         $this->setPage();
230 230
 
231 231
         if (!$this->isFullTextEmpty()) {
232
-            $this->view->assign('fulltext', true);
232
+            $this->view->assign('fulltext', TRUE);
233 233
             $this->view->assign('activateFullTextInitially', MathUtility::forceIntegerInRange($this->settings['activateFullTextInitially'], 0, 1, 0));
234 234
         } else {
235
-            $this->view->assign('fulltext', false);
235
+            $this->view->assign('fulltext', FALSE);
236 236
         }
237 237
     }
238 238
 
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
             }
265 265
         }
266 266
         if (!empty($scoreFile)) {
267
-            $this->view->assign('score', true);
267
+            $this->view->assign('score', TRUE);
268 268
             $this->view->assign('activateScoreInitially', MathUtility::forceIntegerInRange($this->settings['activateScoreInitially'], 0, 1, 0));
269 269
         } else {
270
-            $this->view->assign('score', false);
270
+            $this->view->assign('score', FALSE);
271 271
         }
272 272
     }
273 273
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         // Set parent element for initialization.
348 348
         $parentContainer = !empty($this->settings['parentContainer']) ? $this->settings['parentContainer'] : '.tx-dlf-imagemanipulationtool';
349 349
 
350
-        $this->view->assign('imageManipulation', true);
350
+        $this->view->assign('imageManipulation', TRUE);
351 351
         $this->view->assign('parentContainer', $parentContainer);
352 352
     }
353 353
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     {
535 535
         $id = $this->document->getUid();
536 536
 
537
-        if ($id !== null && $id > 0) {
537
+        if ($id !== NULL && $id > 0) {
538 538
             // we found the document uid
539 539
             return (string) $id;
540 540
         } else {
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
             if (isset($this->requestData['page'])) {
592 592
                 $files = $this->currentDocument->physicalStructureInfo[$this->currentDocument->physicalStructure[$this->requestData['page']]]['files'];
593 593
                 if (!empty($files[$fileGrpFulltext])) {
594
-                    return false;
594
+                    return FALSE;
595 595
                 }
596 596
             }
597 597
         }
598
-        return true;
598
+        return TRUE;
599 599
     }
600 600
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/IsArrayViewHelper.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,10 +18,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Classes/ViewHelpers/IsInArrayViewHelper.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Classes/ViewHelpers/ImplodeViewHelper.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,10 +13,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Classes/Common/AnnotationRequest.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 . '/*'));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Classes/Common/MetsDocument.php 3 patches
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
1848 1848
                 }
1849 1849
 
1850 1850
             }
1851
-            $this->musicalStructureLoaded = true;
1851
+            $this->musicalStructureLoaded = TRUE;
1852 1852
         }
1853 1853
 
1854 1854
         return $this->musicalStructure;
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
546 546
         $cPid = max($cPid, 0);
547 547
         if ($cPid == 0 && ($this->cPid || $this->pid)) {
548 548
             // Retain current PID.
549
-            $cPid = $this->cPid ?: $this->pid;
549
+            $cPid = $this->cPid ? : $this->pid;
550 550
         }
551 551
         return $cPid;
552 552
     }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
         if (isset($this->fileInfos[$id]) || in_array('dmdSec', $metadataSections)) {
616 616
             return $metadata;
617 617
         } else {
618
-            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"');
618
+            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"');
619 619
             return [];
620 620
         }
621 621
     }
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
         if (!empty($this->logicalUnits[$id])) {
695 695
             return [$this->logicalUnits[$id]['type']];
696 696
         } else {
697
-            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE');
697
+            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
698 698
             if (!empty($struct)) {
699 699
                 return [(string) $struct[0]];
700 700
             }
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
             if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) {
852 852
                 $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode);
853 853
                 if ($values instanceof DOMNodeList && $values->length > 0) {
854
-                    $metadata[$indexName . '_sorting'][0] = trim((string) $values->item(0)->nodeValue);
854
+                    $metadata[$indexName.'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
855 855
                 } elseif (!($values instanceof DOMNodeList)) {
856
-                    $metadata[$indexName . '_sorting'][0] = trim((string) $values);
856
+                    $metadata[$indexName.'_sorting'][0] = trim((string) $values);
857 857
                 }
858 858
             }
859
-            if (empty($metadata[$indexName . '_sorting'][0])) {
859
+            if (empty($metadata[$indexName.'_sorting'][0])) {
860 860
                 if (is_array($currentMetadata)) {
861 861
                     $sortingValue = implode(',', array_column($currentMetadata, 0));
862
-                    $metadata[$indexName . '_sorting'][0] = $sortingValue;
862
+                    $metadata[$indexName.'_sorting'][0] = $sortingValue;
863 863
                 } else {
864
-                    $metadata[$indexName . '_sorting'][0] = $currentMetadata;
864
+                    $metadata[$indexName.'_sorting'][0] = $currentMetadata;
865 865
                 }
866 866
             }
867 867
         }
@@ -922,11 +922,11 @@  discard block
 block discarded – undo
922 922
                         return true;
923 923
                     }
924 924
                 } else {
925
-                    $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"');
925
+                    $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"');
926 926
                 }
927 927
             }
928 928
         } else {
929
-            $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"');
929
+            $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"');
930 930
         }
931 931
         return false;
932 932
     }
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
             $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? '';
1080 1080
             $admIds = $this->logicalUnits[$id]['admId'] ?? '';
1081 1081
         } else {
1082
-            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0];
1082
+            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0];
1083 1083
             if ($mdSec) {
1084 1084
                 $dmdIds = (string) $mdSec->attributes()->DMDID;
1085 1085
                 $admIds = (string) $mdSec->attributes()->ADMID;
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
         return array_filter(
1111 1111
             $allMdIds,
1112
-            function ($element) {
1112
+            function($element) {
1113 1113
                 return !empty($element);
1114 1114
             }
1115 1115
         );
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
      */
1136 1136
     public function getStructureDepth(string $logId)
1137 1137
     {
1138
-        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
1138
+        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*');
1139 1139
         if (!empty($ancestors)) {
1140 1140
             return count($ancestors);
1141 1141
         } else {
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
             $this->registerNamespaces($this->mets);
1160 1160
         } else {
1161 1161
             if (!empty($location)) {
1162
-                $this->logger->error('No METS part found in document with location "' . $location . '".');
1162
+                $this->logger->error('No METS part found in document with location "'.$location.'".');
1163 1163
             } elseif (!empty($this->recordId)) {
1164
-                $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".');
1164
+                $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".');
1165 1165
             } else {
1166 1166
                 $this->logger->error('No METS part found in current document.');
1167 1167
             }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
                 return true;
1183 1183
             }
1184 1184
         }
1185
-        $this->logger->error('Could not load XML file from "' . $location . '"');
1185
+        $this->logger->error('Could not load XML file from "'.$location.'"');
1186 1186
         return false;
1187 1187
     }
1188 1188
 
@@ -1305,10 +1305,10 @@  discard block
 block discarded – undo
1305 1305
 
1306 1306
         if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) {
1307 1307
             $type = (string) $mdType[0];
1308
-            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
1308
+            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1309 1309
         } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) {
1310 1310
             $type = (string) $otherMdType[0];
1311
-            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
1311
+            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1312 1312
         }
1313 1313
 
1314 1314
         if (empty($xml)) {
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
             // Get track info with begin and extent time for later assignment with musical
1514 1514
             if ((string) $elementNode['TYPE'] === 'track') {
1515 1515
                 foreach ($elementNode->children('http://www.loc.gov/METS/')->fptr as $fptr) {
1516
-                    if (isset($fptr->area) &&  ((string) $fptr->area->attributes()->BETYPE === 'TIME')) {
1516
+                    if (isset($fptr->area) && ((string) $fptr->area->attributes()->BETYPE === 'TIME')) {
1517 1517
                         // Check if file has valid @USE attribute.
1518 1518
                         if (!empty($fileUse[(string) $fptr->area->attributes()->FILEID])) {
1519 1519
                             $this->physicalStructureInfo[$elements[(int) $elementNode['ORDER']]]['tracks'][$fileUse[(string) $fptr->area->attributes()->FILEID]] = [
@@ -1567,9 +1567,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Classes/Common/DocumentAnnotation.php 4 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 && (
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.