Passed
Pull Request — master (#123)
by Sebastian
03:47
created
Classes/Common/Helper.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 if (!preg_match('/\d{8}-\d{1}/i', $id)) {
144 144
                     return false;
145 145
                 } elseif ($checksum == 10) {
146
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
146
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
147 147
                 } elseif (substr($id, -1, 1) != $checksum) {
148 148
                     return false;
149 149
                 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
316 316
         // Merge initialisation vector and encrypted data.
317 317
         if ($encrypted !== false) {
318
-            $encrypted = base64_encode($iv . $encrypted);
318
+            $encrypted = base64_encode($iv.$encrypted);
319 319
         }
320 320
         return $encrypted;
321 321
     }
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
     public static function getHookObjects($scriptRelPath)
370 370
     {
371 371
         $hookObjects = [];
372
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
373
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
372
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
373
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
374 374
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
375 375
             }
376 376
         }
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
             // NOTE: Only use tables that don't have too many entries!
398 398
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
399 399
         ) {
400
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
400
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
401 401
             return '';
402 402
         }
403 403
 
404
-        $makeCacheKey = function ($pid, $uid) {
405
-            return $pid . '.' . $uid;
404
+        $makeCacheKey = function($pid, $uid) {
405
+            return $pid.'.'.$uid;
406 406
         };
407 407
 
408 408
         static $cache = [];
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 
413 413
             $result = $queryBuilder
414 414
                 ->select(
415
-                    $table . '.index_name AS index_name',
416
-                    $table . '.uid AS uid',
417
-                    $table . '.pid AS pid',
415
+                    $table.'.index_name AS index_name',
416
+                    $table.'.uid AS uid',
417
+                    $table.'.pid AS pid',
418 418
                 )
419 419
                 ->from($table)
420 420
                 ->execute();
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         $result = $cache[$table][$cacheKey] ?? '';
433 433
 
434 434
         if ($result === '') {
435
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
435
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
436 436
         }
437 437
 
438 438
         return $result;
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
             // No ISO code, return unchanged.
460 460
             return $code;
461 461
         }
462
-        $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code);
462
+        $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code);
463 463
         if (!empty($lang)) {
464 464
             return $lang;
465 465
         } else {
466
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
466
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
467 467
             return $code;
468 468
         }
469 469
     }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             '-' => 39,
561 561
             ':' => 17,
562 562
         ];
563
-        $urn = strtolower($base . $id);
563
+        $urn = strtolower($base.$id);
564 564
         if (preg_match('/[^a-z\d:-]/', $urn)) {
565 565
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
566 566
             return '';
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
575 575
         }
576 576
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
577
-        return $base . $id . $checksum;
577
+        return $base.$id.$checksum;
578 578
     }
579 579
 
580 580
     /**
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         // Sanitize input.
669 669
         $pid = max(intval($pid), 0);
670 670
         if (!$pid) {
671
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
671
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
672 672
             return $index_name;
673 673
         }
674 674
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
@@ -690,13 +690,13 @@  discard block
 block discarded – undo
690 690
         // First fetch the uid of the received index_name
691 691
         $result = $queryBuilder
692 692
             ->select(
693
-                $table . '.uid AS uid',
694
-                $table . '.l18n_parent AS l18n_parent'
693
+                $table.'.uid AS uid',
694
+                $table.'.l18n_parent AS l18n_parent'
695 695
             )
696 696
             ->from($table)
697 697
             ->where(
698
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
699
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
698
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
699
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
700 700
                 self::whereExpression($table, true)
701 701
             )
702 702
             ->setMaxResults(1)
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
             $resArray = $allResults[0];
710 710
 
711 711
             $result = $queryBuilder
712
-                ->select($table . '.index_name AS index_name')
712
+                ->select($table.'.index_name AS index_name')
713 713
                 ->from($table)
714 714
                 ->where(
715
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
716
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
717
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
715
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
716
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
717
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())),
718 718
                     self::whereExpression($table, true)
719 719
                 )
720 720
                 ->setMaxResults(1)
@@ -732,14 +732,14 @@  discard block
 block discarded – undo
732 732
         if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) {
733 733
             // Check if this table is allowed for translation.
734 734
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
735
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
735
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
736 736
                 if ($languageAspect->getContentId() > 0) {
737 737
                     $additionalWhere = $queryBuilder->expr()->andX(
738 738
                         $queryBuilder->expr()->orX(
739
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
740
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId()))
739
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
740
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId()))
741 741
                         ),
742
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
742
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
743 743
                     );
744 744
                 }
745 745
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
                     ->select('*')
749 749
                     ->from($table)
750 750
                     ->where(
751
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
751
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
752 752
                         $additionalWhere,
753 753
                         self::whereExpression($table, true)
754 754
                     )
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
                         }
767 767
                     }
768 768
                 } else {
769
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
769
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
770 770
                 }
771 771
             } else {
772
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
772
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
773 773
             }
774 774
         }
775 775
 
@@ -811,9 +811,9 @@  discard block
 block discarded – undo
811 811
             return GeneralUtility::makeInstance(ConnectionPool::class)
812 812
                 ->getQueryBuilderForTable($table)
813 813
                 ->expr()
814
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
814
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
815 815
         } else {
816
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
816
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
817 817
             return '1=-1';
818 818
         }
819 819
     }
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
      */
853 853
     public static function polyfillExtbaseClassesForTYPO3v9()
854 854
     {
855
-        $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
855
+        $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php';
856 856
 
857 857
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
858 858
         $configurationManager = $objectManager->get(ConfigurationManager::class);
@@ -908,10 +908,10 @@  discard block
 block discarded – undo
908 908
         try {
909 909
             $response = $requestFactory->request($url, 'GET', $configuration);
910 910
         } catch (\Exception $e) {
911
-            self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
911
+            self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING);
912 912
             return false;
913 913
         }
914
-        $content  = $response->getBody()->getContents();
914
+        $content = $response->getBody()->getContents();
915 915
 
916 916
         return $content;
917 917
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
83 83
      */
84
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
84
+    public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages')
85 85
     {
86 86
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
87 87
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     $checksum = 'X';
124 124
                 }
125 125
                 if (!preg_match('/\d{8}[\dX]{1}/i', $id)) {
126
-                    return false;
126
+                    return FALSE;
127 127
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
128
-                    return false;
128
+                    return FALSE;
129 129
                 }
130 130
                 break;
131 131
             case 'ZDB':
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
                     $checksum = 'X';
134 134
                 }
135 135
                 if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) {
136
-                    return false;
136
+                    return FALSE;
137 137
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
138
-                    return false;
138
+                    return FALSE;
139 139
                 }
140 140
                 break;
141 141
             case 'SWD':
142 142
                 $checksum = 11 - $checksum;
