Passed
Pull Request — master (#104)
by
unknown
05:27 queued 14s
created
Classes/Common/IiifManifest.php 1 patch
Braces   +27 added lines, -54 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * @property-read string $thumbnail This holds the document's thumbnail location
56 56
  * @property-read string $toplevelId This holds the toplevel manifest's @id
57 57
  */
58
-final class IiifManifest extends Doc
59
-{
58
+final class IiifManifest extends Doc {
60 59
     /**
61 60
      * This holds the manifest file as string for serialization purposes
62 61
      * @see __sleep() / __wakeup()
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
      * {@inheritDoc}
118 117
      * @see Doc::establishRecordId()
119 118
      */
120
-    protected function establishRecordId($pid)
121
-    {
119
+    protected function establishRecordId($pid) {
122 120
         if ($this->iiif !== null) {
123 121
             /*
124 122
              *  FIXME This will not consistently work because we can not be sure to have the pid at hand. It may miss
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
      * {@inheritDoc}
170 168
      * @see Doc::getDocument()
171 169
      */
172
-    protected function getDocument()
173
-    {
170
+    protected function getDocument() {
174 171
         return $this->iiif;
175 172
     }
176 173
 
@@ -183,8 +180,7 @@  discard block
 block discarded – undo
183 180
      * @return string 'IIIF1' if the resource is a Metadata API 1 resource, 'IIIF2' / 'IIIF3' if
184 181
      * the resource is a Presentation API 2 / 3 resource
185 182
      */
186
-    public function getIiifVersion()
187
-    {
183
+    public function getIiifVersion() {
188 184
         if (!isset($this->iiifVersion)) {
189 185
             if ($this->iiif instanceof AbstractIiifResource1) {
190 186
                 $this->iiifVersion = 'IIIF1';
@@ -225,8 +221,7 @@  discard block
 block discarded – undo
225 221
      *
226 222
      * @return array|string
227 223
      */
228
-    protected function getUseGroups($use)
229
-    {
224
+    protected function getUseGroups($use) {
230 225
         if (!$this->useGrpsLoaded) {
231 226
             // Get configured USE attributes.
232 227
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -254,8 +249,7 @@  discard block
 block discarded – undo
254 249
      * {@inheritDoc}
255 250
      * @see Doc::_getPhysicalStructure()
256 251
      */
257
-    protected function _getPhysicalStructure()
258
-    {
252
+    protected function _getPhysicalStructure() {
259 253
         // Is there no physical structure array yet?
260 254
         if (!$this->physicalStructureLoaded) {
261 255
             if ($this->iiif == null || !($this->iiif instanceof ManifestInterface)) {
@@ -368,8 +362,7 @@  discard block
 block discarded – undo
368 362
      * {@inheritDoc}
369 363
      * @see Doc::getDownloadLocation()
370 364
      */
371
-    public function getDownloadLocation($id)
372
-    {
365
+    public function getDownloadLocation($id) {
373 366
         $fileLocation = $this->getFileLocation($id);
374 367
         $resource = $this->iiif->getContainedResourceById($fileLocation);
375 368
         if ($resource instanceof AbstractImageService) {
@@ -382,8 +375,7 @@  discard block
 block discarded – undo
382 375
      * {@inheritDoc}
383 376
      * @see Doc::getFileLocation()
384 377
      */
385
-    public function getFileLocation($id)
386
-    {
378
+    public function getFileLocation($id) {
387 379
         if ($id == null) {
388 380
             return null;
389 381
         }
@@ -407,8 +399,7 @@  discard block
 block discarded – undo
407 399
      * {@inheritDoc}
408 400
      * @see Doc::getFileMimeType()
409 401
      */
410
-    public function getFileMimeType($id)
411
-    {
402
+    public function getFileMimeType($id) {
412 403
         $fileResource = $this->iiif->getContainedResourceById($id);
413 404
         if ($fileResource instanceof CanvasInterface) {
414 405
             $format = "application/vnd.kitodo.iiif";
@@ -433,8 +424,7 @@  discard block
 block discarded – undo
433 424
      * {@inheritDoc}
434 425
      * @see Doc::getLogicalStructure()
435 426
      */
436
-    public function getLogicalStructure($id, $recursive = false)
437
-    {
427
+    public function getLogicalStructure($id, $recursive = false) {
438 428
         $details = [];
439 429
         if (!$recursive && !empty($this->logicalUnits[$id])) {
440 430
             return $this->logicalUnits[$id];
@@ -469,8 +459,7 @@  discard block
 block discarded – undo
469 459
      * @param array $processedStructures: IIIF resources that already have been processed
470 460
      * @return array Logical structure array
471 461
      */
472
-    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = [])
473
-    {
462
+    protected function getLogicalStructureInfo(IiifResourceInterface $resource, $recursive = false, &$processedStructures = []) {
474 463
         $details = [];
475 464
         $details['id'] = $resource->getId();
476 465
         $details['dmdId'] = '';
@@ -562,8 +551,7 @@  discard block
 block discarded – undo
562 551
      *
563 552
      * @todo This method is still in experimental; the method signature may change.
564 553
      */
565
-    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true)
566
-    {
554
+    public function getManifestMetadata($id, $cPid = 0, $withDescription = true, $withRights = true, $withRelated = true) {
567 555
         if (!empty($this->originalMetadataArray[$id])) {
568 556
             return $this->originalMetadataArray[$id];
569 557
         }
@@ -605,8 +593,7 @@  discard block
 block discarded – undo
605 593
      * {@inheritDoc}
606 594
      * @see Doc::getMetadata()
607 595
      */
608
-    public function getMetadata($id, $cPid = 0)
609
-    {
596
+    public function getMetadata($id, $cPid = 0) {
610 597
         if (!empty($this->metadataArray[$id]) && $this->metadataArray[0] == $cPid) {
611 598
             return $this->metadataArray[$id];
612 599
         }
@@ -713,8 +700,7 @@  discard block
 block discarded – undo
713 700
      * {@inheritDoc}
714 701
      * @see Doc::_getSmLinks()
715 702
      */
716
-    protected function _getSmLinks()
717
-    {
703
+    protected function _getSmLinks() {
718 704
         if (!$this->smLinksLoaded && isset($this->iiif) && $this->iiif instanceof ManifestInterface) {
719 705
             if (!empty($this->iiif->getDefaultCanvases())) {
720 706
                 foreach ($this->iiif->getDefaultCanvases() as $canvas) {
@@ -738,8 +724,7 @@  discard block
 block discarded – undo
738 724
      *
739 725
      * @param RangeInterface $range: Current range whose canvases shall be linked
740 726
      */
741
-    private function smLinkRangeCanvasesRecursively(RangeInterface $range)
742
-    {
727
+    private function smLinkRangeCanvasesRecursively(RangeInterface $range) {
743 728
         // map range's canvases including all child ranges' canvases
744 729
         if (!$range->isTopRange()) {
745 730
             foreach ($range->getAllCanvasesRecursively() as $canvas) {
@@ -762,8 +747,7 @@  discard block
 block discarded – undo
762 747
      * @param CanvasInterface $canvas
763 748
      * @param IiifResourceInterface $resource
764 749
      */
765
-    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource)
766
-    {
750
+    private function smLinkCanvasToResource(CanvasInterface $canvas, IiifResourceInterface $resource) {
767 751
         $this->smLinks['l2p'][$resource->getId()][] = $canvas->getId();
768 752
         if (!is_array($this->smLinks['p2l'][$canvas->getId()]) || !in_array($resource->getId(), $this->smLinks['p2l'][$canvas->getId()])) {
769 753
             $this->smLinks['p2l'][$canvas->getId()][] = $resource->getId();
@@ -775,8 +759,7 @@  discard block
 block discarded – undo
775 759
      * @see Doc::getFullText()
776 760
      */
777 761
     //TODO: rewrite it to get full OCR
778
-    public function getFullText($id)
779
-    {
762
+    public function getFullText($id) {
780 763
         $rawText = '';
781 764
         // Get text from raw text array if available.
782 765
         if (!empty($this->rawTextArray[$id])) {
@@ -833,8 +816,7 @@  discard block
 block discarded – undo
833 816
      *
834 817
      * @return IiifResourceInterface
835 818
      */
836
-    public function getIiif()
837
-    {
819
+    public function getIiif() {
838 820
         return $this->iiif;
839 821
     }
840 822
 
@@ -842,8 +824,7 @@  discard block
 block discarded – undo
842 824
      * {@inheritDoc}
843 825
      * @see Doc::init()
844 826
      */
845
-    protected function init($location)
846
-    {
827
+    protected function init($location) {
847 828
         // Nothing to do here, at the moment
848 829
     }
849 830
 
@@ -851,8 +832,7 @@  discard block
 block discarded – undo
851 832
      * {@inheritDoc}
852 833
      * @see Doc::loadLocation()
853 834
      */
854
-    protected function loadLocation($location)
855
-    {
835
+    protected function loadLocation($location) {
856 836
         $fileResource = GeneralUtility::getUrl($location);
857 837
         if ($fileResource !== false) {
858 838
             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -875,8 +855,7 @@  discard block
 block discarded – undo
875 855
      * {@inheritDoc}
876 856
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
877 857
      */
878
-    protected function prepareMetadataArray($cPid)
879
-    {
858
+    protected function prepareMetadataArray($cPid) {
880 859
         $id = $this->iiif->getId();
881 860
         $this->metadataArray[(string) $id] = $this->getMetadata((string) $id, $cPid);
882 861
     }
@@ -885,8 +864,7 @@  discard block
 block discarded – undo
885 864
      * {@inheritDoc}
886 865
      * @see Doc::setPreloadedDocument()
887 866
      */
888
-    protected function setPreloadedDocument($preloadedDocument)
889
-    {
867
+    protected function setPreloadedDocument($preloadedDocument) {
890 868
         if ($preloadedDocument instanceof ManifestInterface) {
891 869
             $this->iiif = $preloadedDocument;
892 870
             return true;
@@ -898,8 +876,7 @@  discard block
 block discarded – undo
898 876
      * {@inheritDoc}
899 877
      * @see Docu::ensureHasFulltextIsSet()
900 878
      */
901
-    protected function ensureHasFulltextIsSet()
902
-    {
879
+    protected function ensureHasFulltextIsSet() {
903 880
         /*
904 881
          *  TODO Check annotations and annotation lists of canvas for ALTO documents.
905 882
          *  Example:
@@ -945,8 +922,7 @@  discard block
 block discarded – undo
945 922
      * {@inheritDoc}
946 923
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
947 924
      */
948
-    protected function _getThumbnail($forceReload = false)
949
-    {
925
+    protected function _getThumbnail($forceReload = false) {
950 926
         return $this->iiif->getThumbnailUrl();
951 927
     }
952 928
 
@@ -954,8 +930,7 @@  discard block
 block discarded – undo
954 930
      * {@inheritDoc}
955 931
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
956 932
      */
957
-    protected function _getToplevelId()
958
-    {
933
+    protected function _getToplevelId() {
959 934
         if (empty($this->toplevelId)) {
960 935
             if (isset($this->iiif)) {
961 936
                 $this->toplevelId = $this->iiif->getId();
@@ -972,8 +947,7 @@  discard block
 block discarded – undo
972 947
      *
973 948
      * @return void
974 949
      */
975
-    public function __wakeup()
976
-    {
950
+    public function __wakeup() {
977 951
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
978 952
         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
979 953
         IiifHelper::setMaxThumbnailHeight($conf['iiifThumbnailHeight']);
@@ -992,8 +966,7 @@  discard block
 block discarded – undo
992 966
      *
993 967
      * @return string[]
994 968
      */
995
-    public function __sleep()
996
-    {
969
+    public function __sleep() {
997 970
         // TODO implement serializiation in IIIF library
998 971
         $jsonArray = $this->iiif->getOriginalJsonArray();
999 972
         $this->asJson = json_encode($jsonArray);
Please login to merge, or discard this patch.
Classes/Common/Doc.php 2 patches
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
  * @property-read string $toplevelId This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF)
50 50
  * @abstract
51 51
  */
52
-abstract class Doc
53
-{
52
+abstract class Doc {
54 53
     /**
55 54
      * This holds the logger
56 55
      *
@@ -326,8 +325,7 @@  discard block
 block discarded – undo
326 325
      *
327 326
      * @return void
328 327
      */
329
-    public static function clearRegistry()
330
-    {
328
+    public static function clearRegistry() {
331 329
         // Reset registry array.
332 330
         self::$registry = [];
333 331
     }
@@ -505,8 +503,7 @@  discard block
 block discarded – undo
505 503
      *
506 504
      * @return int The physical page number
507 505
      */
508
-    public function getPhysicalPage($logicalPage)
509
-    {
506
+    public function getPhysicalPage($logicalPage) {
510 507
         if (
511 508
             !empty($this->lastSearchedPhysicalPage['logicalPage'])
512 509
             && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage
@@ -551,8 +548,7 @@  discard block
 block discarded – undo
551 548
      *
552 549
      * @return string The OCR full text
553 550
      */
554
-    protected function getFullTextFromXml($id)
555
-    {
551
+    protected function getFullTextFromXml($id) {
556 552
         $fullText = '';
557 553
         // Load available text formats, ...
558 554
         $this->loadFormats();
@@ -614,8 +610,7 @@  discard block
 block discarded – undo
614 610
      *
615 611
      * @return string The format of the OCR full text
616 612
      */
617
-    private function getTextFormat($fileContent)
618
-    {
613
+    private function getTextFormat($fileContent) {
619 614
         $xml = Helper::getXmlFileAsString($fileContent);
620 615
 
621 616
         if ($xml !== false) {
@@ -638,8 +633,7 @@  discard block
 block discarded – undo
638 633
      *
639 634
      * @return string The title of the document itself or a parent document
640 635
      */
641
-    public static function getTitle($uid, $recursive = false)
642
-    {
636
+    public static function getTitle($uid, $recursive = false) {
643 637
         $title = '';
644 638
         // Sanitize input.
645 639
         $uid = max(intval($uid), 0);
@@ -691,8 +685,7 @@  discard block
 block discarded – undo
691 685
      *
692 686
      * @return array The logical structure node's / resource's parsed metadata array
693 687
      */
694
-    public function getTitledata($cPid = 0)
695
-    {
688
+    public function getTitledata($cPid = 0) {
696 689
         $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
697 690
         // Add information from METS structural map to titledata array.
698 691
         if ($this instanceof MetsDocument) {
@@ -725,8 +718,7 @@  discard block
 block discarded – undo
725 718
      * @return int|bool: false if structure with $logId is not a child of this substructure,
726 719
      * or the actual depth.
727 720
      */
728
-    protected function getTreeDepth($structure, $depth, $logId)
729
-    {
721
+    protected function getTreeDepth($structure, $depth, $logId) {
730 722
         foreach ($structure as $element) {
731 723
             if ($element['id'] == $logId) {
732 724
                 return $depth;
@@ -748,8 +740,7 @@  discard block
 block discarded – undo
748 740
      * @param string $logId: The id of the logical structure element whose depth is requested
749 741
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
750 742
      */
751
-    public function getStructureDepth($logId)
752
-    {
743
+    public function getStructureDepth($logId) {
753 744
         return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId);
754 745
     }
755 746
 
@@ -801,8 +792,7 @@  discard block
 block discarded – undo
801 792
      *
802 793
      * @return bool true on success or false on failure
803 794
      */
804
-    protected function load($location)
805
-    {
795
+    protected function load($location) {
806 796
         // Load XML / JSON-LD file.
807 797
         if (GeneralUtility::isValidUrl($location)) {
808 798
             // the actual loading is format specific
@@ -829,8 +819,7 @@  discard block
 block discarded – undo
829 819
      *
830 820
      * @return void
831 821
      */
832
-    protected function loadFormats()
833
-    {
822
+    protected function loadFormats() {
834 823
         if (!$this->formatsLoaded) {
835 824
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
836 825
                 ->getQueryBuilderForTable('tx_dlf_formats');
@@ -870,8 +859,7 @@  discard block
 block discarded – undo
870 859
      *
871 860
      * @return void
872 861
      */
873
-    public function registerNamespaces(&$obj)
874
-    {
862
+    public function registerNamespaces(&$obj) {
875 863
         // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions.
876 864
         $this->loadFormats();
877 865
         // Do we have a \SimpleXMLElement or \DOMXPath object?
@@ -896,8 +884,7 @@  discard block
 block discarded – undo
896 884
      *
897 885
      * @return int The PID of the metadata definitions
898 886
      */
899
-    protected function _getCPid()
900
-    {
887
+    protected function _getCPid() {
901 888
         return $this->cPid;
902 889
     }
903 890
 
@@ -908,8 +895,7 @@  discard block
 block discarded – undo
908 895
      *
909 896
      * @return bool Are there any fulltext files available?
910 897
      */
911
-    protected function _getHasFulltext()
912
-    {
898
+    protected function _getHasFulltext() {
913 899
         $this->ensureHasFulltextIsSet();
914 900
         return $this->hasFulltext;
915 901
     }
@@ -921,8 +907,7 @@  discard block
 block discarded – undo
921 907
      *
922 908
      * @return string The location of the document
923 909
      */
924
-    protected function _getLocation()
925
-    {
910
+    protected function _getLocation() {
926 911
         return $this->location;
927 912
     }
928 913
 
@@ -944,8 +929,7 @@  discard block
 block discarded – undo
944 929
      *
945 930
      * @return array Array of metadata with their corresponding logical structure node ID as key
946 931
      */
947
-    protected function _getMetadataArray()
948
-    {
932
+    protected function _getMetadataArray() {
949 933
         // Set metadata definitions' PID.
950 934
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
951 935
         if (!$cPid) {
@@ -970,8 +954,7 @@  discard block
 block discarded – undo
970 954
      *
971 955
      * @return int The total number of pages and/or tracks
972 956
      */
973
-    protected function _getNumPages()
974
-    {
957
+    protected function _getNumPages() {
975 958
         $this->_getPhysicalStructure();
976 959
         return $this->numPages;
977 960
     }
@@ -983,8 +966,7 @@  discard block
 block discarded – undo
983 966
      *
984 967
      * @return int The UID of the parent document or zero if not applicable
985 968
      */
986
-    protected function _getParentId()
987
-    {
969
+    protected function _getParentId() {
988 970
         return $this->parentId;
989 971
     }
990 972
 
@@ -1007,8 +989,7 @@  discard block
 block discarded – undo
1007 989
      *
1008 990
      * @return array Array of elements' type, label and file representations ordered by "@ID" attribute / Canvas order
1009 991
      */
1010
-    protected function _getPhysicalStructureInfo()
1011
-    {
992
+    protected function _getPhysicalStructureInfo() {
1012 993
         // Is there no physical structure array yet?
1013 994
         if (!$this->physicalStructureLoaded) {
1014 995
             // Build physical structure array.
@@ -1024,8 +1005,7 @@  discard block
 block discarded – undo
1024 1005
      *
1025 1006
      * @return int The PID of the document or zero if not in database
1026 1007
      */
1027
-    protected function _getPid()
1028
-    {
1008
+    protected function _getPid() {
1029 1009
         return $this->pid;
1030 1010
     }
1031 1011
 
@@ -1036,8 +1016,7 @@  discard block
 block discarded – undo
1036 1016
      *
1037 1017
      * @return bool Is the document instantiated successfully?
1038 1018
      */
1039
-    protected function _getReady()
1040
-    {
1019
+    protected function _getReady() {
1041 1020
         return $this->ready;
1042 1021
     }
1043 1022
 
@@ -1048,8 +1027,7 @@  discard block
 block discarded – undo
1048 1027
      *
1049 1028
      * @return mixed The METS file's / IIIF manifest's record identifier
1050 1029
      */
1051
-    protected function _getRecordId()
1052
-    {
1030
+    protected function _getRecordId() {
1053 1031
         return $this->recordId;
1054 1032
     }
1055 1033
 
@@ -1060,8 +1038,7 @@  discard block
 block discarded – undo
1060 1038
      *
1061 1039
      * @return int The UID of the root document or zero if not applicable
1062 1040
      */
1063
-    protected function _getRootId()
1064
-    {
1041
+    protected function _getRootId() {
1065 1042
         if (!$this->rootIdLoaded) {
1066 1043
             if ($this->parentId) {
1067 1044
                 $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]);
@@ -1091,8 +1068,7 @@  discard block
 block discarded – undo
1091 1068
      *
1092 1069
      * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved
1093 1070
      */
1094
-    protected function _getTableOfContents()
1095
-    {
1071
+    protected function _getTableOfContents() {
1096 1072
         // Is there no logical structure array yet?
1097 1073
         if (!$this->tableOfContentsLoaded) {
1098 1074
             // Get all logical structures.
@@ -1133,8 +1109,7 @@  discard block
 block discarded – undo
1133 1109
      *
1134 1110
      * @return mixed The UID or the URL of the document
1135 1111
      */
1136
-    protected function _getUid()
1137
-    {
1112
+    protected function _getUid() {
1138 1113
         return $this->uid;
1139 1114
     }
1140 1115
 
@@ -1147,8 +1122,7 @@  discard block
 block discarded – undo
1147 1122
      *
1148 1123
      * @return void
1149 1124
      */
1150
-    protected function _setCPid($value)
1151
-    {
1125
+    protected function _setCPid($value) {
1152 1126
         $this->cPid = max(intval($value), 0);
1153 1127
     }
1154 1128
 
@@ -1165,8 +1139,7 @@  discard block
 block discarded – undo
1165 1139
      *
1166 1140
      * @return void
1167 1141
      */
1168
-    protected function __construct($location, $pid, $preloadedDocument)
1169
-    {
1142
+    protected function __construct($location, $pid, $preloadedDocument) {
1170 1143
         $this->setPreloadedDocument($preloadedDocument);
1171 1144
         $this->init($location);
1172 1145
         $this->establishRecordId($pid);
@@ -1182,8 +1155,7 @@  discard block
 block discarded – undo
1182 1155
      *
1183 1156
      * @return mixed Value of $this->$var
1184 1157
      */
1185
-    public function __get($var)
1186
-    {
1158
+    public function __get($var) {
1187 1159
         $method = '_get' . ucfirst($var);
1188 1160
         if (
1189 1161
             !property_exists($this, $var)
@@ -1205,8 +1177,7 @@  discard block
 block discarded – undo
1205 1177
      *
1206 1178
      * @return bool true if variable is set and not empty, false otherwise
1207 1179
      */
1208
-    public function __isset($var)
1209
-    {
1180
+    public function __isset($var) {
1210 1181
         return !empty($this->__get($var));
1211 1182
     }
1212 1183
 
@@ -1220,8 +1191,7 @@  discard block
 block discarded – undo
1220 1191
      *
1221 1192
      * @return void
1222 1193
      */
1223
-    public function __set($var, $value)
1224
-    {
1194
+    public function __set($var, $value) {
1225 1195
         $method = '_set' . ucfirst($var);
1226 1196
         if (
1227 1197
             !property_exists($this, $var)
@@ -1239,8 +1209,7 @@  discard block
 block discarded – undo
1239 1209
      * @param string $location
1240 1210
      * @return Doc|false
1241 1211
      */
1242
-    private static function getDocCache(string $location)
1243
-    {
1212
+    private static function getDocCache(string $location) {
1244 1213
         $cacheIdentifier = md5($location);
1245 1214
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc');
1246 1215
         $cacheHit = $cache->get($cacheIdentifier);
@@ -1255,8 +1224,7 @@  discard block
 block discarded – undo
1255 1224
      * @param Doc $doc
1256 1225
      * @return void
1257 1226
      */
1258
-    private static function setDocCache(string $location, Doc $doc)
1259
-    {
1227
+    private static function setDocCache(string $location, Doc $doc) {
1260 1228
         $cacheIdentifier = md5($location);
1261 1229
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc');
1262 1230
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @var bool
105 105
      * @access protected
106 106
      */
107
-    protected $formatsLoaded = false;
107
+    protected $formatsLoaded = FALSE;
108 108
 
109 109
     /**
110 110
      * Are there any fulltext files available? This also includes IIIF text annotations
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @var bool
115 115
      * @access protected
116 116
      */
117
-    protected $hasFulltext = false;
117
+    protected $hasFulltext = FALSE;
118 118
 
119 119
     /**
120 120
      * Last searched logical and physical page
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @var array
123 123
      * @access protected
124 124
      */
125
-    protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null];
125
+    protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL];
126 126
 
127 127
     /**
128 128
      * This holds the logical units
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * @var bool
149 149
      * @access protected
150 150
      */
151
-    protected $metadataArrayLoaded = false;
151
+    protected $metadataArrayLoaded = FALSE;
152 152
 
153 153
     /**
154 154
      * The holds the total number of pages
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @var bool
190 190
      * @access protected
191 191
      */
192
-    protected $physicalStructureLoaded = false;
192
+    protected $physicalStructureLoaded = FALSE;
193 193
 
194 194
     /**
195 195
      * This holds the PID of the document or zero if not in database
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @var bool
215 215
      * @access protected
216 216
      */
217
-    protected $ready = false;
217
+    protected $ready = FALSE;
218 218
 
219 219
     /**
220 220
      * The METS file's / IIIF manifest's record identifier
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @var bool
249 249
      * @access protected
250 250
      */
251
-    protected $rootIdLoaded = false;
251
+    protected $rootIdLoaded = FALSE;
252 252
 
253 253
     /**
254 254
      * This holds the smLinks between logical and physical structMap
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * @var bool
266 266
      * @access protected
267 267
      */
268
-    protected $smLinksLoaded = false;
268
+    protected $smLinksLoaded = FALSE;
269 269
 
270 270
     /**
271 271
      * This holds the logical structure
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * @var bool
283 283
      * @access protected
284 284
      */
285
-    protected $tableOfContentsLoaded = false;
285
+    protected $tableOfContentsLoaded = FALSE;
286 286
 
287 287
     /**
288 288
      * This holds the document's thumbnail location
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      * @var bool
300 300
      * @access protected
301 301
      */
302
-    protected $thumbnailLoaded = false;
302
+    protected $thumbnailLoaded = FALSE;
303 303
 
304 304
     /**
305 305
      * This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF)
@@ -408,17 +408,17 @@  discard block
 block discarded – undo
408 408
      *
409 409
      * @return \Kitodo\Dlf\Common\Doc|null Instance of this class, either MetsDocument or IiifManifest
410 410
      */
411
-    public static function &getInstance($location, $settings = [], $forceReload = false)
411
+    public static function &getInstance($location, $settings = [], $forceReload = FALSE)
412 412
     {
413 413
         // Create new instance depending on format (METS or IIIF) ...
414
-        $documentFormat = null;
415
-        $xml = null;
416
-        $iiif = null;
414
+        $documentFormat = NULL;
415
+        $xml = NULL;
416
+        $iiif = NULL;
417 417
 
418 418
         if ($instance = self::getDocCache($location)) {
419 419
             return $instance;
420 420
         } else {
421
-            $instance = null;
421
+            $instance = NULL;
422 422
         }
423 423
 
424 424
         // Try to load a file from the url
@@ -427,17 +427,17 @@  discard block
 block discarded – undo
427 427
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
428 428
 
429 429
             $content = Helper::getUrl($location);
430
-            if ($content !== false) {
430
+            if ($content !== FALSE) {
431 431
                 $xml = Helper::getXmlFileAsString($content);
432
-                if ($xml !== false) {
432
+                if ($xml !== FALSE) {
433 433
                     /* @var $xml \SimpleXMLElement */
434 434
                     $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/');
435 435
                     $xpathResult = $xml->xpath('//mets:mets');
436
-                    $documentFormat = !empty($xpathResult) ? 'METS' : null;
436
+                    $documentFormat = !empty($xpathResult) ? 'METS' : NULL;
437 437
                 } else {
438 438
                     // Try to load file as IIIF resource instead.
439
-                    $contentAsJsonArray = json_decode($content, true);
440
-                    if ($contentAsJsonArray !== null) {
439
+                    $contentAsJsonArray = json_decode($content, TRUE);
440
+                    if ($contentAsJsonArray !== NULL) {
441 441
                         IiifHelper::setUrlReader(IiifUrlReader::getInstance());
442 442
                         IiifHelper::setMaxThumbnailHeight($extConf['iiifThumbnailHeight']);
443 443
                         IiifHelper::setMaxThumbnailWidth($extConf['iiifThumbnailWidth']);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      *
479 479
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
480 480
      */
481
-    public abstract function getLogicalStructure($id, $recursive = false);
481
+    public abstract function getLogicalStructure($id, $recursive = FALSE);
482 482
 
483 483
     /**
484 484
      * This extracts all the metadata for a logical structure node
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         } else {
516 516
             $physicalPage = 0;
517 517
             foreach ($this->physicalStructureInfo as $page) {
518
-                if (strpos($page['orderlabel'], $logicalPage) !== false) {
518
+                if (strpos($page['orderlabel'], $logicalPage) !== FALSE) {
519 519
                     $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
520 520
                     $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
521 521
                     return $physicalPage;
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) {
567 567
                     // Get full text file.
568 568
                     $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext]));
569
-                    if ($fileContent !== false) {
569
+                    if ($fileContent !== FALSE) {
570 570
                         $textFormat = $this->getTextFormat($fileContent);
571 571
                     } else {
572 572
                         $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     {
619 619
         $xml = Helper::getXmlFileAsString($fileContent);
620 620
 
621
-        if ($xml !== false) {
621
+        if ($xml !== FALSE) {
622 622
             // Get the root element's name as text format.
623 623
             return strtoupper($xml->getName());
624 624
         } else {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
      *
639 639
      * @return string The title of the document itself or a parent document
640 640
      */
641
-    public static function getTitle($uid, $recursive = false)
641
+    public static function getTitle($uid, $recursive = FALSE)
642 642
     {
643 643
         $title = '';
644 644
         // Sanitize input.
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                     && intval($partof)
672 672
                     && $partof != $uid
673 673
                 ) {
674
-                    $title = self::getTitle($partof, true);
674
+                    $title = self::getTitle($partof, TRUE);
675 675
                 }
676 676
             } else {
677 677
                 Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
                 return $depth;
733 733
             } elseif (array_key_exists('children', $element)) {
734 734
                 $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId);
735
-                if ($foundInChildren !== false) {
735
+                if ($foundInChildren !== FALSE) {
736 736
                     return $foundInChildren;
737 737
                 }
738 738
             }
739 739
         }
740
-        return false;
740
+        return FALSE;
741 741
     }
742 742
 
743 743
     /**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         } else {
811 811
             $this->logger->error('Invalid file location "' . $location . '" for document loading');
812 812
         }
813
-        return false;
813
+        return FALSE;
814 814
     }
815 815
 
816 816
     /**
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
                     'class' => $resArray['class']
858 858
                 ];
859 859
             }
860
-            $this->formatsLoaded = true;
860
+            $this->formatsLoaded = TRUE;
861 861
         }
862 862
     }
863 863
 
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
         ) {
959 959
             $this->prepareMetadataArray($cPid);
960 960
             $this->metadataArray[0] = $cPid;
961
-            $this->metadataArrayLoaded = true;
961
+            $this->metadataArrayLoaded = TRUE;
962 962
         }
963 963
         return $this->metadataArray;
964 964
     }
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                 $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]);
1068 1068
                 $this->rootId = $parent->rootId;
1069 1069
             }
1070
-            $this->rootIdLoaded = true;
1070
+            $this->rootIdLoaded = TRUE;
1071 1071
         }
1072 1072
         return $this->rootId;
1073 1073
     }
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
         // Is there no logical structure array yet?
1097 1097
         if (!$this->tableOfContentsLoaded) {
1098 1098
             // Get all logical structures.
1099
-            $this->getLogicalStructure('', true);
1100
-            $this->tableOfContentsLoaded = true;
1099
+            $this->getLogicalStructure('', TRUE);
1100
+            $this->tableOfContentsLoaded = TRUE;
1101 1101
         }
1102 1102
         return $this->tableOfContents;
1103 1103
     }
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
      *
1114 1114
      * @return string The document's thumbnail location
1115 1115
      */
1116
-    protected abstract function _getThumbnail($forceReload = false);
1116
+    protected abstract function _getThumbnail($forceReload = FALSE);
1117 1117
 
1118 1118
     /**
1119 1119
      * This returns the ID of the toplevel logical structure node
Please login to merge, or discard this patch.