Passed
Pull Request — master (#123)
by
unknown
04:07
created
Classes/Common/MetsDocument.php 3 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         $file = $this->getFileInfo($id);
190 190
         if ($file['mimeType'] === 'application/vnd.kitodo.iiif') {
191
-            $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');
191
+            $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');
192 192
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'iiif');
193 193
             IiifHelper::setUrlReader(IiifUrlReader::getInstance());
194 194
             IiifHelper::setMaxThumbnailHeight($conf['thumbnailHeight']);
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
                 return $service->getImageUrl();
199 199
             }
200 200
         } elseif ($file['mimeType'] === 'application/vnd.netfpx') {
201
-            $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : '');
201
+            $baseURL = $file['location'].(strpos($file['location'], '?') === false ? '?' : '');
202 202
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
203
-            return $baseURL . '&CVT=jpeg';
203
+            return $baseURL.'&CVT=jpeg';
204 204
         }
205 205
         return $file['location'];
206 206
     }
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function getFileLocation(string $id): string
231 231
     {
232
-        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
232
+        $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/mets:FLocat[@LOCTYPE="URL"]');
233 233
         if (
234 234
             !empty($id)
235 235
             && !empty($location)
236 236
         ) {
237 237
             return (string) $location[0]->attributes('http://www.w3.org/1999/xlink')->href;
238 238
         } else {
239
-            $this->logger->warning('There is no file node with @ID "' . $id . '"');
239
+            $this->logger->warning('There is no file node with @ID "'.$id.'"');
240 240
             return '';
241 241
         }
242 242
     }
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function getFileMimeType(string $id): string
248 248
     {
249
-        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
249
+        $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="'.$id.'"]/@MIMETYPE');
250 250
         if (
251 251
             !empty($id)
252 252
             && !empty($mimetype)
253 253
         ) {
254 254
             return (string) $mimetype[0];
255 255
         } else {
256
-            $this->logger->warning('There is no file node with @ID "' . $id . '" or no MIME type specified');
256
+            $this->logger->warning('There is no file node with @ID "'.$id.'" or no MIME type specified');
257 257
             return '';
258 258
         }
259 259
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             return $this->logicalUnits[$id];
274 274
         } elseif (!empty($id)) {
275 275
             // Get specified logical unit.
276
-            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]');
276
+            $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]');
277 277
         } else {
278 278
             // Get all logical units at top level.
279 279
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         $cPid = max($cPid, 0);
462 462
         if ($cPid == 0 && ($this->cPid || $this->pid)) {
463 463
             // Retain current PID.
464
-            $cPid = $this->cPid ?: $this->pid;
464
+            $cPid = $this->cPid ? : $this->pid;
465 465
         }
466 466
         return $cPid;
467 467
     }
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
         if (isset($this->fileInfos[$id]) || isset($hasMetadataSection['dmdSec'])) {
529 529
             return $metadata;
530 530
         } else {
531
-            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"');
531
+            $this->logger->warning('No supported descriptive metadata found for logical structure with @ID "'.$id.'"');
532 532
             return [];
533 533
         }
534 534
     }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         if (!empty($this->logicalUnits[$id])) {
548 548
             return [$this->logicalUnits[$id]['type']];
549 549
         } else {
550
-            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]/@TYPE');
550
+            $struct = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]/@TYPE');
551 551
             if (!empty($struct)) {
552 552
                 return [(string) $struct[0]];
553 553
             }
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
             if ($resArray['format'] > 0 && !empty($resArray['xpath_sorting'])) {
675 675
                 $values = $domXPath->evaluate($resArray['xpath_sorting'], $domNode);
676 676
                 if ($values instanceof \DOMNodeList && $values->length > 0) {
677
-                    $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values->item(0)->nodeValue);
677
+                    $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values->item(0)->nodeValue);
678 678
                 } elseif (!($values instanceof \DOMNodeList)) {
679
-                    $metadata[$resArray['index_name'] . '_sorting'][0] = trim((string) $values);
679
+                    $metadata[$resArray['index_name'].'_sorting'][0] = trim((string) $values);
680 680
                 }
681 681
             }
682
-            if (empty($metadata[$resArray['index_name'] . '_sorting'][0])) {
683
-                $metadata[$resArray['index_name'] . '_sorting'][0] = $metadata[$resArray['index_name']][0];
682
+            if (empty($metadata[$resArray['index_name'].'_sorting'][0])) {
683
+                $metadata[$resArray['index_name'].'_sorting'][0] = $metadata[$resArray['index_name']][0];
684 684
             }
685 685
         }
686 686
     }
@@ -740,11 +740,11 @@  discard block
 block discarded – undo
740 740
                         return true;
741 741
                     }
742 742
                 } else {
743
-                    $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"');
743
+                    $this->logger->warning('Invalid class/method "'.$class.'->extractMetadata()" for metadata format "'.$this->mdSec[$dmdId]['type'].'"');
744 744
                 }
745 745
             }