143 143
                 if (!preg_match('/\d{8}-\d{1}/i', $id)) {
144
-                    return false;
144
+                    return FALSE;
145 145
                 } elseif ($checksum == 10) {
146 146
                     return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
147 147
                 } elseif (substr($id, -1, 1) != $checksum) {
148
-                    return false;
148
+                    return FALSE;
149 149
                 }
150 150
                 break;
151 151
             case 'GKD':
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
                     $checksum = 'X';
155 155
                 }
156 156
                 if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) {
157
-                    return false;
157
+                    return FALSE;
158 158
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
159
-                    return false;
159
+                    return FALSE;
160 160
                 }
161 161
                 break;
162 162
         }
163
-        return true;
163
+        return TRUE;
164 164
     }
165 165
 
166 166
     /**
@@ -175,28 +175,28 @@  discard block
 block discarded – undo
175 175
     public static function decrypt($encrypted)
176 176
     {
177 177
         if (
178
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
179
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
178
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
179
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
180 180
         ) {
181 181
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
182
-            return false;
182
+            return FALSE;
183 183
         }
184 184
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
185 185
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
186
-            return false;
186
+            return FALSE;
187 187
         }
188 188
         if (
189 189
             empty($encrypted)
190 190
             || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm)
191 191
         ) {
192 192
             self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR);
193
-            return false;
193
+            return FALSE;
194 194
         }
195 195
         // Split initialisation vector and encrypted data.
196 196
         $binary = base64_decode($encrypted);
197 197
         $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm));
198 198
         $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm));
199
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
199
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
200 200
         // Decrypt data.
201 201
         $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
202 202
         return $decrypted;
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
         // Don't make simplexml_load_string throw (when $content is an array
218 218
         // or object)
219 219
         if (!is_string($content)) {
220
-            return false;
220
+            return FALSE;
221 221
         }
222 222
 
223 223
         // Turn off libxml's error logging.
224
-        $libxmlErrors = libxml_use_internal_errors(true);
224
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
225 225
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
226
-        $previousValueOfEntityLoader = libxml_disable_entity_loader(true);
226
+        $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
227 227
         // Try to load XML from file.
228 228
         $xml = simplexml_load_string($content);
229 229
         // reset entity loader setting
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public static function digest($string)
279 279
     {
280
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
280
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
281 281
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
282
-            return false;
282
+            return FALSE;
283 283
         }
284 284
         // Hash string.
285 285
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -298,23 +298,23 @@  discard block
 block discarded – undo
298 298
     public static function encrypt($string)
299 299
     {
300 300
         if (
301
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
302
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
301
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
302
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
303 303
         ) {
304 304
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
305
-            return false;
305
+            return FALSE;
306 306
         }
307 307
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
308 308
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
309
-            return false;
309
+            return FALSE;
310 310
         }
311 311
         // Generate random initialisation vector.
312 312
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
313
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
313
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
314 314
         // Encrypt data.
315 315
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
316 316
         // Merge initialisation vector and encrypted data.
317
-        if ($encrypted !== false) {
317
+        if ($encrypted !== FALSE) {
318 318
             $encrypted = base64_encode($iv . $encrypted);
319 319
         }
320 320
         return $encrypted;
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
     public static function isValidHttpUrl($url)
602 602
     {
603 603
         if (!GeneralUtility::isValidUrl($url)) {
604
-            return false;
604
+            return FALSE;
605 605
         }
606 606
 
607 607
         $parsed = parse_url($url);
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      *
626 626
      * @return array Merged array
627 627
      */
628
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
628
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
629 629
     {
630 630
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
631 631
         return $original;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
             ->where(
698 698
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
699 699
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
700
-                self::whereExpression($table, true)
700
+                self::whereExpression($table, TRUE)
701 701
             )
702 702
             ->setMaxResults(1)
703 703
             ->execute();
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
716 716
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
717 717
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
718
-                    self::whereExpression($table, true)
718
+                    self::whereExpression($table, TRUE)
719 719
                 )
720 720
                 ->setMaxResults(1)
721 721
                 ->execute();
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                     ->where(
751 751
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
752 752
                         $additionalWhere,
753
-                        self::whereExpression($table, true)
753
+                        self::whereExpression($table, TRUE)
754 754
                     )
755 755
                     ->setMaxResults(10000)
756 756
                     ->execute();
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
      *
791 791
      * @return string Additional WHERE expression
792 792
      */
793
-    public static function whereExpression($table, $showHidden = false)
793
+    public static function whereExpression($table, $showHidden = FALSE)
794 794
     {
795 795
         if (\TYPO3_MODE === 'FE') {
796 796
             // Should we ignore the record's hidden flag?
@@ -859,13 +859,13 @@  discard block
 block discarded – undo
859 859
         $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
860 860
 
861 861
         $extbaseClassmap = &$frameworkConfiguration['persistence']['classes'];
862
-        if ($extbaseClassmap === null) {
862
+        if ($extbaseClassmap === NULL) {
863 863
             $extbaseClassmap = [];
864 864
         }
865 865
 
866 866
         foreach ($classes as $className => $classConfig) {
867 867
             $extbaseClass = &$extbaseClassmap[$className];
868
-            if ($extbaseClass === null) {
868
+            if ($extbaseClass === NULL) {
869 869
                 $extbaseClass = [];
870 870
             }
871 871
             if (!isset($extbaseClass['mapping'])) {
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     public static function getUrl(string $url)
892 892
     {
893 893
         if (!Helper::isValidHttpUrl($url)) {
894
-            return false;
894
+            return FALSE;
895 895
         }
896 896
 
897 897
         // Get extension configuration.
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
             $response = $requestFactory->request($url, 'GET', $configuration);
910 910
         } catch (\Exception $e) {
911 911
             self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
912
-            return false;
912
+            return FALSE;
913 913
         }
914 914
         $content  = $response->getBody()->getContents();
915 915
 
Please login to merge, or discard this patch.
Tests/routeFunctionalInstance.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 preg_match("@.*/(?:acceptance|functional-[a-z\d]+)@", $_SERVER['REQUEST_URI'], $matches);
16 16
 
17 17
 if (!empty($matches)) {
18
-    $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]);
18
+    $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]);
19 19
     if ($root !== false) {
20
-        putenv('TYPO3_PATH_ROOT=' . $root);
21
-        putenv('TYPO3_PATH_APP=' . $root);
20
+        putenv('TYPO3_PATH_ROOT='.$root);
21
+        putenv('TYPO3_PATH_APP='.$root);
22 22
     }
23 23
 }
24 24
 
Please login to merge, or discard this patch.
Classes/Common/SolrSearch.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             // in which case metadata of toplevel entry isn't yet filled.
99 99
             if (empty($document['metadata'])) {
100 100
                 $document['metadata'] = $this->fetchToplevelMetadataFromSolr([
101
-                    'query' => 'uid:' . $document['uid'],
101
+                    'query' => 'uid:'.$document['uid'],
102 102
                     'start' => 0,
103 103
                     'rows' => 1,
104 104
                     'sort' => ['score' => 'desc'],
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             if (empty($document['title']) && $document['partOf'] > 0) {
110 110
                 $superiorTitle = Doc::getTitle($document['partOf'], true);
111 111
                 if (!empty($superiorTitle)) {
112
-                    $document['title'] = '[' . $superiorTitle . ']';
112
+                    $document['title'] = '['.$superiorTitle.']';
113 113
                 }
114 114
             }
115 115
         }
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
         // Set search query.
173 173
         if (
174 174
             (!empty($this->searchParams['fulltext']))
175
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches)
175
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches)
176 176
         ) {
177 177
             // If the query already is a fulltext query e.g using the facets
178 178
             $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1];
179 179
             // Search in fulltext field if applicable. Query must not be empty!
180 180
             if (!empty($this->searchParams['query'])) {
181
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
181
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')';
182 182
             }
183 183
             $params['fulltext'] = true;
184 184
         } else {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
                         in_array($this->searchParams['extOperator'][$i], $allowedOperators)
202 202
                     ) {
203 203
                         if (!empty($query)) {
204
-                            $query .= ' ' . $this->searchParams['extOperator'][$i] . ' ';
204
+                            $query .= ' '.$this->searchParams['extOperator'][$i].' ';
205 205
                         }
206
-                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')';
206
+                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')';
207 207
                     }
208 208
                 }