746 746
         } else {
747
-            $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"');
747
+            $this->logger->notice('Unsupported metadata format "'.$this->mdSec[$dmdId]['type'].'" in '.$mdSectionType.' with @ID "'.$dmdId.'"');
748 748
         }
749 749
         return false;
750 750
     }
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
             $dmdIds = $this->logicalUnits[$id]['dmdId'] ?? '';
852 852
             $admIds = $this->logicalUnits[$id]['admId'] ?? '';
853 853
         } else {
854
-            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $id . '"]')[0];
854
+            $mdSec = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$id.'"]')[0];
855 855
             if ($mdSec) {
856 856
                 $dmdIds = (string) $mdSec->attributes()->DMDID;
857 857
                 $admIds = (string) $mdSec->attributes()->ADMID;
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 
882 882
         return array_filter(
883 883
             $allMdIds,
884
-            function ($element) {
884
+            function($element) {
885 885
                 return !empty($element);
886 886
             }
887 887
         );
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
      */
908 908
     public function getStructureDepth(string $logId)
909 909
     {
910
-        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
910
+        $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*');
911 911
         if (!empty($ancestors)) {
912 912
             return count($ancestors);
913 913
         } else {
@@ -931,9 +931,9 @@  discard block
 block discarded – undo
931 931
             $this->registerNamespaces($this->mets);
932 932
         } else {
933 933
             if (!empty($location)) {
934
-                $this->logger->error('No METS part found in document with location "' . $location . '".');
934
+                $this->logger->error('No METS part found in document with location "'.$location.'".');
935 935
             } elseif (!empty($this->recordId)) {
936
-                $this->logger->error('No METS part found in document with recordId "' . $this->recordId . '".');
936
+                $this->logger->error('No METS part found in document with recordId "'.$this->recordId.'".');
937 937
             } else {
938 938
                 $this->logger->error('No METS part found in current document.');
939 939
             }
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                 return true;
955 955
             }
956 956
         }
957
-        $this->logger->error('Could not load XML file from "' . $location . '"');
957
+        $this->logger->error('Could not load XML file from "'.$location.'"');
958 958
         return false;
959 959
     }
960 960
 
@@ -1077,10 +1077,10 @@  discard block
 block discarded – undo
1077 1077
 
1078 1078
         if (!empty($mdType) && !empty($this->formats[(string) $mdType[0]])) {
1079 1079
             $type = (string) $mdType[0];
1080
-            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
1080
+            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1081 1081
         } elseif (!empty($otherMdType) && !empty($this->formats[(string) $otherMdType[0]])) {
1082 1082
             $type = (string) $otherMdType[0];
1083
-            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="' . $type . '"]/mets:xmlData/' . strtolower($type) . ':' . $this->formats[$type]['rootElement']);
1083
+            $xml = $element->xpath('./mets:mdWrap[@MDTYPE="OTHER"][@OTHERMDTYPE="'.$type.'"]/mets:xmlData/'.strtolower($type).':'.$this->formats[$type]['rootElement']);
1084 1084
         }
1085 1085
 
1086 1086
         if (empty($xml)) {
@@ -1273,9 +1273,9 @@  discard block
 block discarded – undo
1273 1273
             || $forceReload
1274 1274
         ) {
1275 1275
             // Retain current PID.
1276
-            $cPid = $this->cPid ?: $this->pid;
1276
+            $cPid = $this->cPid ? : $this->pid;
1277 1277
             if (!$cPid) {
1278
-                $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
1278
+                $this->logger->error('Invalid PID '.$cPid.' for structure definitions');
1279 1279
                 $this->thumbnailLoaded = true;
1280 1280
                 return $this->thumbnail;
1281 1281
             }
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                 if (!empty($resArray['thumbnail'])) {
1313 1313
                     $strctType = Helper::getIndexNameFromUid($resArray['thumbnail'], 'tx_dlf_structures', $cPid);
1314 1314
                     // Check if this document has a structure element of the desired type.
1315
-                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="' . $strctType . '"]/@ID');
1315
+                    $strctIds = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@TYPE="'.$strctType.'"]/@ID');
1316 1316
                     if (!empty($strctIds)) {
1317 1317
                         $strctId = (string) $strctIds[0];
1318 1318
                     }
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
                     }
1336 1336
                 }
1337 1337
             } else {
1338
-                $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
1338
+                $this->logger->error('No structure of type "'.$metadata['type'][0].'" found in database');
1339 1339
             }
1340 1340
             $this->thumbnailLoaded = true;