209 209
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         // Add filter query for date search
213 213
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
214 214
             // combine dateFrom and dateTo into range search
215
-            $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
215
+            $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
216 216
         }
217 217
 
218 218
         // Add filter query for faceting.
@@ -229,22 +229,22 @@  discard block
 block discarded – undo
229 229
         ) {
230 230
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
231 231
             $params['filterquery'][]['query'] = '_query_:"{!join from='
232
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
233
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
234
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from='
235
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
236
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR '
237
-                . $fields['uid'] . ':' . $this->searchParams['documentId'];
232
+                . $fields['uid'].' to='.$fields['partof'].'}'
233
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
234
+                . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from='
235
+                . $fields['uid'].' to='.$fields['partof'].'}'
236
+                . $fields['uid'].':'.$this->searchParams['documentId'].' OR '
237
+                . $fields['uid'].':'.$this->searchParams['documentId'];
238 238
         }
239 239
 
240 240
         // if a collection is given, we prepare the collection query string
241 241
         if ($this->collection) {
242 242
             if ($this->collection instanceof Collection) {
243
-                $collectionsQueryString = '"' . $this->collection->getIndexName() . '"';
243
+                $collectionsQueryString = '"'.$this->collection->getIndexName().'"';
244 244
             } else {
245 245
                 $collectionsQueryString = '';
246 246
                 foreach ($this->collection as $index => $collectionEntry) {
247
-                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '') . '"' . $collectionEntry->getIndexName() . '"';
247
+                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '').'"'.$collectionEntry->getIndexName().'"';
248 248
                 }
249 249
             }
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                 $params['filterquery'][]['query'] = 'toplevel:true';
253 253
                 $params['filterquery'][]['query'] = 'partof:0';
254 254
             }
255
-            $params['filterquery'][]['query'] = 'collection_faceting:(' . $collectionsQueryString . ')';
255
+            $params['filterquery'][]['query'] = 'collection_faceting:('.$collectionsQueryString.')';
256 256
         }
257 257
 
258 258
         // Set some query parameters.
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
         if ($this->listedMetadata) {
280 280
             foreach ($this->listedMetadata as $metadata) {
281 281
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
282
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
283
-                    $params['fields'] .= ',' . $listMetadataRecord;
282
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
283
+                    $params['fields'] .= ','.$listMetadataRecord;
284 284
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
285 285
                 }
286 286
             }
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
                 }