1341 1341
         }
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
     {
1382 1382
         if (empty($this->parentHref)) {
1383 1383
             // Get the closest ancestor of the current document which has a MPTR child.
1384
-            $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $this->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1384
+            $parentMptr = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$this->toplevelId.'"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
1385 1385
             if (!empty($parentMptr)) {
1386 1386
                 $this->parentHref = (string) $parentMptr[0]->attributes('http://www.w3.org/1999/xlink')->href;
1387 1387
             }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
  * @property-read \SimpleXMLElement $mets this holds the XML file's METS part as \SimpleXMLElement object
64 64
  * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available
65 65
  */
66
-final class MetsDocument extends AbstractDocument
67
-{
66
+final class MetsDocument extends AbstractDocument {
68 67
     /**
69 68
      * @access protected
70 69
      * @var string[] Subsections / tags that may occur within `<mets:amdSec>`
@@ -397,8 +396,7 @@  discard block
 block discarded – undo
397 396
      *
398 397
      * @return ?string thumbnail or null if not found
399 398
      */
400
-    private function getThumbnail(string $id = '')
401
-    {
399
+    private function getThumbnail(string $id = '') {
402 400
         // Load plugin configuration.
403 401
         $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files');
404 402
         $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']);
@@ -726,8 +724,7 @@  discard block
 block discarded – undo
726 724
      *
727 725
      * @return bool true if extraction successful, false otherwise
728 726
      */
729
-    private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata)
730
-    {
727
+    private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) {
731 728
         // Is this metadata format supported?
732 729
         if (!empty($this->formats[$this->mdSec[$dmdId]['type']])) {
733 730
             if (!empty($this->formats[$this->mdSec[$dmdId]['type']]['class'])) {
@@ -759,8 +756,7 @@  discard block
 block discarded – undo
759 756
      *
760 757
      * @return array additional metadata data queried from database
761 758
      */
762
-    private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId)
763
-    {
759
+    private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) {
764 760
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
765 761
             ->getQueryBuilderForTable('tx_dlf_metadata');
766 762
         // Get hidden records, too.
@@ -905,8 +901,7 @@  discard block
 block discarded – undo
905 901
     /**
906 902
      * @see AbstractDocument::getStructureDepth()
907 903
      */
908
-    public function getStructureDepth(string $logId)
909
-    {
904
+    public function getStructureDepth(string $logId) {
910 905
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
911 906
         if (!empty($ancestors)) {
912 907
             return count($ancestors);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @see MetsDocument::$mdSec
102 102
      */
103
-    protected bool $mdSecLoaded = false;
103
+    protected bool $mdSecLoaded = FALSE;
104 104
 
105 105
     /**
106 106
      * @access protected
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @see $fileGrps
124 124
      */
125
-    protected bool $fileGrpsLoaded = false;
125
+    protected bool $fileGrpsLoaded = FALSE;
126 126
 
127 127
     /**
128 128
      * @access protected
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 return $service->getImageUrl();
199 199
             }
200 200
         } elseif ($file['mimeType'] === 'application/vnd.netfpx') {
201
-            $baseURL = $file['location'] . (strpos($file['location'], '?') === false ? '?' : '');
201
+            $baseURL = $file['location'] . (strpos($file['location'], '?') === FALSE ? '?' : '');
202 202
             // TODO CVT is an optional IIP server capability; in theory, capabilities should be determined in the object request with '&obj=IIP-server'
203 203
             return $baseURL . '&CVT=jpeg';
204 204
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $this->fileInfos[$id]['mimeType'] = $this->getFileMimeType($id);
222 222
         }
223 223
 
224
-        return $this->fileInfos[$id] ?? null;
224
+        return $this->fileInfos[$id] ?? NULL;
225 225
     }
226 226
 
227 227
     /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     /**
262 262
      * @see AbstractDocument::getLogicalStructure()
263 263
      */
264
-    public function getLogicalStructure(string $id, bool $recursive = false): array
264
+    public function getLogicalStructure(string $id, bool $recursive = FALSE): array
265 265
     {
266 266
         $details = [];
267 267
         // Is the requested logical unit already loaded?
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      *
303 303
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
304 304
      */
305
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, bool $recursive = false): array
305
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, bool $recursive = FALSE): array
306 306
     {
307 307
         $attributes = $structure->attributes();
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             'pagination' => '',
321 321
             'type' => isset($attributes['TYPE']) ? (string) $attributes['TYPE'] : '',
322 322
             'description' => '',
323
-            'thumbnailId' => null,
323
+            'thumbnailId' => NULL,
324 324
             'files' => [],
325 325
         ];
326 326
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             && array_key_exists($details['id'], $this->smLinks['l2p'])
352 352
         ) {
353 353
             // Link logical structure to the first corresponding physical page/track.
354
-            $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, true), 1);
354
+            $details['points'] = max((int) array_search($this->smLinks['l2p'][$details['id']][0], $this->physicalStructure, TRUE), 1);
355 355
             $details['thumbnailId'] = $this->getThumbnail();
356 356
             // Get page/track number of the first page/track related to this structure element.
357 357
             $details['pagination'] = $this->physicalStructureInfo[$this->smLinks['l2p'][$details['id']][0]]['orderlabel'];
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             $details['points'] = 1;
361 361
             $details['thumbnailId'] = $this->getThumbnail();
362 362
         }
363
-        if ($details['thumbnailId'] === null) {
363
+        if ($details['thumbnailId'] === NULL) {
364 364
             unset($details['thumbnailId']);
365 365
         }
366 366
         // Get the files this structure element is pointing at.
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             $details['children'] = [];
383 383
             foreach ($structure->children('http://www.loc.gov/METS/')->div as $child) {
384 384
                 // Repeat for all children.
385
-                $details['children'][] = $this->getLogicalStructureInfo($child, true);
385
+                $details['children'][] = $this->getLogicalStructureInfo($child, TRUE);
386 386
             }
387 387
         }
388 388
         return $details;
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
         $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files');
404 404
         $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']);
405 405
 
406
-        $thumbnail = null;
406
+        $thumbnail = NULL;
407 407
 
408 408
         while ($fileGrpThumb = array_shift($fileGrpsThumb)) {
409 409
             if (empty($id)) {
410
-                $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? null;
410
+                $thumbnail = $this->physicalStructureInfo[$this->physicalStructure[1]]['files'][$fileGrpThumb] ?? NULL;
411 411
             } else {
412
-                $parentId = $this->smLinks['l2p'][$id][0] ?? null;
413
-                $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? null;
412
+                $parentId = $this->smLinks['l2p'][$id][0] ?? NULL;
413
+                $thumbnail = $this->physicalStructureInfo[$parentId]['files'][$fileGrpThumb] ?? NULL;
414 414
             }
415 415
 
416 416
             if (!empty($thumbnail)) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                 continue;
522 522
             }
523 523
 
524
-            $hasMetadataSection[$mdSectionType] = true;
524
+            $hasMetadataSection[$mdSectionType] = TRUE;
525 525
         }
526 526
 
527 527
         // Files are not expected to reference a dmdSec
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
     private function extractAndProcessMetadata(string $dmdId, string $mdSectionType, array &$metadata, int $cPid, array $hasMetadataSection): bool
572 572
     {
573 573
         if ($mdSectionType === 'dmdSec' && isset($hasMetadataSection['dmdSec'])) {
574
-            return true;
574
+            return TRUE;
575 575
         }
576 576
 
577 577
         $metadataExtracted = $this->extractMetadataIfTypeSupported($dmdId, $mdSectionType, $metadata);
578 578
 
579 579
         if (!$metadataExtracted) {
580
-            return false;
580
+            return FALSE;
581 581
         }
582 582
 
583 583
         $additionalMetadata = $this->getAdditionalMetadataFromDatabase($cPid, $dmdId);
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
         $this->processAdditionalMetadata($additionalMetadata, $domXPath, $domNode, $metadata);
590 590
 
591
-        return true;
591
+        return TRUE;
592 592
     }
593 593
 
594 594
     /**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                     $obj = GeneralUtility::makeInstance($class);
738 738
                     if ($obj instanceof MetadataInterface) {
739 739
                         $obj->extractMetadata($this->mdSec[$dmdId]['xml'], $metadata, GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'general')['useExternalApisForMetadata']);
740
-                        return true;
740
+                        return TRUE;
741 741
                     }
742 742
                 } else {
743 743
                     $this->logger->warning('Invalid class/method "' . $class . '->extractMetadata()" for metadata format "' . $this->mdSec[$dmdId]['type'] . '"');
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
         } else {
747 747
             $this->logger->notice('Unsupported metadata format "' . $this->mdSec[$dmdId]['type'] . '" in ' . $mdSectionType . ' with @ID "' . $dmdId . '"');
748 748
         }
749
-        return false;
749
+        return FALSE;
750 750
     }
751 751
 
752 752
     /**
@@ -946,16 +946,16 @@  discard block
 block discarded – undo
946 946
     protected function loadLocation(string $location): bool
947 947
     {
948 948
         $fileResource = Helper::getUrl($location);
949
-        if ($fileResource !== false) {
949
+        if ($fileResource !== FALSE) {
950 950
             $xml = Helper::getXmlFileAsString($fileResource);
951 951
             // Set some basic properties.
952
-            if ($xml !== false) {
952
+            if ($xml !== FALSE) {
953 953
                 $this->xml = $xml;
954
-                return true;
954
+                return TRUE;
955 955
             }
956 956
         }
957 957
         $this->logger->error('Could not load XML file from "' . $location . '"');
958
-        return false;
958
+        return FALSE;
959 959
     }
960 960
 
961 961
     /**
@@ -977,9 +977,9 @@  discard block
 block discarded – undo
977 977
 
978 978
         if ($preloadedDocument instanceof \SimpleXMLElement) {
979 979
             $this->xml = $preloadedDocument;
980
-            return true;
980
+            return TRUE;
981 981
         }
982
-        return false;
982
+        return FALSE;
983 983
     }
984 984
 
985 985
     /**
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
             foreach ($this->mets->xpath('./mets:dmdSec') as $dmdSecTag) {
1006 1006
                 $dmdSec = $this->processMdSec($dmdSecTag);
1007 1007
 
1008
-                if ($dmdSec !== null) {
1008
+                if ($dmdSec !== NULL) {
1009 1009
                     $this->mdSec[$dmdSec['id']] = $dmdSec;
1010 1010
                     $this->dmdSec[$dmdSec['id']] = $dmdSec;
1011 1011
                 }
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
                     // TODO: Should we check that the format may occur within this type (e.g., to ignore VIDEOMD within rightsMD)?
1023 1023
                     $mdSec = $this->processMdSec($mdSecTag);
1024 1024
 
1025
-                    if ($mdSec !== null) {
1025
+                    if ($mdSec !== NULL) {
1026 1026
                         $this->mdSec[$mdSec['id']] = $mdSec;
1027 1027
 
1028 1028
                         $childIds[] = $mdSec['id'];
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                 }
1036 1036
             }
1037 1037
 
1038
-            $this->mdSecLoaded = true;
1038
+            $this->mdSecLoaded = TRUE;
1039 1039
         }
1040 1040
         return $this->mdSec;
1041 1041
     }
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
     {
1067 1067
         $mdId = (string) $element->attributes()->ID;
1068 1068
         if (empty($mdId)) {
1069
-            return null;
1069
+            return NULL;
1070 1070
         }
1071 1071
 
1072 1072
         $this->registerNamespaces($element);
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
         }
1085 1085
 
1086 1086
         if (empty($xml)) {
1087
-            return null;
1087
+            return NULL;
1088 1088
         }
1089 1089
 
1090 1090
         $this->registerNamespaces($xml[0]);
@@ -1145,9 +1145,9 @@  discard block
 block discarded – undo
1145 1145
                 !empty($extConf['fileGrpFulltext'])
1146 1146
                 && array_intersect(GeneralUtility::trimExplode(',', $extConf['fileGrpFulltext']), $this->fileGrps) !== []
1147 1147
             ) {
1148
-                $this->hasFulltext = true;
1148
+                $this->hasFulltext = TRUE;
1149 1149
             }
1150
-            $this->fileGrpsLoaded = true;
1150
+            $this->fileGrpsLoaded = TRUE;
1151 1151
         }
1152 1152
         return $this->fileGrps;
1153 1153
     }
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
                 array_unshift($elements, $id);
1241 1241
                 $this->physicalStructure = $elements;
1242 1242
             }
1243
-            $this->physicalStructureLoaded = true;
1243
+            $this->physicalStructureLoaded = TRUE;
1244 1244
         }
1245 1245
         return $this->physicalStructure;
1246 1246
     }
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
                     $this->smLinks['p2l'][(string) $smLink->attributes('http://www.w3.org/1999/xlink')->to][] = (string) $smLink->attributes('http://www.w3.org/1999/xlink')->from;
1259 1259
                 }
1260 1260
             }
1261
-            $this->smLinksLoaded = true;
1261
+            $this->smLinksLoaded = TRUE;
1262 1262
         }
1263 1263
         return $this->smLinks;
1264 1264
     }
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
     /**
1267 1267
      * @see AbstractDocument::magicGetThumbnail()
1268 1268
      */
1269
-    protected function magicGetThumbnail(bool $forceReload = false): string
1269
+    protected function magicGetThumbnail(bool $forceReload = FALSE): string
1270 1270
     {
1271 1271
         if (
1272 1272
             !$this->thumbnailLoaded
@@ -1276,14 +1276,14 @@  discard block
 block discarded – undo
1276 1276
             $cPid = $this->cPid ?: $this->pid;
1277 1277
             if (!$cPid) {
1278 1278
                 $this->logger->error('Invalid PID ' . $cPid . ' for structure definitions');
1279
-                $this->thumbnailLoaded = true;
1279
+                $this->thumbnailLoaded = TRUE;
1280 1280
                 return $this->thumbnail;
1281 1281
             }
1282 1282
             // Load extension configuration.
1283 1283
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files');
1284 1284
             if (empty($extConf['fileGrpThumbs'])) {
1285 1285
                 $this->logger->warning('No fileGrp for thumbnails specified');
1286
-                $this->thumbnailLoaded = true;
1286
+                $this->thumbnailLoaded = TRUE;
1287 1287
                 return $this->thumbnail;
1288 1288
             }
1289 1289
             $strctId = $this->magicGetToplevelId();
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
             } else {
1338 1338
                 $this->logger->error('No structure of type "' . $metadata['type'][0] . '" found in database');
1339 1339
             }
1340
-            $this->thumbnailLoaded = true;
1340
+            $this->thumbnailLoaded = TRUE;
1341 1341
         }
1342 1342
         return $this->thumbnail;
1343 1343
     }
@@ -1415,8 +1415,8 @@  discard block
 block discarded – undo
1415 1415
     public function __toString(): string
1416 1416
     {
1417 1417
         $xml = new \DOMDocument('1.0', 'utf-8');
1418
-        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1419
-        $xml->formatOutput = true;
1418
+        $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), TRUE));
1419
+        $xml->formatOutput = TRUE;
1420 1420
         return $xml->saveXML();
1421 1421
     }
1422 1422
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
     public function __wakeup(): void
1432 1432
     {
1433 1433
         $xml = Helper::getXmlFileAsString($this->asXML);
1434
-        if ($xml !== false) {
1434
+        if ($xml !== FALSE) {
1435 1435
             $this->asXML = '';
1436 1436
             $this->xml = $xml;
1437 1437
             // Rebuild the unserializable properties.
Please login to merge, or discard this patch.
Classes/Eid/PageViewProxy.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  *
35 35
  * @access public
36 36
  */
37
-class PageViewProxy
38
-{
37
+class PageViewProxy {
39 38
     /**
40 39
      * @access protected
41 40
      * @var RequestFactory
@@ -55,8 +54,7 @@  discard block
 block discarded – undo
55 54
      *
56 55
      * @return void
57 56
      */
58
-    public function __construct()
59
-    {
57
+    public function __construct() {
60 58
         $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class);
61 59
         $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf', 'general');
62 60
     }
Please login to merge, or discard this patch.
ext_localconf.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,20 +66,20 @@
 block discarded – undo
66 66
 $_EXTKEY = 'dlf';
67 67
 // Register tools for toolbox plugin.
68 68
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] = [];
69
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltexttool';
70
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.annotationtool';
71
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltextdownloadtool';
72
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagedownloadtool';
73
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagemanipulationtool';
74
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.pdfdownloadtool';
75
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY) . '_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.searchindocumenttool';
69
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltexttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltexttool';
70
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_annotationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.annotationtool';
71
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_fulltextdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.fulltextdownloadtool';
72
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagedownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagedownloadtool';
73
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_imagemanipulationtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.imagemanipulationtool';
74
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_pdfdownloadtool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.pdfdownloadtool';
75
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'][\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getCN($_EXTKEY).'_searchindocumenttool'] = 'LLL:EXT:dlf/Resources/Private/Language/locallang_labels.xlf:tx_dlf_toolbox.searchindocumenttool';
76 76
 // Register hooks.
77 77
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class;
78 78
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class;
79 79
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class;
80 80
 // Register AJAX eID handlers.
81 81
 if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? false) {
82
-    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class . '::main';
82
+    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class.'::main';
83 83
 }
84 84
 // Use Caching Framework for Solr queries
85 85
 if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr']) || !is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_dlf_solr'])) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = \Kitodo\Dlf\Hooks\DataHandler::class;
79 79
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Common/MetsDocument.php']['hookClass'][] = \Kitodo\Dlf\Hooks\KitodoProductionHacks::class;
80 80
 // Register AJAX eID handlers.
81
-if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? false) {
81
+if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['dlf']['general']['enableInternalProxy'] ?? FALSE) {
82 82
     $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_pageview_proxy'] = \Kitodo\Dlf\Eid\PageViewProxy::class . '::main';
83 83
 }