325 325
                 if ($documents[$doc['uid']]) {
326 326
                     // translate language code if applicable
327
-                    if($doc['metadata']['language']) {
328
-                        foreach($doc['metadata']['language'] as $indexName => $language) {
327
+                    if ($doc['metadata']['language']) {
328
+                        foreach ($doc['metadata']['language'] as $indexName => $language) {
329 329
                             $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]);
330 330
                         }
331 331
                     }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                             $children = $childrenOf[$doc['uid']] ?? [];
365 365
                             if (!empty($children)) {
366 366
                                 $metadataOf = $this->fetchToplevelMetadataFromSolr([
367
-                                    'query' => 'partof:' . $doc['uid'],
367
+                                    'query' => 'partof:'.$doc['uid'],
368 368
                                     'start' => 0,
369 369
                                     'rows' => 100,
370 370
                                 ]);
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
         if ($this->listedMetadata) {
412 412
             foreach ($this->listedMetadata as $metadata) {
413 413
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
414
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
415
-                    $params['fields'] .= ',' . $listMetadataRecord;
414
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
415
+                    $params['fields'] .= ','.$listMetadataRecord;
416 416
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
417 417
                 }
418 418
             }
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 
426 426
         foreach ($result['documents'] as $doc) {
427 427
             // translate language code if applicable
428
-            if($doc['metadata']['language']) {
429
-                foreach($doc['metadata']['language'] as $indexName => $language) {
428
+            if ($doc['metadata']['language']) {
429
+                foreach ($doc['metadata']['language'] as $indexName => $language) {
430 430
                     $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]);
431 431
                 }
432 432
             }
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
         $cache = null;
469 469
         // Calculate cache identifier.
470 470
         if ($enableCache === true) {
471
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
471
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
472 472
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
473 473
         }
474 474
         $resultSet = [
Please login to merge, or discard this patch.
Upper-Lower-Casing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param array $searchParams
35 35
      * @param QueryResult $listedMetadata
36 36
      */
37
-    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null)
37
+    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = NULL)
38 38
     {
39 39
         $this->documentRepository = $documentRepository;
40 40
         $this->collection = $collection;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function count()
52 52
     {
53
-        if ($this->result === null) {
53
+        if ($this->result === NULL) {
54 54
             return 0;
55 55
         }
56 56
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
     public function offsetGet($offset)
92 92
     {
93 93
         $idx = $this->result['document_keys'][$offset];
94
-        $document = $this->result['documents'][$idx] ?? null;
94
+        $document = $this->result['documents'][$idx] ?? NULL;
95 95
 
96
-        if ($document !== null) {
96
+        if ($document !== NULL) {
97 97
             // It may happen that a Solr group only includes non-toplevel results,
98 98
             // in which case metadata of toplevel entry isn't yet filled.
99 99
             if (empty($document['metadata'])) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             // get title of parent/grandparent/... if empty
109 109
             if (empty($document['title']) && $document['partOf'] > 0) {
110
-                $superiorTitle = Doc::getTitle($document['partOf'], true);
110
+                $superiorTitle = Doc::getTitle($document['partOf'], TRUE);
111 111
                 if (!empty($superiorTitle)) {
112 112
                     $document['title'] = '[' . $superiorTitle . ']';
113 113
                 }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             if (!empty($this->searchParams['query'])) {
181 181
                 $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
182 182
             }
183
-            $params['fulltext'] = true;
183
+            $params['fulltext'] = TRUE;
184 184
         } else {
185 185
             // Retain given search field if valid.
186 186
             if (!empty($this->searchParams['query'])) {
@@ -289,17 +289,17 @@  discard block
 block discarded – undo
289 289
         $this->params = $params;
290 290
 
291 291
         // Send off query to get total number of search results in advance
292
-        $this->submit(0, 1, false);
292
+        $this->submit(0, 1, FALSE);
293 293
     }
294 294
 
295
-    public function submit($start, $rows, $processResults = true)
295
+    public function submit($start, $rows, $processResults = TRUE)
296 296
     {
297 297
         $params = $this->params;
298 298
         $params['start'] = $start;
299 299
         $params['rows'] = $rows;
300 300
 
301 301
         // Perform search.
302
-        $result = $this->searchSolr($params, true);
302
+        $result = $this->searchSolr($params, TRUE);
303 303
 
304 304
         // Initialize values
305 305
         $documents = [];
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                             $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]);
330 330
                         }
331 331
                     }
332
-                    if ($doc['toplevel'] === false) {
332
+                    if ($doc['toplevel'] === FALSE) {
333 333
                         // this maybe a chapter, article, ..., year
334 334
                         if ($doc['type'] === 'year') {
335 335
                             continue;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                             }
354 354
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
355 355
                         }
356
-                    } else if ($doc['toplevel'] === true) {
356
+                    } else if ($doc['toplevel'] === TRUE) {
357 357
                         foreach ($params['listMetadataRecords'] as $indexName => $solrField) {
358 358
                             if (isset($doc['metadata'][$indexName])) {
359 359
                                 $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName];
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
         $params['filterquery'][] = ['query' => 'toplevel:true'];
422 422
 
423 423
         // Perform search.
424
-        $result = $this->searchSolr($params, true);
424
+        $result = $this->searchSolr($params, TRUE);
425 425
 
426 426
         foreach ($result['documents'] as $doc) {
427 427
             // translate language code if applicable
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      *
447 447
      * @return array The Apache Solr Documents that were fetched
448 448
      */
449
-    protected function searchSolr($parameters = [], $enableCache = true)
449
+    protected function searchSolr($parameters = [], $enableCache = TRUE)
450 450
     {
451 451
         // Set query.
452 452
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
         }
466 466
 
467 467
         $cacheIdentifier = '';
468
-        $cache = null;
468
+        $cache = NULL;
469 469
         // Calculate cache identifier.
470
-        if ($enableCache === true) {
471
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
470
+        if ($enableCache === TRUE) {
471
+            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE));
472 472
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
473 473
         }
474 474
         $resultSet = [
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
             'numberOfToplevels' => 0,
477 477
             'numFound' => 0,
478 478
         ];
479
-        if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) {
479
+        if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) {
480 480
             $selectQuery = $solr->service->createSelect($parameters);
481 481
 
482 482
             $grouping = $selectQuery->getGrouping();
483 483
             $grouping->addField('uid');
484 484
             $grouping->setLimit(100); // Results in group (TODO: check)
485
-            $grouping->setNumberOfGroups(true);
485
+            $grouping->setNumberOfGroups(TRUE);
486 486
 
487
-            if ($parameters['fulltext'] === true) {
487
+            if ($parameters['fulltext'] === TRUE) {
488 488
                 // get highlighting component and apply settings
489 489
                 $selectQuery->getHighlighting();
490 490
             }
491 491
 
492 492
             $solrRequest = $solr->service->createRequest($selectQuery);
493 493
 
494
-            if ($parameters['fulltext'] === true) {
494
+            if ($parameters['fulltext'] === TRUE) {
495 495
                 // If it is a fulltext search, enable highlighting.
496 496
                 // field for which highlighting is going to be performed,
497 497
                 // is required if you want to have OCR highlighting
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups();
513 513
             $resultSet['numFound'] = $uidGroup->getMatches();
514 514
             $highlighting = [];
515
-            if ($parameters['fulltext'] === true) {
515
+            if ($parameters['fulltext'] === TRUE) {
516 516
                 $data = $result->getData();
517 517
                 $highlighting = $data['ocrHighlighting'];
518 518
             }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             }
544 544
 
545 545
             // Save value in cache.
546
-            if (!empty($resultSet) && $enableCache === true) {
546
+            if (!empty($resultSet) && $enableCache === TRUE) {
547 547
                 $cache->set($cacheIdentifier, $resultSet);
548 548
             }
549 549
         } else {
Please login to merge, or discard this patch.
Classes/Api/Viaf/Client.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function __construct($viaf, RequestFactory $requestFactory)
67 67
     {
68 68
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69
-        $this->viafUrl = 'http://viaf.org/viaf/' . $viaf;
69
+        $this->viafUrl = 'http://viaf.org/viaf/'.$viaf;
70 70
         $this->requestFactory = $requestFactory;
71 71
     }
72 72
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         try {
93 93
             $response = $this->requestFactory->request($url);
94 94
         } catch (\Exception $e) {
95
-            $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
95
+            $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.');
96 96
             return false;
97 97
         }
98 98
         return $response->getBody()->getContents();
@@ -105,6 +105,6 @@  discard block
 block discarded – undo
105 105
      **/
106 106
     protected function getApiEndpoint()
107 107
     {
108
-        return $this->viafUrl . '/' . $this->endpoint;
108
+        return $this->viafUrl.'/'.$this->endpoint;
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Client
29
-{
28
+class Client {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param RequestFactory $requestFactory a request object to inject
64 63
      * @return void
65 64
      **/
66
-    public function __construct($viaf, RequestFactory $requestFactory)
67
-    {
65
+    public function __construct($viaf, RequestFactory $requestFactory) {
68 66
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 67
         $this->viafUrl = 'http://viaf.org/viaf/' . $viaf;
70 68
         $this->requestFactory = $requestFactory;
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      *
87 85
      * @return object|bool
88 86
      **/
89
-    public function getData()
90
-    {
87
+    public function getData() {
91 88
         $url = $this->getApiEndpoint();
92 89
         try {
93 90
             $response = $this->requestFactory->request($url);
@@ -103,8 +100,7 @@  discard block
 block discarded – undo
103 100
      *
104 101
      * @return string
105 102
      **/
106
-    protected function getApiEndpoint()
107
-    {
103
+    protected function getApiEndpoint() {
108 104
         return $this->viafUrl . '/' . $this->endpoint;
109 105
     }
110 106
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @var string
49 49
      **/
50
-    private $viafUrl = null;
50
+    private $viafUrl = NULL;
51 51
 
52 52
     /**
53 53
      * The request object
54 54
      *
55 55
      * @var RequestFactoryInterface
56 56
      **/
57
-    private $requestFactory = null;
57
+    private $requestFactory = NULL;
58 58
 
59 59
     /**
60 60
      * Constructs a new instance
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $response = $this->requestFactory->request($url);
94 94
         } catch (\Exception $e) {
95 95
             $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
96
-            return false;
96
+            return FALSE;
97 97
         }
98 98
         return $response->getBody()->getContents();
99 99
     }
Please login to merge, or discard this patch.
Classes/Api/Viaf/Profile.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Profile
29
-{
28
+class Profile {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      **/
60
-    public function __construct($viaf)
61
-    {
59
+    public function __construct($viaf) {
62 60
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
63 61
         $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class));
64 62
     }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      *
69 67
      * @return array|false
70 68
      **/
71
-    public function getData()
72
-    {
69
+    public function getData() {
73 70
         $this->getRaw();
74 71
         if (!empty($this->raw)) {
75 72
             $data = [];
@@ -87,8 +84,7 @@  discard block
 block discarded – undo
87 84
      *
88 85
      * @return string|false
89 86
      **/
90
-    public function getAddress()
91
-    {
87
+    public function getAddress() {
92 88
         $this->getRaw();
93 89
         if (!empty($this->raw->asXML())) {
94 90
             return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0];
@@ -103,8 +99,7 @@  discard block
 block discarded – undo
103 99
      *
104 100
      * @return string|false
105 101
      **/
106
-    public function getFullName()
107
-    {
102
+    public function getFullName() {
108 103
         $this->getRaw();
109 104
         if (!empty($this->raw->asXML())) {
110 105
             $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text');
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
      *
123 118
      * @return void
124 119
      **/
125
-    protected function getRaw()
126
-    {
120
+    protected function getRaw() {
127 121
         $data = $this->client->getData();
128 122
         if (!isset($this->raw) && $data != false) {
129 123
             $this->raw = Helper::getXmlFileAsString($data);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var \SimpleXmlElement|false
50 50
      **/
51
-    private $raw = null;
51
+    private $raw = NULL;
52 52
 
53 53
     /**
54 54
      * Constructs client instance
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             return $data;
79 79
         } else {
80 80
             $this->logger->warning('No data found for given VIAF URL');
81
-            return false;
81
+            return FALSE;
82 82
         }
83 83
     }
84 84
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0];
95 95
         } else {
96 96
             $this->logger->warning('No address found for given VIAF URL');
97
-            return false;
97
+            return FALSE;
98 98
         }
99 99
     }
100 100
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             return $name;
114 114
         } else {
115 115
             $this->logger->warning('No name found for given VIAF URL');
116
-            return false;
116
+            return FALSE;
117 117
         }
118 118
     }
119 119
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     protected function getRaw()
126 126
     {
127 127
         $data = $this->client->getData();
128
-        if (!isset($this->raw) && $data != false) {
128
+        if (!isset($this->raw) && $data != FALSE) {
129 129
             $this->raw = Helper::getXmlFileAsString($data);
130 130
             $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#');
131 131
         }
Please login to merge, or discard this patch.
Classes/Controller/MetadataController.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             array_unshift($metadata, $data);
113 113
         }
114 114
         if (empty($metadata)) {
115
-            $this->logger->warning('No metadata found for document with UID ' . $this->document->getUid());
115
+            $this->logger->warning('No metadata found for document with UID '.$this->document->getUid());
116 116
             return '';
117 117
         }
118 118
         ksort($metadata);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                         if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) {
216 216
                             $superiorTitle = Doc::getTitle($this->document->getPartof(), true);
217 217
                             if (!empty($superiorTitle)) {
218
-                                $metadata[$i][$name] = ['[' . $superiorTitle . ']'];
218
+                                $metadata[$i][$name] = ['['.$superiorTitle.']'];
219 219
                             }
220 220
                         }
221 221
                         if (!empty($value)) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  * @subpackage dlf
30 30
  * @access public
31 31
  */
32
-class MetadataController extends AbstractController
33
-{
32
+class MetadataController extends AbstractController {
34 33
     /**
35 34
      * @var CollectionRepository
36 35
      */
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
     /**
40 39
      * @param CollectionRepository $collectionRepository
41 40
      */
42
-    public function injectCollectionRepository(CollectionRepository $collectionRepository)
43
-    {
41
+    public function injectCollectionRepository(CollectionRepository $collectionRepository) {
44 42
         $this->collectionRepository = $collectionRepository;
45 43
     }
46 44
 
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
     /**
53 51
      * @param MetadataRepository $metadataRepository
54 52
      */
55
-    public function injectMetadataRepository(MetadataRepository $metadataRepository)
56
-    {
53
+    public function injectMetadataRepository(MetadataRepository $metadataRepository) {
57 54
         $this->metadataRepository = $metadataRepository;
58 55
     }
59 56
 
@@ -65,16 +62,14 @@  discard block
 block discarded – undo
65 62
     /**
66 63
      * @param StructureRepository $structureRepository
67 64
      */
68
-    public function injectStructureRepository(StructureRepository $structureRepository)
69
-    {
65
+    public function injectStructureRepository(StructureRepository $structureRepository) {
70 66
         $this->structureRepository = $structureRepository;
71 67
     }
72 68
 
73 69
     /**
74 70
      * @return string|void
75 71
      */
76
-    public function mainAction()
77
-    {
72
+    public function mainAction() {
78 73
         $this->cObj = $this->configurationManager->getContentObject();
79 74
 
80 75
         // Load current document.
@@ -130,8 +125,7 @@  discard block
 block discarded – undo
130 125
      *
131 126
      * @return string The metadata array ready for output
132 127
      */
133
-    protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false)
134
-    {
128
+    protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) {
135 129
         if ($useOriginalIiifManifestMetadata) {
136 130
             $iiifData = [];
137 131
             foreach ($metadata as $row) {
@@ -269,8 +263,7 @@  discard block
 block discarded – undo
269 263
                     }
270 264
 
271 265
                     if (is_array($metadata[$i][$name])) {
272
-                        $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue)
273
-                        {
266
+                        $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) {
274 267
                             return !empty($metadataValue);
275 268
                         }));
276 269
                     }
@@ -294,8 +287,7 @@  discard block
 block discarded – undo
294 287
      *
295 288
      * @return array metadata
296 289
      */
297
-    private function getMetadata()
298
-    {
290
+    private function getMetadata() {
299 291
         $metadata = [];
300 292
         if ($this->settings['rootline'] < 2) {
301 293
             // Get current structure's @ID.
@@ -333,8 +325,7 @@  discard block
 block discarded – undo
333 325
      *
334 326
      * @return array metadata
335 327
      */
336
-    private function getMetadataForIds($id, $metadata)
337
-    {
328
+    private function getMetadataForIds($id, $metadata) {
338 329
         $useOriginalIiifManifestMetadata = $this->settings['originalIiifMetadata'] == 1 && $this->document->getDoc() instanceof IiifManifest;
339 330
         foreach ($id as $sid) {
340 331
             if ($useOriginalIiifManifestMetadata) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
         // Load current document.
81 81
         $this->loadDocument($this->requestData);
82 82
         if (
83
-            $this->document === null
84
-            || $this->document->getDoc() === null
83
+            $this->document === NULL
84
+            || $this->document->getDoc() === NULL
85 85
         ) {
86 86
             // Quit without doing anything if required variables are not set.
87 87
             return '';
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return string The metadata array ready for output
132 132
      */
133
-    protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false)
133
+    protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = FALSE)
134 134
     {
135 135
         if ($useOriginalIiifManifestMetadata) {
136 136
             $iiifData = [];
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
                             $iiifData[$key] = [
149 149
                                 'label' => $key,
150 150
                                 'value' => $group,
151
-                                'buildUrl' => true,
151
+                                'buildUrl' => TRUE,
152 152
                             ];
153 153
                         } else {
154 154
                             // Data output
155 155
                             $iiifData[$key] = [
156 156
                                 'label' => $key,
157 157
                                 'value' => $group,
158
-                                'buildUrl' => false,
158
+                                'buildUrl' => FALSE,
159 159
                             ];
160 160
                         }
161 161
                     } else {
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
                                 $iiifData[$key]['data'][] = [
173 173
                                     'label' => $nolabel ? '' : $label,
174 174
                                     'value' => $value,
175
-                                    'buildUrl' => true,
175
+                                    'buildUrl' => TRUE,
176 176
                                 ];
177 177
                             } else {
178 178
                                 $iiifData[$key]['data'][] = [
179 179
                                     'label' => $label,
180 180
                                     'value' => $value,
181
-                                    'buildUrl' => false,
181
+                                    'buildUrl' => FALSE,
182 182
                                 ];
183 183
                             }
184 184
                         }
185 185
                     }
186
-                    $this->view->assign('useIiif', true);
186
+                    $this->view->assign('useIiif', TRUE);
187 187
                     $this->view->assign('iiifData', $iiifData);
188 188
                 }
189 189
             }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                     if ($name == 'title') {
214 214
                         // Get title of parent document if needed.
215 215
                         if (empty(implode('', $value)) && $this->settings['getTitle'] && $this->document->getPartof()) {
216
-                            $superiorTitle = Doc::getTitle($this->document->getPartof(), true);
216
+                            $superiorTitle = Doc::getTitle($this->document->getPartof(), TRUE);
217 217
                             if (!empty($superiorTitle)) {
218 218
                                 $metadata[$i][$name] = ['[' . $superiorTitle . ']'];
219 219
                             }
Please login to merge, or discard this patch.
Classes/Common/MetsDocument.php 1 patch
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
  * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
51 51
  * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available
52 52
  */
53
-final class MetsDocument extends Doc
54
-{
53
+final class MetsDocument extends Doc {
55 54
     /**
56 55
      * Subsections / tags that may occur within `<mets:amdSec>`.
57 56
      *
@@ -176,8 +175,7 @@  discard block
 block discarded – undo
176 175
      *
177 176
      * @return  void
178 177
      */
179
-    public function addMetadataFromMets(&$metadata, $id)
180
-    {
178
+    public function addMetadataFromMets(&$metadata, $id) {
181 179
         $details = $this->getLogicalStructure($id);
182 180
         if (!empty($details)) {
183 181
             $metadata['mets_order'][0] = $details['order'];
@@ -191,8 +189,7 @@  discard block
 block discarded – undo
191 189
      * {@inheritDoc}
192 190
      * @see \Kitodo\Dlf\Common\Doc::establishRecordId()
193 191
      */
194
-    protected function establishRecordId($pid)
195
-    {
192
+    protected function establishRecordId($pid) {
196 193
         // Check for METS object @ID.
197 194
         if (!empty($this->mets['OBJID'])) {
198 195
             $this->recordId = (string) $this->mets['OBJID'];
@@ -212,8 +209,7 @@  discard block
 block discarded – undo
212 209
      * {@inheritDoc}
213 210
      * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation()
214 211
      */
215
-    public function getDownloadLocation($id)
216
-    {
212
+    public function getDownloadLocation($id) {
217 213
         $fileMimeType = $this->getFileMimeType($id);
218 214
         $fileLocation = $this->getFileLocation($id);
219 215
         if ($fileMimeType === 'application/vnd.kitodo.iiif') {
@@ -238,8 +234,7 @@  discard block
 block discarded – undo
238 234
      * {@inheritDoc}
239 235
      * @see \Kitodo\Dlf\Common\Doc::getFileLocation()
240 236
      */
241
-    public function getFileLocation($id)
242
-    {
237
+    public function getFileLocation($id) {
243 238
         $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]');
244 239
         if (
245 240
             !empty($id)
@@ -256,8 +251,7 @@  discard block
 block discarded – undo
256 251
      * {@inheritDoc}
257 252
      * @see \Kitodo\Dlf\Common\Doc::getFileMimeType()
258 253
      */
259
-    public function getFileMimeType($id)
260
-    {
254
+    public function getFileMimeType($id) {
261 255
         $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE');
262 256
         if (
263 257
             !empty($id)
@@ -274,8 +268,7 @@  discard block
 block discarded – undo
274 268
      * {@inheritDoc}
275 269
      * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
276 270
      */
277
-    public function getLogicalStructure($id, $recursive = false)
278
-    {
271
+    public function getLogicalStructure($id, $recursive = false) {
279 272
         $details = [];
280 273
         // Is the requested logical unit already loaded?
281 274
         if (
@@ -315,8 +308,7 @@  discard block
 block discarded – undo
315 308
      *
316 309
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
317 310
      */
318
-    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false)
319
-    {
311
+    protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) {
320 312
         // Get attributes.
321 313
         foreach ($structure->attributes() as $attribute => $value) {
322 314
             $attributes[$attribute] = (string) $value;
@@ -420,8 +412,7 @@  discard block
 block discarded – undo
420 412
      * {@inheritDoc}
421 413
      * @see \Kitodo\Dlf\Common\Doc::getMetadata()
422 414
      */
423
-    public function getMetadata($id, $cPid = 0)
424
-    {
415
+    public function getMetadata($id, $cPid = 0) {
425 416
         // Make sure $cPid is a non-negative integer.
426 417
         $cPid = max(intval($cPid), 0);
427 418
         // If $cPid is not given, try to get it elsewhere.
@@ -675,8 +666,7 @@  discard block
 block discarded – undo
675 666
      * @param string $id: The "@ID" attribute of the file node
676 667
      * @return void
677 668
      */
678
-    protected function getMetadataIds($id)
679
-    {
669
+    protected function getMetadataIds($id) {
680 670
         // Load amdSecChildIds concordance
681 671
         $this->_getMdSec();
682 672
         $this->_getFileInfos();
@@ -723,8 +713,7 @@  discard block
 block discarded – undo
723 713
      * {@inheritDoc}
724 714
      * @see \Kitodo\Dlf\Common\Doc::getFullText()
725 715
      */
726
-    public function getFullText($id)
727
-    {
716
+    public function getFullText($id) {
728 717
         $fullText = '';
729 718
 
730 719
         // Load fileGrps and check for full text files.
@@ -739,8 +728,7 @@  discard block
 block discarded – undo
739 728
      * {@inheritDoc}
740 729
      * @see Doc::getStructureDepth()
741 730
      */
742
-    public function getStructureDepth($logId)
743
-    {
731
+    public function getStructureDepth($logId) {
744 732
         $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
745 733
         if (!empty($ancestors)) {
746 734
             return count($ancestors);
@@ -753,8 +741,7 @@  discard block
 block discarded – undo
753 741
      * {@inheritDoc}
754 742
      * @see \Kitodo\Dlf\Common\Doc::init()
755 743
      */
756
-    protected function init($location)
757
-    {
744
+    protected function init($location) {
758 745
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this));
759 746
         // Get METS node from XML file.
760 747
         $this->registerNamespaces($this->xml);
@@ -778,8 +765,7 @@  discard block
 block discarded – undo
778 765
      * {@inheritDoc}
779 766
      * @see \Kitodo\Dlf\Common\Doc::loadLocation()
780 767
      */
781
-    protected function loadLocation($location)
782
-    {
768
+    protected function loadLocation($location) {
783 769
         $fileResource = Helper::getUrl($location);
784 770
         if ($fileResource !== false) {
785 771
             $xml = Helper::getXmlFileAsString($fileResource);
@@ -797,8 +783,7 @@  discard block
 block discarded – undo
797 783
      * {@inheritDoc}
798 784
      * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet()
799 785
      */
800
-    protected function ensureHasFulltextIsSet()
801
-    {
786
+    protected function ensureHasFulltextIsSet() {
802 787
         // Are the fileGrps already loaded?
803 788
         if (!$this->fileGrpsLoaded) {
804 789
             $this->_getFileGrps();
@@ -809,8 +794,7 @@  discard block
 block discarded – undo
809 794
      * {@inheritDoc}
810 795
      * @see Doc::setPreloadedDocument()
811 796
      */
812
-    protected function setPreloadedDocument($preloadedDocument)
813
-    {
797
+    protected function setPreloadedDocument($preloadedDocument) {
814 798
 
815 799
         if ($preloadedDocument instanceof \SimpleXMLElement) {
816 800
             $this->xml = $preloadedDocument;
@@ -823,8 +807,7 @@  discard block
 block discarded – undo
823 807
      * {@inheritDoc}
824 808
      * @see Doc::getDocument()
825 809
      */
826
-    protected function getDocument()
827
-    {
810
+    protected function getDocument() {
828 811
         return $this->mets;
829 812
     }
830 813
 
@@ -835,8 +818,7 @@  discard block
 block discarded – undo
835 818
      *
836 819
      * @return array Array of metadata sections with their IDs as array key
837 820
      */
838
-    protected function _getMdSec()
839
-    {
821
+    protected function _getMdSec() {
840 822
         if (!$this->mdSecLoaded) {
841 823
             $this->loadFormats();
842 824
 
@@ -878,8 +860,7 @@  discard block
 block discarded – undo
878 860
         return $this->mdSec;
879 861
     }
880 862
 
881
-    protected function _getDmdSec()
882
-    {
863
+    protected function _getDmdSec() {
883 864
         $this->_getMdSec();
884 865
         return $this->dmdSec;
885 866
     }
@@ -893,8 +874,7 @@  discard block
 block discarded – undo
893 874
      *
894 875
      * @return array|null The processed metadata section
895 876
      */
896
-    protected function processMdSec($element)
897
-    {
877
+    protected function processMdSec($element) {
898 878
         $mdId = (string) $element->attributes()->ID;
899 879
         if (empty($mdId)) {
900 880
             return null;
@@ -934,8 +914,7 @@  discard block
 block discarded – undo
934 914
      *
935 915
      * @return array Array of file use groups with file IDs
936 916
      */
937
-    protected function _getFileGrps()
938
-    {
917
+    protected function _getFileGrps() {
939 918
         if (!$this->fileGrpsLoaded) {
940 919
             // Get configured USE attributes.
941 920
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -987,8 +966,7 @@  discard block
 block discarded – undo
987 966
      * @access protected
988 967
      * @return array
989 968
      */
990
-    protected function _getFileInfos()
991
-    {
969
+    protected function _getFileInfos() {
992 970
         $this->_getFileGrps();
993 971
         return $this->fileInfos;
994 972
     }
@@ -997,8 +975,7 @@  discard block
 block discarded – undo
997 975
      * {@inheritDoc}
998 976
      * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
999 977
      */
1000
-    protected function prepareMetadataArray($cPid)
1001
-    {
978
+    protected function prepareMetadataArray($cPid) {
1002 979
         $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID');
1003 980
         // Get all logical structure nodes with metadata.
1004 981
         if (!empty($ids)) {
@@ -1016,8 +993,7 @@  discard block
 block discarded – undo
1016 993
      *
1017 994
      * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object
1018 995
      */
1019
-    protected function _getMets()
1020
-    {
996
+    protected function _getMets() {
1021 997
         return $this->mets;
1022 998
     }
1023 999
 
@@ -1025,8 +1001,7 @@  discard block
 block discarded – undo
1025 1001
      * {@inheritDoc}
1026 1002
      * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure()
1027 1003
      */
1028
-    protected function _getPhysicalStructure()
1029
-    {
1004
+    protected function _getPhysicalStructure() {
1030 1005
         // Is there no physical structure array yet?
1031 1006
         if (!$this->physicalStructureLoaded) {
1032 1007
             // Does the document have a structMap node of type "PHYSICAL"?
@@ -1088,8 +1063,7 @@  discard block
 block discarded – undo
1088 1063
      * {@inheritDoc}
1089 1064
      * @see \Kitodo\Dlf\Common\Doc::_getSmLinks()
1090 1065
      */
1091
-    protected function _getSmLinks()
1092
-    {
1066
+    protected function _getSmLinks() {
1093 1067
         if (!$this->smLinksLoaded) {
1094 1068
             $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink');
1095 1069
             if (!empty($smLinks)) {
@@ -1107,8 +1081,7 @@  discard block
 block discarded – undo
1107 1081
      * {@inheritDoc}
1108 1082
      * @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
1109 1083
      */
1110
-    protected function _getThumbnail($forceReload = false)
1111
-    {
1084
+    protected function _getThumbnail($forceReload = false) {
1112 1085
         if (
1113 1086
             !$this->thumbnailLoaded
1114 1087
             || $forceReload
@@ -1187,8 +1160,7 @@  discard block
 block discarded – undo
1187 1160
      * {@inheritDoc}
1188 1161
      * @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
1189 1162
      */
1190
-    protected function _getToplevelId()
1191
-    {
1163
+    protected function _getToplevelId() {
1192 1164
         if (empty($this->toplevelId)) {
1193 1165
             // Get all logical structure nodes with metadata, but without associated METS-Pointers.
1194 1166
             $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]');
@@ -1217,8 +1189,7 @@  discard block
 block discarded – undo
1217 1189
      *
1218 1190
      * @return string|null
1219 1191
      */
1220
-    public function _getParentHref()
1221
-    {
1192
+    public function _getParentHref() {
1222 1193
         if ($this->parentHref === null) {
1223 1194
             $this->parentHref = '';
1224 1195
 
@@ -1240,8 +1211,7 @@  discard block
 block discarded – undo
1240 1211
      *
1241 1212
      * @return array Properties to be serialized
1242 1213
      */
1243
-    public function __sleep()
1244
-    {
1214
+    public function __sleep() {
1245 1215
         // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization
1246 1216
         $this->asXML = $this->xml->asXML();
1247 1217
         return ['uid', 'pid', 'recordId', 'parentId', 'asXML'];
@@ -1254,8 +1224,7 @@  discard block
 block discarded – undo
1254 1224
      *
1255 1225
      * @return string String representing the METS object
1256 1226
      */
1257
-    public function __toString()
1258
-    {
1227
+    public function __toString() {
1259 1228
         $xml = new \DOMDocument('1.0', 'utf-8');
1260 1229
         $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true));
1261 1230
         $xml->formatOutput = true;
@@ -1270,8 +1239,7 @@  discard block
 block discarded – undo
1270 1239
      *
1271 1240
      * @return void
1272 1241
      */
1273
-    public function __wakeup()
1274
-    {
1242
+    public function __wakeup() {
1275 1243
         $xml = Helper::getXmlFileAsString($this->asXML);
1276 1244
         if ($xml !== false) {
1277 1245
             $this->asXML = '';
Please login to merge, or discard this patch.
Classes/Controller/TableOfContentsController.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
  * @subpackage dlf
25 25
  * @access public
26 26
  */
27
-class TableOfContentsController extends AbstractController
28
-{
27
+class TableOfContentsController extends AbstractController {
29 28
     /**
30 29
      * This holds the active entries according to the currently selected page
31 30
      *
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
      *
40 39
      * @return void
41 40
      */
42
-    public function mainAction()
43
-    {
41
+    public function mainAction() {
44 42
         // Load current document.
45 43
         $this->loadDocument($this->requestData);
46 44
         if (
@@ -66,8 +64,7 @@  discard block
 block discarded – undo
66 64
      * @access protected
67 65
      * @return array HMENU array
68 66
      */
69
-    protected function makeMenuArray()
70
-    {
67
+    protected function makeMenuArray() {
71 68
         // Set default values for page if not set.
72 69
         // $this->requestData['page'] may be integer or string (physical structure @ID)
73 70
         if (
@@ -143,8 +140,7 @@  discard block
 block discarded – undo
143 140
      *
144 141
      * @return array HMENU array for menu entry
145 142
      */
146
-    protected function getMenuEntry(array $entry, $recursive = false)
147
-    {
143
+    protected function getMenuEntry(array $entry, $recursive = false) {
148 144
         $entry = $this->resolveMenuEntry($entry);
149 145
 
150 146
         $entryArray = [];
@@ -238,8 +234,7 @@  discard block
 block discarded – undo
238 234
      * @param array $entry
239 235
      * @return array
240 236
      */
241
-    protected function resolveMenuEntry($entry)
242
-    {
237
+    protected function resolveMenuEntry($entry) {
243 238
         // If the menu entry points to the parent document,
244 239
         // resolve to the parent UID set on indexation.
245 240
         $doc = $this->document->getDoc();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         // Load current document.
45 45
         $this->loadDocument($this->requestData);
46 46
         if (
47
-            $this->document === null
48
-            || $this->document->getDoc() === null
47
+            $this->document === NULL
48
+            || $this->document->getDoc() === NULL
49 49
         ) {
50 50
             // Quit without doing anything if required variables are not set.
51 51
             return;
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
             }
103 103
             // Go through table of contents and create all menu entries.
104 104
             foreach ($this->document->getDoc()->tableOfContents as $entry) {
105
-                $menuArray[] = $this->getMenuEntry($entry, true);
105
+                $menuArray[] = $this->getMenuEntry($entry, TRUE);
106 106
             }
107 107
         } else {
108 108
             // Go through table of contents and create top-level menu entries.
109 109
             foreach ($this->document->getDoc()->tableOfContents as $entry) {
110
-                $menuArray[] = $this->getMenuEntry($entry, false);
110
+                $menuArray[] = $this->getMenuEntry($entry, FALSE);
111 111
             }
112 112
             // Build table of contents from database.
113 113
             $result = $this->documentRepository->getTableOfContentsFromDb($this->document->getUid(), $this->document->getPid(), $this->settings);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                         'pagination' => '',
127 127
                         'targetUid' => $resArray['uid']
128 128
                     ];
129
-                    $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, false);
129
+                    $menuArray[0]['_SUB_MENU'][] = $this->getMenuEntry($entry, FALSE);
130 130
                 }
131 131
             }
132 132
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @return array HMENU array for menu entry
145 145
      */
146
-    protected function getMenuEntry(array $entry, $recursive = false)
146
+    protected function getMenuEntry(array $entry, $recursive = FALSE)
147 147
     {
148 148
         $entry = $this->resolveMenuEntry($entry);
149 149
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         }
202 202
         // Build sub-menu if available and called recursively.
203 203
         if (
204
-            $recursive === true
204
+            $recursive === TRUE
205 205
             && !empty($entry['children'])
206 206
         ) {
207 207
             // Build sub-menu only if one of the following conditions apply:
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                     if (in_array($child['id'], $this->activeEntries)) {
220 220
                         $entryArray['ITEM_STATE'] = 'ACT';
221 221
                     }
222
-                    $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, true);
222
+                    $entryArray['_SUB_MENU'][] = $this->getMenuEntry($child, TRUE);
223 223
                 }
224 224
             }
225 225
             // Append "IFSUB" to "ITEM_STATE" if this entry has sub-entries.
Please login to merge, or discard this patch.