84 84
 // Use Caching Framework for Solr queries
Please login to merge, or discard this patch.
Tests/Functional/Common/MetsDocumentTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
     {
22 22
         parent::setUp();
23 23
 
24
-        $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv');
25
-        $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv');
26
-        $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv');
24
+        $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_1.csv');
25
+        $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/metadata.csv');
26
+        $this->importCSVDataSet(__DIR__.'/../../Fixtures/MetsDocument/metadata_mets.csv');
27 27
     }
28 28
 
29 29
     protected function doc(string $file)
30 30
     {
31
-        $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file;
31
+        $url = 'http://web:8001/Tests/Fixtures/MetsDocument/'.$file;
32 32
         $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]);
33 33
         self::assertNotNull($doc);
34 34
         return $doc;
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
 use Kitodo\Dlf\Common\AbstractDocument;
16 16
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
17 17
 
18
-class MetsDocumentTest extends FunctionalTestCase
19
-{
18
+class MetsDocumentTest extends FunctionalTestCase {
20 19
     public function setUp(): void
21 20
     {
22 21
         parent::setUp();
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
         $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv');
27 26
     }
28 27
 
29
-    protected function doc(string $file)
30
-    {
28
+    protected function doc(string $file) {
31 29
         $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file;
32 30
         $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]);
33 31
         self::assertNotNull($doc);
@@ -37,8 +35,7 @@  discard block
 block discarded – undo
37 35
     /**
38 36
      * @test
39 37
      */
40
-    public function canParseDmdAndAmdSec()
41
-    {
38
+    public function canParseDmdAndAmdSec() {
42 39
         $doc = $this->doc('av_beispiel.xml');
43 40
 
44 41
         $toplevelMetadata = $doc->getToplevelMetadata(20000);
@@ -56,8 +53,7 @@  discard block
 block discarded – undo
56 53
     /**
57 54
      * @test
58 55
      */
59
-    public function canReadFileMetadata()
60
-    {
56
+    public function canReadFileMetadata() {
61 57
         $doc = $this->doc('av_beispiel.xml');
62 58
 
63 59
         $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000);
@@ -72,8 +68,7 @@  discard block
 block discarded – undo
72 68
     /**
73 69
      * @test
74 70
      */
75
-    public function canGetLogicalStructure()
76
-    {
71
+    public function canGetLogicalStructure() {
77 72
         $doc = $this->doc('av_beispiel.xml');
78 73
 
79 74
         $toc = $doc->tableOfContents[0] ?? [];
@@ -109,8 +104,7 @@  discard block
 block discarded – undo
109 104
     /**
110 105
      * @test
111 106
      */
112
-    public function doesNotOverwriteFirstDmdSec()
113
-    {
107
+    public function doesNotOverwriteFirstDmdSec() {
114 108
         $doc = $this->doc('two_dmdsec.xml');
115 109
 
116 110
         $toplevelMetadata = $doc->getToplevelMetadata(20000);
@@ -123,8 +117,7 @@  discard block
 block discarded – undo
123 117
     /**
124 118
      * @test
125 119
      */
126
-    public function returnsEmptyMetadataWhenNoDmdSec()
127
-    {
120
+    public function returnsEmptyMetadataWhenNoDmdSec() {
128 121
         $doc = $this->doc('two_dmdsec.xml');
129 122
 
130 123
         // DMD and AMD works
@@ -143,8 +136,7 @@  discard block
 block discarded – undo
143 136
     /**
144 137
      * @test
145 138
      */
146
-    public function canGetDownloadLocation()
147
-    {
139
+    public function canGetDownloadLocation() {
148 140
         $doc = $this->doc('two_dmdsec.xml');
149 141
 
150 142
         $correct = $doc->getDownloadLocation('FILE_0000_DOWNLOAD');
@@ -162,8 +154,7 @@  discard block
 block discarded – undo
162 154
     /**
163 155
      * @test
164 156
      */
165
-    public function canGetFileLocation()
166
-    {
157
+    public function canGetFileLocation() {
167 158
         $doc = $this->doc('two_dmdsec.xml');
168 159
 
169 160
         $correct = $doc->getFileLocation('FILE_0000_DEFAULT');
@@ -176,8 +167,7 @@  discard block
 block discarded – undo
176 167
     /**
177 168
      * @test
178 169
      */
179
-    public function canGetFileMimeType()
180
-    {
170
+    public function canGetFileMimeType() {
181 171
         $doc = $this->doc('two_dmdsec.xml');
182 172
 
183 173
         $correct = $doc->getFileMimeType('FILE_0000_DEFAULT');
@@ -191,8 +181,7 @@  discard block
 block discarded – undo
191 181
     /**
192 182
      * @test
193 183
      */
194
-    public function canGetPhysicalPage()
195
-    {
184
+    public function canGetPhysicalPage() {
196 185
         $doc = $this->doc('mets_with_pages.xml');
197 186
 
198 187
         // pass orderlabel and retrieve order
@@ -203,8 +192,7 @@  discard block
 block discarded – undo
203 192
     /**
204 193
      * @test
205 194
      */
206
-    public function canGetTitle()
207
-    {
195
+    public function canGetTitle() {
208 196
         $doc = $this->doc('mets_with_pages.xml');
209 197
 
210 198
         $correct = $doc->getTitle(1001);
@@ -217,8 +205,7 @@  discard block
 block discarded – undo
217 205
     /**
218 206
      * @test
219 207
      */
220
-    public function canGetFullText()
221
-    {
208
+    public function canGetFullText() {
222 209
         $doc = $this->doc('mets_with_pages.xml');
223 210
 
224 211
         $fulltext = $doc->getFullText('PHYS_0003');
@@ -234,8 +221,7 @@  discard block
 block discarded – undo
234 221
     /**
235 222
      * @test
236 223
      */
237
-    public function canGetStructureDepth()
238
-    {
224
+    public function canGetStructureDepth() {
239 225
         $doc = $this->doc('mets_with_pages.xml');
240 226
 
241 227
         $correct = $doc->getStructureDepth('LOG_0001');
Please login to merge, or discard this patch.
Classes/Validation/DocumentValidator.php 4 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
  */
30 30
 class DocumentValidator
31 31
 {
32
-     /**
33
-     * @access protected
34
-     * @var Logger This holds the logger
35
-     */
32
+        /**
33
+         * @access protected
34
+         * @var Logger This holds the logger
35
+         */
36 36
     protected Logger $logger;
37 37
 
38 38
     /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         foreach ($this->requiredMetadataFields as $requiredMetadataField) {
84 84
             if (empty($this->metadata[$requiredMetadataField][0])) {
85
-                $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".');
85
+                $this->logger->error('Missing required metadata field "'.$requiredMetadataField.'".');
86 86
                 return false;
87 87
             }
88 88
         }
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function hasCorrectLogicalStructure(string $type): bool
102 102
     {
103
-        $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]');
103
+        $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="'.$type.'"]');
104 104
         if ($expectedNodes) {
105 105
             return true;
106 106
         }
107 107
 
108 108
         $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
109 109
         if ($existingNodes) {
110
-            $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.');
110
+            $this->logger->error('Document contains logical structure but @TYPE="'.$type.'" is missing.');
111 111
             return false;
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @access public
29 29
  */
30
-class DocumentValidator
31
-{
30
+class DocumentValidator {
32 31
      /**
33 32
      * @access protected
34 33
      * @var Logger This holds the logger
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      *
64 63
      * @return void
65 64
      */
66
-    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null)
67
-    {
65
+    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) {
68 66
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 67
         $this->metadata = $metadata;
70 68
         $this->requiredMetadataFields = $requiredMetadataFields;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return void
65 65
      */
66
-    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null)
66
+    public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = NULL)
67 67
     {
68 68
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 69
         $this->metadata = $metadata;
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
         foreach ($this->requiredMetadataFields as $requiredMetadataField) {
84 84
             if (empty($this->metadata[$requiredMetadataField][0])) {
85 85
                 $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".');
86
-                return false;
86
+                return FALSE;
87 87
             }
88 88
         }
89
-        return true;
89
+        return TRUE;
90 90
     }
91 91
 
92 92
     /**
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]');
104 104
         if ($expectedNodes) {
105
-            return true;
105
+            return TRUE;
106 106
         }
107 107
 
108 108
         $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div');
109 109
         if ($existingNodes) {
110 110
             $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.');
111
-            return false;
111
+            return FALSE;
112 112
         }
113 113
 
114 114
         $this->logger->error('Document does not contain logical structure.');
115
-        return false;
115
+        return FALSE;
116 116
     }
117 117
 
118 118
     /**
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $physSequenceNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]');
128 128
         if ($physSequenceNodes) {
129
-            return true;
129
+            return TRUE;
130 130
         }
131 131
 
132 132
         $physicalStructureNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div');
133 133
         if ($physicalStructureNodes) {
134 134
             $this->logger->error('Document contains physical structure but @TYPE="physSequence" is missing.');
135
-            return false;
135
+            return FALSE;
136 136
         }
137 137
 
138 138
         $this->logger->error('Document does not contain physical structure.');
139
-        return false;
139
+        return FALSE;
140 140
     }
141 141
 }
Please login to merge, or discard this patch.
Tests/Unit/Validation/DocumentValidatorTest.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
 
106 106
     private function getXml(string $file): SimpleXMLElement
107 107
     {
108
-        $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/MetsDocument/' . $file);
108
+        $xml = simplexml_load_file(__DIR__.'/../../Fixtures/MetsDocument/'.$file);
109 109
         self::assertNotFalse($xml);
110 110
         return $xml;
111 111
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
 use SimpleXMLElement;
16 16
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
17 17
 
18
-class DocumentValidatorTest extends UnitTestCase
19
-{
18
+class DocumentValidatorTest extends UnitTestCase {
20 19
     public function setUp(): void
21 20
     {
22 21
         parent::setUp();
@@ -27,8 +26,7 @@  discard block
 block discarded – undo
27 26
     /**
28 27
      * @test
29 28
      */
30
-    public function passesHasAllMandatoryMetadataFields()
31
-    {
29
+    public function passesHasAllMandatoryMetadataFields() {
32 30
         $metadata = [
33 31
             'record_id' => [
34 32
                 'xyz'
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
     /**
42 40
      * @test
43 41
      */
44
-    public function notPassesHasAllMandatoryMetadataFields()
45
-    {
42
+    public function notPassesHasAllMandatoryMetadataFields() {
46 43
         $metadata = [
47 44
             'document_format' => [
48 45
                 'METS'
@@ -55,8 +52,7 @@  discard block
 block discarded – undo
55 52
     /**
56 53
      * @test
57 54
      */
58
-    public function passesHasCorrectLogicalStructure()
59
-    {
55
+    public function passesHasCorrectLogicalStructure() {
60 56
         $xml = $this->getXml('av_beispiel.xml');
61 57
 
62 58
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -66,8 +62,7 @@  discard block
 block discarded – undo
66 62
     /**
67 63
      * @test
68 64
      */
69
-    public function notPassesHasCorrectLogicalStructure()
70
-    {
65
+    public function notPassesHasCorrectLogicalStructure() {
71 66
         $xml = $this->getXml('av_beispiel.xml');
72 67
 
73 68
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -77,8 +72,7 @@  discard block
 block discarded – undo
77 72
     /**
78 73
      * @test
79 74
      */
80
-    public function passesHasCorrectPhysicalStructure()
81
-    {
75
+    public function passesHasCorrectPhysicalStructure() {
82 76
         $xml = $this->getXml('av_beispiel.xml');
83 77
 
84 78
         $documentValidator = new DocumentValidator([], [], $xml);
@@ -88,8 +82,7 @@  discard block
 block discarded – undo
88 82
     /**
89 83
      * @test
90 84
      */
91
-    public function notPassesHasCorrectPhysicalStructure()
92
-    {
85
+    public function notPassesHasCorrectPhysicalStructure() {
93 86
         $xml = $this->getXml('two_dmdsec.xml');
94 87
 
95 88
         $documentValidator = new DocumentValidator([], [], $xml);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     {
22 22
         parent::setUp();
23 23
 
24
-        $this->resetSingletonInstances = true;
24
+        $this->resetSingletonInstances = TRUE;
25 25
     }
26 26
 
27 27
     /**
Please login to merge, or discard this patch.