Passed
Pull Request — master (#91)
by Alexander
02:40
created
Classes/Common/Helper.php 3 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
137 137
                     return false;
138 138
                 } elseif ($checksum == 10) {
139
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
139
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
140 140
                 } elseif (substr($id, -1, 1) != $checksum) {
141 141
                     return false;
142 142
                 }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
279 279
         // Merge initialisation vector and encrypted data.
280 280
         if ($encrypted !== false) {
281
-            $encrypted = base64_encode($iv . $encrypted);
281
+            $encrypted = base64_encode($iv.$encrypted);
282 282
         }
283 283
         return $encrypted;
284 284
     }
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
     public static function getHookObjects($scriptRelPath)
333 333
     {
334 334
         $hookObjects = [];
335
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
336
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
335
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
336
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
337 337
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
338 338
             }
339 339
         }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             !$uid
360 360
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
361 361
         ) {
362
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
362
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
363 363
             return '';
364 364
         }
365 365
 
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
         // Should we check for a specific PID, too?
371 371
         if ($pid !== -1) {
372 372
             $pid = max(intval($pid), 0);
373
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
373
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
374 374
         }
375 375
 
376 376
         // Get index_name from database.
377 377
         $result = $queryBuilder
378
-            ->select($table . '.index_name AS index_name')
378
+            ->select($table.'.index_name AS index_name')
379 379
             ->from($table)
380 380
             ->where(
381
-                $queryBuilder->expr()->eq($table . '.uid', $uid),
381
+                $queryBuilder->expr()->eq($table.'.uid', $uid),
382 382
                 $where,
383 383
                 self::whereExpression($table)
384 384
             )
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         if ($resArray = $result->fetch()) {
389 389
             return $resArray['index_name'];
390 390
         } else {
391
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
391
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
392 392
             return '';
393 393
         }
394 394
     }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
             !$uid
413 413
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
414 414
         ) {
415
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
415
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
416 416
             return '';
417 417
         }
418 418
 
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
         // Should we check for a specific PID, too?
424 424
         if ($pid !== -1) {
425 425
             $pid = max(intval($pid), 0);
426
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
426
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
427 427
         }
428 428
 
429 429
         // Get label from database.
430 430
         $result = $queryBuilder
431
-            ->select($table . '.label AS label')
431
+            ->select($table.'.label AS label')
432 432
             ->from($table)
433 433
             ->where(
434
-                $queryBuilder->expr()->eq($table . '.uid', $uid),
434
+                $queryBuilder->expr()->eq($table.'.uid', $uid),
435 435
                 $where,
436 436
                 self::whereExpression($table)
437 437
             )
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         if ($resArray = $result->fetch()) {
442 442
             return $resArray['label'];
443 443
         } else {
444
-            self::log('No "label" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
444
+            self::log('No "label" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
445 445
             return '';
446 446
         }
447 447
     }
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
         // Analyze code and set appropriate ISO table.
461 461
         $isoCode = strtolower(trim($code));
462 462
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
463
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml';
463
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml';
464 464
         } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
465
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml';
465
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml';
466 466
         } else {
467 467
             // No ISO code, return unchanged.
468 468
             return $code;
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
                 $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639);
480 480
             }
481 481
         } else {
482
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
482
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
483 483
             return $code;
484 484
         }
485 485
         if (!empty($lang)) {
486 486
             return $lang;
487 487
         } else {
488
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
488
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
489 489
             return $code;
490 490
         }
491 491
     }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
             } elseif (\TYPO3_MODE === 'BE') {
514 514
                 self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true);
515 515
             } else {
516
-                self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
516
+                self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
517 517
             }
518 518
         }
519 519
         // Get translation.
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             } elseif (\TYPO3_MODE === 'BE') {
524 524
                 $translated = $GLOBALS['LANG']->getLLL($key, self::$messages);
525 525
             } else {
526
-                self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
526
+                self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
527 527
             }
528 528
         }
529 529
         // Escape HTML characters if applicable.
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             !$index_name
551 551
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
552 552
         ) {
553
-            self::log('Invalid UID ' . $index_name . ' or table "' . $table . '"', LOG_SEVERITY_ERROR);
553
+            self::log('Invalid UID '.$index_name.' or table "'.$table.'"', LOG_SEVERITY_ERROR);
554 554
             return '';
555 555
         }
556 556
 
@@ -561,14 +561,14 @@  discard block
 block discarded – undo
561 561
         // Should we check for a specific PID, too?
562 562
         if ($pid !== -1) {
563 563
             $pid = max(intval($pid), 0);
564
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
564
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
565 565
         }
566 566
         // Get index_name from database.
567 567
         $result = $queryBuilder
568
-            ->select($table . '.uid AS uid')
568
+            ->select($table.'.uid AS uid')
569 569
             ->from($table)
570 570
             ->where(
571
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
571
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
572 572
                 $where,
573 573
                 self::whereExpression($table)
574 574
             )
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         if (count($allResults) == 1) {
581 581
             return $allResults[0]['uid'];
582 582
         } else {
583
-            self::log('No UID for given index_name "' . $index_name . '" and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
583
+            self::log('No UID for given index_name "'.$index_name.'" and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
584 584
             return '';
585 585
         }
586 586
     }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             '-' => 39,
639 639
             ':' => 17,
640 640
         ];
641
-        $urn = strtolower($base . $id);
641
+        $urn = strtolower($base.$id);
642 642
         if (preg_match('/[^a-z0-9:-]/', $urn)) {
643 643
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
644 644
             return '';
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
653 653
         }
654 654
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
655
-        return $base . $id . $checksum;
655
+        return $base.$id.$checksum;
656 656
     }
657 657
 
658 658
     /**
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
         // Cast to string for security reasons.
684 684
         $key = (string) $key;
685 685
         if (!$key) {
686
-            self::log('Invalid key "' . $key . '" for session data retrieval', LOG_SEVERITY_WARNING);
686
+            self::log('Invalid key "'.$key.'" for session data retrieval', LOG_SEVERITY_WARNING);
687 687
             return;
688 688
         }
689 689
         // Get the session data.
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
         } elseif (\TYPO3_MODE === 'BE') {
693 693
             return $GLOBALS['BE_USER']->getSessionData($key);
694 694
         } else {
695
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
695
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
696 696
             return;
697 697
         }
698 698
     }
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
         // Cast to string for security reasons.
802 802
         $key = (string) $key;
803 803
         if (!$key) {
804
-            self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING);
804
+            self::log('Invalid key "'.$key.'" for session data saving', LOG_SEVERITY_WARNING);
805 805
             return false;
806 806
         }
807 807
         // Save value in session data.
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
             $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
814 814
             return true;
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 false;
818 818
         }
819 819
     }
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         // Sanitize input.
837 837
         $pid = max(intval($pid), 0);
838 838
         if (!$pid) {
839
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
839
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
840 840
             return $index_name;
841 841
         }
842 842
         // Check if "index_name" is an UID.
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
         // First fetch the uid of the received index_name
854 854
         $result = $queryBuilder
855 855
             ->select(
856
-                $table . '.uid AS uid',
857
-                $table . '.l18n_parent AS l18n_parent'
856
+                $table.'.uid AS uid',
857
+                $table.'.l18n_parent AS l18n_parent'
858 858
             )
859 859
             ->from($table)
860 860
             ->where(
861
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
862
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
861
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
862
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
863 863
                 self::whereExpression($table, true)
864 864
             )
865 865
             ->setMaxResults(1)
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
             $resArray = $allResults[0];
873 873
 
874 874
             $result = $queryBuilder
875
-                ->select($table . '.index_name AS index_name')
875
+                ->select($table.'.index_name AS index_name')
876 876
                 ->from($table)
877 877
                 ->where(
878
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
879
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
880
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)),
878
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
879
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
880
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)),
881 881
                     self::whereExpression($table, true)
882 882
                 )
883 883
                 ->setMaxResults(1)
@@ -895,14 +895,14 @@  discard block
 block discarded – undo
895 895
         if (empty($labels[$table][$pid][$GLOBALS['TSFE']->sys_language_content][$index_name])) {
896 896
             // Check if this table is allowed for translation.
897 897
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
898
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
898
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
899 899
                 if ($GLOBALS['TSFE']->sys_language_content > 0) {
900 900
                     $additionalWhere = $queryBuilder->expr()->andX(
901 901
                         $queryBuilder->expr()->orX(
902
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
903
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content))
902
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
903
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content))
904 904
                         ),
905
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
905
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
906 906
                     );
907 907
                 }
908 908
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
                     ->select('*')
912 912
                     ->from($table)
913 913
                     ->where(
914
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
914
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
915 915
                         $additionalWhere,
916 916
                         self::whereExpression($table, true)
917 917
                     )
@@ -929,10 +929,10 @@  discard block
 block discarded – undo
929 929
                         }
930 930
                     }
931 931
                 } else {
932
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
932
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
933 933
                 }
934 934
             } else {
935
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
935
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
936 936
             }
937 937
         }
938 938
 
@@ -971,9 +971,9 @@  discard block
 block discarded – undo
971 971
             return GeneralUtility::makeInstance(ConnectionPool::class)
972 972
                 ->getQueryBuilderForTable($table)
973 973
                 ->expr()
974
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
974
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
975 975
         } else {
976
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
976
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
977 977
             return '1=-1';
978 978
         }
979 979
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
76 76
      */
77
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
77
+    public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages')
78 78
     {
79 79
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
80 80
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
                     $checksum = 'X';
117 117
                 }
118 118
                 if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) {
119
-                    return false;
119
+                    return FALSE;
120 120
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
121
-                    return false;
121
+                    return FALSE;
122 122
                 }
123 123
                 break;
124 124
             case 'ZDB':
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
                     $checksum = 'X';
127 127
                 }
128 128
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
129
-                    return false;
129
+                    return FALSE;
130 130
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
131
-                    return false;
131
+                    return FALSE;
132 132
                 }
133 133
                 break;
134 134
             case 'SWD':
135 135
                 $checksum = 11 - $checksum;
136 136
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
137
-                    return false;
137
+                    return FALSE;
138 138
                 } elseif ($checksum == 10) {
139 139
                     return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
140 140
                 } elseif (substr($id, -1, 1) != $checksum) {
141
-                    return false;
141
+                    return FALSE;
142 142
                 }
143 143
                 break;
144 144
             case 'GKD':
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
                     $checksum = 'X';
148 148
                 }
149 149
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
150
-                    return false;
150
+                    return FALSE;
151 151
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
152
-                    return false;
152
+                    return FALSE;
153 153
                 }
154 154
                 break;
155 155
         }
156
-        return true;
156
+        return TRUE;
157 157
     }
158 158
 
159 159
     /**
@@ -168,28 +168,28 @@  discard block
 block discarded – undo
168 168
     public static function decrypt($encrypted)
169 169
     {
170 170
         if (
171
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
172
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
171
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
172
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
173 173
         ) {
174 174
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
175
-            return false;
175
+            return FALSE;
176 176
         }
177 177
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
178 178
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
179
-            return false;
179
+            return FALSE;
180 180
         }
181 181
         if (
182 182
             empty($encrypted)
183 183
             || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm)
184 184
         ) {
185 185
             self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR);
186
-            return false;
186
+            return FALSE;
187 187
         }
188 188
         // Split initialisation vector and encrypted data.
189 189
         $binary = base64_decode($encrypted);
190 190
         $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm));
191 191
         $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm));
192
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
192
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
193 193
         // Decrypt data.
194 194
         $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
195 195
         return $decrypted;
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
     public static function getXmlFileAsString($content)
208 208
     {
209 209
         // Turn off libxml's error logging.
210
-        $libxmlErrors = libxml_use_internal_errors(true);
210
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
211 211
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
212
-        $previousValueOfEntityLoader = libxml_disable_entity_loader(true);
212
+        $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
213 213
         // Try to load XML from file.
214 214
         $xml = simplexml_load_string($content);
215 215
         // reset entity loader setting
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public static function digest($string)
266 266
     {
267
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
267
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
268 268
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
269
-            return false;
269
+            return FALSE;
270 270
         }
271 271
         // Hash string.
272 272
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -285,23 +285,23 @@  discard block
 block discarded – undo
285 285
     public static function encrypt($string)
286 286
     {
287 287
         if (
288
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
289
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
288
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
289
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
290 290
         ) {
291 291
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
292
-            return false;
292
+            return FALSE;
293 293
         }
294 294
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
295 295
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
296
-            return false;
296
+            return FALSE;
297 297
         }
298 298
         // Generate random initialisation vector.
299 299
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
300
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
300
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
301 301
         // Encrypt data.
302 302
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
303 303
         // Merge initialisation vector and encrypted data.
304
-        if ($encrypted !== false) {
304
+        if ($encrypted !== FALSE) {
305 305
             $encrypted = base64_encode($iv . $encrypted);
306 306
         }
307 307
         return $encrypted;
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                 $lang = $GLOBALS['TSFE']->getLLL($isoCode, $iso639);
499 499
             }
500 500
         } elseif (\TYPO3_MODE === 'BE') {
501
-            $iso639 = $GLOBALS['LANG']->includeLLFile($file, false, true);
501
+            $iso639 = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
502 502
             if (!empty($iso639['default'][$isoCode])) {
503 503
                 $lang = $GLOBALS['LANG']->getLLL($isoCode, $iso639);
504 504
             }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
      *
526 526
      * @return string The translated string or the given key on failure
527 527
      */
528
-    public static function getMessage($key, $hsc = false, $default = '')
528
+    public static function getMessage($key, $hsc = FALSE, $default = '')
529 529
     {
530 530
         // Set initial output to default value.
531 531
         $translated = (string) $default;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
             if (\TYPO3_MODE === 'FE') {
536 536
                 self::$messages = $GLOBALS['TSFE']->readLLfile($file);
537 537
             } elseif (\TYPO3_MODE === 'BE') {
538
-                self::$messages = $GLOBALS['LANG']->includeLLFile($file, false, true);
538
+                self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
539 539
             } else {
540 540
                 self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
541 541
             }
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
      *
736 736
      * @return array Merged array
737 737
      */
738
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
738
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
739 739
     {
740 740
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
741 741
         return $original;
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
      *
754 754
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
755 755
      */
756
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
756
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE)
757 757
     {
758 758
         if (
759 759
             \TYPO3_MODE === 'BE'
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
             // Instantiate TYPO3 core engine.
763 763
             $dataHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
764 764
             // We do not use workspaces and have to bypass restrictions in DataHandler.
765
-            $dataHandler->bypassWorkspaceRestrictions = true;
765
+            $dataHandler->bypassWorkspaceRestrictions = TRUE;
766 766
             // Load data and command arrays.
767 767
             $dataHandler->start($data, $cmd);
768 768
             // Process command map first if default order is reversed.
@@ -826,19 +826,19 @@  discard block
 block discarded – undo
826 826
         $key = (string) $key;
827 827
         if (!$key) {
828 828
             self::log('Invalid key "' . $key . '" for session data saving', LOG_SEVERITY_WARNING);
829
-            return false;
829
+            return FALSE;
830 830
         }
831 831
         // Save value in session data.
832 832
         if (\TYPO3_MODE === 'FE') {
833 833
             $GLOBALS['TSFE']->fe_user->setKey('ses', $key, $value);
834 834
             $GLOBALS['TSFE']->fe_user->storeSessionData();
835
-            return true;
835
+            return TRUE;
836 836
         } elseif (\TYPO3_MODE === 'BE') {
837 837
             $GLOBALS['BE_USER']->setAndSaveSessionData($key, $value);
838
-            return true;
838
+            return TRUE;
839 839
         } else {
840 840
             self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
841
-            return false;
841
+            return FALSE;
842 842
         }
843 843
     }
844 844
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
             ->where(
885 885
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
886 886
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
887
-                self::whereExpression($table, true)
887
+                self::whereExpression($table, TRUE)
888 888
             )
889 889
             ->setMaxResults(1)
890 890
             ->execute();
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
903 903
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
904 904
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($GLOBALS['TSFE']->sys_language_content)),
905
-                    self::whereExpression($table, true)
905
+                    self::whereExpression($table, TRUE)
906 906
                 )
907 907
                 ->setMaxResults(1)
908 908
                 ->execute();
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
                     ->where(
938 938
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
939 939
                         $additionalWhere,
940
-                        self::whereExpression($table, true)
940
+                        self::whereExpression($table, TRUE)
941 941
                     )
942 942
                     ->setMaxResults(10000)
943 943
                     ->execute();
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
      *
978 978
      * @return string Additional WHERE expression
979 979
      */
980
-    public static function whereExpression($table, $showHidden = false)
980
+    public static function whereExpression($table, $showHidden = FALSE)
981 981
     {
982 982
         if (\TYPO3_MODE === 'FE') {
983 983
             // Should we ignore the record's hidden flag?
Please login to merge, or discard this patch.
Braces   +26 added lines, -52 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 Helper
29
-{
28
+class Helper {
30 29
     /**
31 30
      * The extension key
32 31
      *
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
      *
75 74
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
76 75
      */
77
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
78
-    {
76
+    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') {
79 77
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
80 78
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
81 79
         $flashMessage = GeneralUtility::makeInstance(
@@ -100,8 +98,7 @@  discard block
 block discarded – undo
100 98
      *
101 99
      * @return bool Is $id a valid GNL identifier of the given $type?
102 100
      */
103
-    public static function checkIdentifier($id, $type)
104
-    {
101
+    public static function checkIdentifier($id, $type) {
105 102
         $digits = substr($id, 0, 8);
106 103
         $checksum = 0;
107 104
         for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
@@ -165,8 +162,7 @@  discard block
 block discarded – undo
165 162
      *
166 163
      * @return mixed The decrypted value or false on error
167 164
      */
168
-    public static function decrypt($encrypted)
169
-    {
165
+    public static function decrypt($encrypted) {
170 166
         if (
171 167
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
172 168
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -204,8 +200,7 @@  discard block
 block discarded – undo
204 200
      *
205 201
      * @return mixed
206 202
      */
207
-    public static function getXmlFileAsString($content)
208
-    {
203
+    public static function getXmlFileAsString($content) {
209 204
         // Turn off libxml's error logging.
210 205
         $libxmlErrors = libxml_use_internal_errors(true);
211 206
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
@@ -230,8 +225,7 @@  discard block
 block discarded – undo
230 225
      *
231 226
      * @return void
232 227
      */
233
-    public static function log($message, $severity = 0)
234
-    {
228
+    public static function log($message, $severity = 0) {
235 229
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class());
236 230
 
237 231
         switch ($severity) {
@@ -261,8 +255,7 @@  discard block
 block discarded – undo
261 255
      *
262 256
      * @return mixed Hashed string or false on error
263 257
      */
264
-    public static function digest($string)
265
-    {
258
+    public static function digest($string) {
266 259
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
267 260
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
268 261
             return false;
@@ -281,8 +274,7 @@  discard block
 block discarded – undo
281 274
      *
282 275
      * @return mixed Encrypted string or false on error
283 276
      */
284
-    public static function encrypt($string)
285
-    {
277
+    public static function encrypt($string) {
286 278
         if (
287 279
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
288 280
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -315,8 +307,7 @@  discard block
 block discarded – undo
315 307
      *
316 308
      * @return string The unqualified class name
317 309
      */
318
-    public static function getUnqualifiedClassName($qualifiedClassname)
319
-    {
310
+    public static function getUnqualifiedClassName($qualifiedClassname) {
320 311
         $nameParts = explode('\\', $qualifiedClassname);
321 312
         return end($nameParts);
322 313
     }
@@ -330,8 +321,7 @@  discard block
 block discarded – undo
330 321
      *
331 322
      * @return string The cleaned up string
332 323
      */
333
-    public static function getCleanString($string)
334
-    {
324
+    public static function getCleanString($string) {
335 325
         // Convert to lowercase.
336 326
         $string = strtolower($string);
337 327
         // Remove non-alphanumeric characters.
@@ -352,8 +342,7 @@  discard block
 block discarded – undo
352 342
      *
353 343
      * @return array Array of hook objects for the class
354 344
      */
355
-    public static function getHookObjects($scriptRelPath)
356
-    {
345
+    public static function getHookObjects($scriptRelPath) {
357 346
         $hookObjects = [];
358 347
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
359 348
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -374,8 +363,7 @@  discard block
 block discarded – undo
374 363
      *
375 364
      * @return string "index_name" for the given UID
376 365
      */
377
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
378
-    {
366
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
379 367
         // Sanitize input.
380 368
         $uid = max(intval($uid), 0);
381 369
         if (
@@ -427,8 +415,7 @@  discard block
 block discarded – undo
427 415
      *
428 416
      * @return string "label" for the given UID
429 417
      */
430
-    public static function getLabelFromUid($uid, $table, $pid = -1)
431
-    {
418
+    public static function getLabelFromUid($uid, $table, $pid = -1) {
432 419
         // Sanitize input.
433 420
         $uid = max(intval($uid), 0);
434 421
         if (
@@ -478,8 +465,7 @@  discard block
 block discarded – undo
478 465
      *
479 466
      * @return string Localized full name of language or unchanged input
480 467
      */
481
-    public static function getLanguageName($code)
482
-    {
468
+    public static function getLanguageName($code) {
483 469
         // Analyze code and set appropriate ISO table.
484 470
         $isoCode = strtolower(trim($code));
485 471
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -524,8 +510,7 @@  discard block
 block discarded – undo
524 510
      *
525 511
      * @return string The translated string or the given key on failure
526 512
      */
527
-    public static function getMessage($key, $hsc = false, $default = '')
528
-    {
513
+    public static function getMessage($key, $hsc = false, $default = '') {
529 514
         // Set initial output to default value.
530 515
         $translated = (string) $default;
531 516
         // Load common messages file.
@@ -567,8 +552,7 @@  discard block
 block discarded – undo
567 552
      *
568 553
      * @return string "uid" for the given index_name
569 554
      */
570
-    public static function getUidFromIndexName($index_name, $table, $pid = -1)
571
-    {
555
+    public static function getUidFromIndexName($index_name, $table, $pid = -1) {
572 556
         if (
573 557
             !$index_name
574 558
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
@@ -619,8 +603,7 @@  discard block
 block discarded – undo
619 603
      *
620 604
      * @return string Uniform Resource Name as string
621 605
      */
622
-    public static function getURN($base, $id)
623
-    {
606
+    public static function getURN($base, $id) {
624 607
         $concordance = [
625 608
             '0' => 1,
626 609
             '1' => 2,
@@ -687,8 +670,7 @@  discard block
 block discarded – undo
687 670
      *
688 671
      * @return bool Is $id a valid PPN?
689 672
      */
690
-    public static function isPPN($id)
691
-    {
673
+    public static function isPPN($id) {
692 674
         return self::checkIdentifier($id, 'PPN');
693 675
     }
694 676
 
@@ -701,8 +683,7 @@  discard block
 block discarded – undo
701 683
      *
702 684
      * @return mixed Session value for given key or null on failure
703 685
      */
704
-    public static function loadFromSession($key)
705
-    {
686
+    public static function loadFromSession($key) {
706 687
         // Cast to string for security reasons.
707 688
         $key = (string) $key;
708 689
         if (!$key) {
@@ -734,8 +715,7 @@  discard block
 block discarded – undo
734 715
      *
735 716
      * @return array Merged array
736 717
      */
737
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
738
-    {
718
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
739 719
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
740 720
         return $original;
741 721
     }
@@ -752,8 +732,7 @@  discard block
 block discarded – undo
752 732
      *
753 733
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
754 734
      */
755
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
756
-    {
735
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) {
757 736
         if (
758 737
             \TYPO3_MODE === 'BE'
759 738
             && $GLOBALS['BE_USER']->isAdmin()
@@ -799,8 +778,7 @@  discard block
 block discarded – undo
799 778
      *
800 779
      * @return string All flash messages in the queue rendered as HTML.
801 780
      */
802
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
803
-    {
781
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
804 782
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
805 783
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
806 784
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -819,8 +797,7 @@  discard block
 block discarded – undo
819 797
      *
820 798
      * @return bool true on success, false on failure
821 799
      */
822
-    public static function saveToSession($value, $key)
823
-    {
800
+    public static function saveToSession($value, $key) {
824 801
         // Cast to string for security reasons.
825 802
         $key = (string) $key;
826 803
         if (!$key) {
@@ -852,8 +829,7 @@  discard block
 block discarded – undo
852 829
      *
853 830
      * @return string Localized label for $index_name
854 831
      */
855
-    public static function translate($index_name, $table, $pid)
856
-    {
832
+    public static function translate($index_name, $table, $pid) {
857 833
         // Load labels into static variable for future use.
858 834
         static $labels = [];
859 835
         // Sanitize input.
@@ -976,8 +952,7 @@  discard block
 block discarded – undo
976 952
      *
977 953
      * @return string Additional WHERE expression
978 954
      */
979
-    public static function whereExpression($table, $showHidden = false)
980
-    {
955
+    public static function whereExpression($table, $showHidden = false) {
981 956
         if (\TYPO3_MODE === 'FE') {
982 957
             // Should we ignore the record's hidden flag?
983 958
             $ignoreHide = 0;
@@ -1006,8 +981,7 @@  discard block
 block discarded – undo
1006 981
      *
1007 982
      * @access private
1008 983
      */
1009
-    private function __construct()
1010
-    {
984
+    private function __construct() {
1011 985
         // This is a static class, thus no instances should be created.
1012 986
     }
1013 987
 }
Please login to merge, or discard this patch.
Classes/Plugin/Eid/SearchInDocument.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
      */
121 121
     private function getQuery($fields, $parameters)
122 122
     {
123
-        return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']);
123
+        return $fields['fulltext'].':('.Solr::escapeQuery((string) $parameters['q']).') AND '.$fields['uid'].':'.$this->getUid($parameters['uid']);
124 124
     }
125 125
 
126 126
     /**
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
  * @subpackage dlf
29 29
  * @access public
30 30
  */
31
-class SearchInDocument
32
-{
31
+class SearchInDocument {
33 32
     /**
34 33
      * The main method of the eID script
35 34
      *
36 35
      * @param ServerRequestInterface $request
37 36
      * @return ResponseInterface JSON response of search suggestions
38 37
      */
39
-    public function main(ServerRequestInterface $request)
40
-    {
38
+    public function main(ServerRequestInterface $request) {
41 39
         $output = [
42 40
             'documents' => [],
43 41
             'numFound' => 0
@@ -118,8 +116,7 @@  discard block
 block discarded – undo
118 116
      *
119 117
      * @return string SOLR query
120 118
      */
121
-    private function getQuery($fields, $parameters)
122
-    {
119
+    private function getQuery($fields, $parameters) {
123 120
         return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']);
124 121
     }
125 122
 
@@ -133,8 +130,7 @@  discard block
 block discarded – undo
133 130
      *
134 131
      * @return int|string uid of the document
135 132
      */
136
-    private function getUid($uid)
137
-    {
133
+    private function getUid($uid) {
138 134
         return is_numeric($uid) ? intval($uid) : $uid;
139 135
     }
140 136
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         ];
45 45
         // Get input parameters and decrypt core name.
46 46
         $parameters = $request->getParsedBody();
47
-        if ($parameters === null) {
47
+        if ($parameters === NULL) {
48 48
             throw new \InvalidArgumentException('No parameters passed!', 1632322297);
49 49
         }
50 50
         $encrypted = (string) $parameters['encrypted'];
Please login to merge, or discard this patch.
Classes/Common/DocumentList.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         if ($this->valid()) {
140 140
             return $this->getRecord($this->elements[$this->position]);
141 141
         } else {
142
-            $this->logger->notice('Invalid position "' . $this->position . '" for list element');
142
+            $this->logger->notice('Invalid position "'.$this->position.'" for list element');
143 143
             return;
144 144
         }
145 145
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
         $query = $this->solr->service->createSelect();
269 269
         // Restrict the fields to the required ones
270
-        $query->setFields($fields['uid'] . ',' . $fields['id'] . ',' . $fields['toplevel'] . ',' . $fields['thumbnail'] . ',' . $fields['page']);
270
+        $query->setFields($fields['uid'].','.$fields['id'].','.$fields['toplevel'].','.$fields['thumbnail'].','.$fields['page']);
271 271
         foreach ($this->solrConfig as $solr_name) {
272 272
             $query->addField($solr_name);
273 273
         }
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
         // Extend filter query to get all documents with the same UID.
281 281
         foreach ($filterQueries as $key => $value) {
282 282
             if (isset($value['query'])) {
283
-                $filterQuery[$key] = $value['query'] . ' OR ' . $fields['toplevel'] . ':true';
283
+                $filterQuery[$key] = $value['query'].' OR '.$fields['toplevel'].':true';
284 284
                 $filterQuery = [
285 285
                     'key' => $key,
286
-                    'query' => $value['query'] . ' OR ' . $fields['toplevel'] . ':true'
286
+                    'query' => $value['query'].' OR '.$fields['toplevel'].':true'
287 287
                 ];
288 288
                 $query->addFilterQuery($filterQuery);
289 289
             }
290 290
         }
291 291
         // Add filter query to get all documents with the required uid.
292
-        $query->createFilterQuery('uid')->setQuery($fields['uid'] . ':' . Solr::escapeQuery($record['uid']));
292
+        $query->createFilterQuery('uid')->setQuery($fields['uid'].':'.Solr::escapeQuery($record['uid']));
293 293
         // Add sorting.
294 294
         if (is_array($this->metadata['options']['params']['sort'])) {
295 295
             foreach ($this->metadata['options']['params']['sort'] as $key => $direction) {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             }
298 298
         }
299 299
         // Set query.
300
-        $query->setQuery($this->metadata['options']['select'] . ' OR ' . $fields['toplevel'] . ':true');
300
+        $query->setQuery($this->metadata['options']['select'].' OR '.$fields['toplevel'].':true');
301 301
 
302 302
         // If it is a fulltext search, enable highlighting.
303 303
         if ($this->metadata['fulltextSearch']) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
             $position < 0
406 406
             || $position >= $this->count
407 407
         ) {
408
-            $this->logger->warning('Invalid position "' . $position . '" for element moving');
408
+            $this->logger->warning('Invalid position "'.$position.'" for element moving');
409 409
             return;
410 410
         }
411 411
         $steps = intval($steps);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         if (($position + $steps) < 0
414 414
             || ($position + $steps) >= $this->count
415 415
         ) {
416
-            $this->logger->warning('Invalid steps "' . $steps . '" for moving element at position "' . $position . '"');
416
+            $this->logger->warning('Invalid steps "'.$steps.'" for moving element at position "'.$position.'"');
417 417
             return;
418 418
         }
419 419
         $element = $this->remove($position);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         if ($this->offsetExists($offset)) {
492 492
             return $this->getRecord($this->elements[$offset]);
493 493
         } else {
494
-            $this->logger->notice('Invalid offset "' . $offset . '" for list element');
494
+            $this->logger->notice('Invalid offset "'.$offset.'" for list element');
495 495
             return;
496 496
         }
497 497
     }
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
             $position < 0
536 536
             || $position >= $this->count
537 537
         ) {
538
-            $this->logger->warning('Invalid position "' . $position . '" for element removing');
538
+            $this->logger->warning('Invalid position "'.$position.'" for element removing');
539 539
             return;
540 540
         }
541 541
         $removed = array_splice($this->elements, $position, 1);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             $position < 0
561 561
             || $position >= $this->count
562 562
         ) {
563
-            $this->logger->warning('Invalid position "' . $position . '" for element removing');
563
+            $this->logger->warning('Invalid position "'.$position.'" for element removing');
564 564
             return;
565 565
         }
566 566
         $removed = array_splice($this->elements, $position, $length);
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
                     ->execute();
654 654
 
655 655
                 while ($resArray = $result->fetch()) {
656
-                    $this->solrConfig[$resArray['index_name']] = $resArray['index_name'] . '_' . ($resArray['index_tokenized'] ? 't' : 'u') . 's' . ($resArray['index_indexed'] ? 'i' : 'u');
656
+                    $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u');
657 657
                 }
658 658
                 // Add static fields.
659 659
                 $this->solrConfig['type'] = 'type';
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         foreach ($this->elements as $num => $element) {
682 682
             // Is this element sortable?
683 683
             if (!empty($element['s'][$by])) {
684
-                $newOrder[$element['s'][$by] . str_pad($num, 6, '0', STR_PAD_LEFT)] = $element;
684
+                $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element;
685 685
             } else {
686 686
                 $nonSortable[] = $element;
687 687
             }
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
      */
820 820
     public function __get($var)
821 821
     {
822
-        $method = '_get' . ucfirst($var);
822
+        $method = '_get'.ucfirst($var);
823 823
         if (
824 824
             !property_exists($this, $var)
825 825
             || !method_exists($this, $method)
826 826
         ) {
827
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
827
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
828 828
             return;
829 829
         } else {
830 830
             return $this->$method();
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
      */
858 858
     public function __set($var, $value)
859 859
     {
860
-        $method = '_set' . ucfirst($var);
860
+        $method = '_set'.ucfirst($var);
861 861
         if (
862 862
             !property_exists($this, $var)
863 863
             || !method_exists($this, $method)
864 864
         ) {
865
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
865
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
866 866
         } else {
867 867
             $this->$method($value);
868 868
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@  discard block
 block discarded – undo
104 104
      *
105 105
      * @return void
106 106
      */
107
-    public function add(array $elements, $position = -1)
108
-    {
107
+    public function add(array $elements, $position = -1) {
109 108
         $position = MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count);
110 109
         if (!empty($elements)) {
111 110
             array_splice($this->elements, $position, 0, $elements);
@@ -121,8 +120,7 @@  discard block
 block discarded – undo
121 120
      *
122 121
      * @return int The number of elements in the list
123 122
      */
124
-    public function count()
125
-    {
123
+    public function count() {
126 124
         return $this->count;
127 125
     }
128 126
 
@@ -134,8 +132,7 @@  discard block
 block discarded – undo
134 132
      *
135 133
      * @return array The current element
136 134
      */
137
-    public function current()
138
-    {
135
+    public function current() {
139 136
         if ($this->valid()) {
140 137
             return $this->getRecord($this->elements[$this->position]);
141 138
         } else {
@@ -153,8 +150,7 @@  discard block
 block discarded – undo
153 150
      *
154 151
      * @return mixed The element's full record
155 152
      */
156
-    protected function getRecord($element)
157
-    {
153
+    protected function getRecord($element) {
158 154
         if (
159 155
             is_array($element)
160 156
             && array_keys($element) == ['u', 'h', 's', 'p']
@@ -261,8 +257,7 @@  discard block
 block discarded – undo
261 257
      *
262 258
      * @return Result
263 259
      */
264
-    private function getSolrResult($record)
265
-    {
260
+    private function getSolrResult($record) {
266 261
         $fields = Solr::getFields();
267 262
 
268 263
         $query = $this->solr->service->createSelect();
@@ -334,8 +329,7 @@  discard block
 block discarded – undo
334 329
      *
335 330
      * @return array
336 331
      */
337
-    private function getSolrRecord($record, $result)
338
-    {
332
+    private function getSolrRecord($record, $result) {
339 333
         // If it is a fulltext search, fetch the highlighting results.
340 334
         if ($this->metadata['fulltextSearch']) {
341 335
             $data = $result->getData();
@@ -382,8 +376,7 @@  discard block
 block discarded – undo
382 376
      *
383 377
      * @return int The current position
384 378
      */
385
-    public function key()
386
-    {
379
+    public function key() {
387 380
         return $this->position;
388 381
     }
389 382
 
@@ -397,8 +390,7 @@  discard block
 block discarded – undo
397 390
      *
398 391
      * @return void
399 392
      */
400
-    public function move($position, $steps)
401
-    {
393
+    public function move($position, $steps) {
402 394
         $position = intval($position);
403 395
         // Check if list position is valid.
404 396
         if (
@@ -429,8 +421,7 @@  discard block
 block discarded – undo
429 421
      *
430 422
      * @return void
431 423
      */
432
-    public function moveUp($position)
433
-    {
424
+    public function moveUp($position) {
434 425
         $this->move($position, -1);
435 426
     }
436 427
 
@@ -443,8 +434,7 @@  discard block
 block discarded – undo
443 434
      *
444 435
      * @return void
445 436
      */
446
-    public function moveDown($position)
447
-    {
437
+    public function moveDown($position) {
448 438
         $this->move($position, 1);
449 439
     }
450 440
 
@@ -456,8 +446,7 @@  discard block
 block discarded – undo
456 446
      *
457 447
      * @return void
458 448
      */
459
-    public function next()
460
-    {
449
+    public function next() {
461 450
         $this->position++;
462 451
     }
463 452
 
@@ -471,8 +460,7 @@  discard block
 block discarded – undo
471 460
      *
472 461
      * @return bool Does the given offset exist?
473 462
      */
474
-    public function offsetExists($offset)
475
-    {
463
+    public function offsetExists($offset) {
476 464
         return isset($this->elements[$offset]);
477 465
     }
478 466
 
@@ -486,8 +474,7 @@  discard block
 block discarded – undo
486 474
      *
487 475
      * @return array The element at the given offset
488 476
      */
489
-    public function offsetGet($offset)
490
-    {
477
+    public function offsetGet($offset) {
491 478
         if ($this->offsetExists($offset)) {
492 479
             return $this->getRecord($this->elements[$offset]);
493 480
         } else {
@@ -507,8 +494,7 @@  discard block
 block discarded – undo
507 494
      *
508 495
      * @return void
509 496
      */
510
-    public function offsetSet($offset, $value)
511
-    {
497
+    public function offsetSet($offset, $value) {
512 498
         if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) {
513 499
             $this->elements[$offset] = $value;
514 500
         } else {
@@ -528,8 +514,7 @@  discard block
 block discarded – undo
528 514
      *
529 515
      * @return array The removed element
530 516
      */
531
-    public function remove($position)
532
-    {
517
+    public function remove($position) {
533 518
         $position = intval($position);
534 519
         if (
535 520
             $position < 0
@@ -553,8 +538,7 @@  discard block
 block discarded – undo
553 538
      *
554 539
      * @return array The indizes of the removed elements
555 540
      */
556
-    public function removeRange($position, $length)
557
-    {
541
+    public function removeRange($position, $length) {
558 542
         $position = intval($position);
559 543
         if (
560 544
             $position < 0
@@ -575,8 +559,7 @@  discard block
 block discarded – undo
575 559
      *
576 560
      * @return void
577 561
      */
578
-    public function reset()
579
-    {
562
+    public function reset() {
580 563
         $this->elements = [];
581 564
         $this->records = [];
582 565
         $this->metadata = [];
@@ -592,8 +575,7 @@  discard block
 block discarded – undo
592 575
      *
593 576
      * @return void
594 577
      */
595
-    public function rewind()
596
-    {
578
+    public function rewind() {
597 579
         $this->position = 0;
598 580
     }
599 581
 
@@ -606,8 +588,7 @@  discard block
 block discarded – undo
606 588
      *
607 589
      * @return void
608 590
      */
609
-    public function save($pid = 0)
610
-    {
591
+    public function save($pid = 0) {
611 592
         $pid = max(intval($pid), 0);
612 593
         // If no PID is given, save to the user's session instead
613 594
         if ($pid > 0) {
@@ -624,8 +605,7 @@  discard block
 block discarded – undo
624 605
      *
625 606
      * @return bool true on success or false on failure
626 607
      */
627
-    protected function solrConnect()
628
-    {
608
+    protected function solrConnect() {
629 609
         // Get Solr instance.
630 610
         if (!$this->solr) {
631 611
             // Connect to Solr server.
@@ -674,8 +654,7 @@  discard block
 block discarded – undo
674 654
      *
675 655
      * @return void
676 656
      */
677
-    public function sort($by, $asc = true)
678
-    {
657
+    public function sort($by, $asc = true) {
679 658
         $newOrder = [];
680 659
         $nonSortable = [];
681 660
         foreach ($this->elements as $num => $element) {
@@ -712,8 +691,7 @@  discard block
 block discarded – undo
712 691
      *
713 692
      * @return void
714 693
      */
715
-    public function offsetUnset($offset)
716
-    {
694
+    public function offsetUnset($offset) {
717 695
         unset($this->elements[$offset]);
718 696
         // Re-number the elements.
719 697
         $this->elements = array_values($this->elements);
@@ -728,8 +706,7 @@  discard block
 block discarded – undo
728 706
      *
729 707
      * @return bool Is the current list position valid?
730 708
      */
731
-    public function valid()
732
-    {
709
+    public function valid() {
733 710
         return isset($this->elements[$this->position]);
734 711
     }
735 712
 
@@ -740,8 +717,7 @@  discard block
 block discarded – undo
740 717
      *
741 718
      * @return array The list's metadata
742 719
      */
743
-    protected function _getMetadata()
744
-    {
720
+    protected function _getMetadata() {
745 721
         return $this->metadata;
746 722
     }
747 723
 
@@ -754,8 +730,7 @@  discard block
 block discarded – undo
754 730
      *
755 731
      * @return void
756 732
      */
757
-    protected function _setMetadata(array $metadata = [])
758
-    {
733
+    protected function _setMetadata(array $metadata = []) {
759 734
         $this->metadata = $metadata;
760 735
     }
761 736
 
@@ -769,8 +744,7 @@  discard block
 block discarded – undo
769 744
      *
770 745
      * @return void
771 746
      */
772
-    public function __construct(array $elements = [], array $metadata = [])
773
-    {
747
+    public function __construct(array $elements = [], array $metadata = []) {
774 748
         if (
775 749
             empty($elements)
776 750
             && empty($metadata)
@@ -803,8 +777,7 @@  discard block
 block discarded – undo
803 777
      *
804 778
      * @return void
805 779
      */
806
-    protected function __clone()
807
-    {
780
+    protected function __clone() {
808 781
         // This method is defined as protected because singleton objects should not be cloned.
809 782
     }
810 783
 
@@ -817,8 +790,7 @@  discard block
 block discarded – undo
817 790
      *
818 791
      * @return mixed Value of $this->$var
819 792
      */
820
-    public function __get($var)
821
-    {
793
+    public function __get($var) {
822 794
         $method = '_get' . ucfirst($var);
823 795
         if (
824 796
             !property_exists($this, $var)
@@ -840,8 +812,7 @@  discard block
 block discarded – undo
840 812
      *
841 813
      * @return bool true if variable is set and not empty, false otherwise
842 814
      */
843
-    public function __isset($var)
844
-    {
815
+    public function __isset($var) {
845 816
         return !empty($this->__get($var));
846 817
     }
847 818
 
@@ -855,8 +826,7 @@  discard block
 block discarded – undo
855 826
      *
856 827
      * @return void
857 828
      */
858
-    public function __set($var, $value)
859
-    {
829
+    public function __set($var, $value) {
860 830
         $method = '_set' . ucfirst($var);
861 831
         if (
862 832
             !property_exists($this, $var)
@@ -876,8 +846,7 @@  discard block
 block discarded – undo
876 846
      *
877 847
      * @return array Properties to be serialized
878 848
      */
879
-    public function __sleep()
880
-    {
849
+    public function __sleep() {
881 850
         return ['elements', 'metadata'];
882 851
     }
883 852
 
@@ -889,8 +858,7 @@  discard block
 block discarded – undo
889 858
      *
890 859
      * @return void
891 860
      */
892
-    public function __wakeup()
893
-    {
861
+    public function __wakeup() {
894 862
         $this->count = count($this->elements);
895 863
     }
896 864
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                     if ($resArray['uid'] == $record['uid']) {
225 225
                         $record['thumbnail'] = $resArray['thumbnail'];
226 226
                         $record['metadata'] = $metadata;
227
-                    } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], true)) !== false) {
227
+                    } elseif (($key = array_search(['u' => $resArray['uid']], $record['subparts'], TRUE)) !== FALSE) {
228 228
                         $record['subparts'][$key] = [
229 229
                             'uid' => $resArray['uid'],
230 230
                             'page' => 1,
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
                 // Add static fields.
659 659
                 $this->solrConfig['type'] = 'type';
660 660
             } else {
661
-                return false;
661
+                return FALSE;
662 662
             }
663 663
         }
664
-        return true;
664
+        return TRUE;
665 665
     }
666 666
 
667 667
     /**
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      *
675 675
      * @return void
676 676
      */
677
-    public function sort($by, $asc = true)
677
+    public function sort($by, $asc = TRUE)
678 678
     {
679 679
         $newOrder = [];
680 680
         $nonSortable = [];
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/ResultDocument.php 1 patch
Braces   +15 added lines, -30 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 ResultDocument
28
-{
27
+class ResultDocument {
29 28
 
30 29
     /**
31 30
      * The identifier
@@ -102,8 +101,7 @@  discard block
 block discarded – undo
102 101
      *
103 102
      * @return void
104 103
      */
105
-    public function __construct($record, $highlighting, $fields)
106
-    {
104
+    public function __construct($record, $highlighting, $fields) {
107 105
         $this->id = $record[$fields['id']];
108 106
         $this->uid = $record[$fields['uid']];
109 107
         $this->page = $record[$fields['page']];
@@ -124,8 +122,7 @@  discard block
 block discarded – undo
124 122
      *
125 123
      * @return string The result's record identifier
126 124
      */
127
-    public function getId()
128
-    {
125
+    public function getId() {
129 126
         return $this->id;
130 127
     }
131 128
 
@@ -136,8 +133,7 @@  discard block
 block discarded – undo
136 133
      *
137 134
      * @return string|null The result's record unified identifier
138 135
      */
139
-    public function getUid()
140
-    {
136
+    public function getUid() {
141 137
         return $this->uid;
142 138
     }
143 139
 
@@ -148,8 +144,7 @@  discard block
 block discarded – undo
148 144
      *
149 145
      * @return int The result's record page
150 146
      */
151
-    public function getPage()
152
-    {
147
+    public function getPage() {
153 148
         return $this->page;
154 149
     }
155 150
 
@@ -160,8 +155,7 @@  discard block
 block discarded – undo
160 155
      *
161 156
      * @return string All result's record snippets imploded to one string
162 157
      */
163
-    public function getSnippets()
164
-    {
158
+    public function getSnippets() {
165 159
         return $this->snippets;
166 160
     }
167 161
 
@@ -172,8 +166,7 @@  discard block
 block discarded – undo
172 166
      *
173 167
      * @return array(Page) All result's pages which contain search phrase
174 168
      */
175
-    public function getPages()
176
-    {
169
+    public function getPages() {
177 170
         return $this->pages;
178 171
     }
179 172
 
@@ -184,8 +177,7 @@  discard block
 block discarded – undo
184 177
      *
185 178
      * @return array(Region) All result's regions which contain search phrase
186 179
      */
187
-    public function getRegions()
188
-    {
180
+    public function getRegions() {
189 181
         return $this->regions;
190 182
     }
191 183
 
@@ -196,8 +188,7 @@  discard block
 block discarded – undo
196 188
      *
197 189
      * @return array(Highlight) All result's highlights of search phrase
198 190
      */
199
-    public function getHighlights()
200
-    {
191
+    public function getHighlights() {
201 192
         return $this->highlights;
202 193
     }
203 194
 
@@ -208,8 +199,7 @@  discard block
 block discarded – undo
208 199
      *
209 200
      * @return array(string) All result's highlights of search phrase
210 201
      */
211
-    public function getHighlightsIds()
212
-    {
202
+    public function getHighlightsIds() {
213 203
         $highlightsIds = [];
214 204
         foreach ($this->highlights as $highlight) {
215 205
             array_push($highlightsIds, $highlight->getId());
@@ -225,8 +215,7 @@  discard block
 block discarded – undo
225 215
      *
226 216
      * @return void
227 217
      */
228
-    private function parseSnippets()
229
-    {
218
+    private function parseSnippets() {
230 219
         $snippetArray = $this->getArrayByIndex('text');
231 220
 
232 221
         $this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : '';
@@ -240,8 +229,7 @@  discard block
 block discarded – undo
240 229
      *
241 230
      * @return void
242 231
      */
243
-    private function parsePages()
244
-    {
232
+    private function parsePages() {
245 233
         $pageArray = $this->getArrayByIndex('pages');
246 234
 
247 235
         $i = 0;
@@ -261,8 +249,7 @@  discard block
 block discarded – undo
261 249
      *
262 250
      * @return void
263 251
      */
264
-    private function parseRegions()
265
-    {
252
+    private function parseRegions() {
266 253
         $regionArray = $this->getArrayByIndex('regions');
267 254
 
268 255
         $i = 0;
@@ -282,8 +269,7 @@  discard block
 block discarded – undo
282 269
      *
283 270
      * @return void
284 271
      */
285
-    private function parseHighlights()
286
-    {
272
+    private function parseHighlights() {
287 273
         $highlightArray = $this->getArrayByIndex('highlights');
288 274
 
289 275
         foreach ($highlightArray as $highlights) {
@@ -304,8 +290,7 @@  discard block
 block discarded – undo
304 290
      *
305 291
      * @return array
306 292
      */
307
-    private function getArrayByIndex($index)
308
-    {
293
+    private function getArrayByIndex($index) {
309 294
         $objectArray = [];
310 295
         foreach ($this->snippetsForRecord as $snippet) {
311 296
             if (!empty($snippet[$index])) {
Please login to merge, or discard this patch.
Classes/Common/SolrSearchResult/Highlight.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
         $this->xEndPosition = $highlight['lrx'];
88 88
         $this->yBeginPosition = $highlight['uly'];
89 89
         $this->yEndPosition = $highlight['lry'];
90
-        $this->id = $this->xBeginPosition . '_' . $this->yBeginPosition;
90
+        $this->id = $this->xBeginPosition.'_'.$this->yBeginPosition;
91 91
     }
92 92
 
93 93
     /**
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
  * @subpackage dlf
21 21
  * @access public
22 22
  */
23
-class Highlight
24
-{
23
+class Highlight {
25 24
 
26 25
     /**
27 26
      * The identifier in form 'w_h_x_y'
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
      *
81 80
      * @return void
82 81
      */
83
-    public function __construct($highlight)
84
-    {
82
+    public function __construct($highlight) {
85 83
         $this->parentRegionId = $highlight['parentRegionIdx'];
86 84
         $this->xBeginPosition = $highlight['ulx'];
87 85
         $this->xEndPosition = $highlight['lrx'];
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
      *
98 96
      * @return string The highlight's identifier
99 97
      */
100
-    public function getId()
101
-    {
98
+    public function getId() {
102 99
         return $this->id;
103 100
     }
104 101
 
@@ -109,8 +106,7 @@  discard block
 block discarded – undo
109 106
      *
110 107
      * @return int The highlight's horizontal beginning position
111 108
      */
112
-    public function getXBeginPosition()
113
-    {
109
+    public function getXBeginPosition() {
114 110
         return $this->xBeginPosition;
115 111
     }
116 112
 
@@ -121,8 +117,7 @@  discard block
 block discarded – undo
121 117
      *
122 118
      * @return int The highlight's horizontal ending position
123 119
      */
124
-    public function getXEndPosition()
125
-    {
120
+    public function getXEndPosition() {
126 121
         return $this->xEndPosition;
127 122
     }
128 123
 
@@ -133,8 +128,7 @@  discard block
 block discarded – undo
133 128
      *
134 129
      * @return int The highlight's vertical beginning position
135 130
      */
136
-    public function getYBeginPosition()
137
-    {
131
+    public function getYBeginPosition() {
138 132
         return $this->yBeginPosition;
139 133
     }
140 134
 
@@ -145,8 +139,7 @@  discard block
 block discarded – undo
145 139
      *
146 140
      * @return int The highlight's vertical ending position
147 141
      */
148
-    public function getYEndPosition()
149
-    {
142
+    public function getYEndPosition() {
150 143
         return $this->yEndPosition;
151 144
     }
152 145
 }
Please login to merge, or discard this patch.
Classes/Format/Alto.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     private function getWord($attributes)
103 103
     {
104
-        return htmlspecialchars((string) $attributes['CONTENT']) . ' ';
104
+        return htmlspecialchars((string) $attributes['CONTENT']).' ';
105 105
     }
106 106
 
107 107
     /**
@@ -115,6 +115,6 @@  discard block
 block discarded – undo
115 115
      */
116 116
     private function getCoordinates($attributes)
117 117
     {
118
-        return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT'];
118
+        return (string) $attributes['HPOS'].' '.(string) $attributes['VPOS'].' '.(string) $attributes['WIDTH'].' '.(string) $attributes['HEIGHT'];
119 119
     }
120 120
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  * @subpackage dlf
23 23
  * @access public
24 24
  */
25
-class Alto implements \Kitodo\Dlf\Common\FulltextInterface
26
-{
25
+class Alto implements \Kitodo\Dlf\Common\FulltextInterface {
27 26
     /**
28 27
      * This extracts the fulltext data from ALTO XML
29 28
      *
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return string The raw unformatted fulltext
35 34
      */
36
-    public function getRawText(\SimpleXMLElement $xml)
37
-    {
35
+    public function getRawText(\SimpleXMLElement $xml) {
38 36
         $rawText = '';
39 37
         $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#');
40 38
         // Get all (presumed) words of the text.
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
      *
55 53
      * @return string The unformatted fulltext in MiniOCR format
56 54
      */
57
-    public function getTextAsMiniOcr(\SimpleXMLElement $xml)
58
-    {
55
+    public function getTextAsMiniOcr(\SimpleXMLElement $xml) {
59 56
         $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#');
60 57
 
61 58
         // get all text blocks
@@ -99,8 +96,7 @@  discard block
 block discarded – undo
99 96
      *
100 97
      * @return string The parsed word extracted from attribute
101 98
      */
102
-    private function getWord($attributes)
103
-    {
99
+    private function getWord($attributes) {
104 100
         return htmlspecialchars((string) $attributes['CONTENT']) . ' ';
105 101
     }
106 102
 
@@ -113,8 +109,7 @@  discard block
 block discarded – undo
113 109
      *
114 110
      * @return string The parsed word coordinates extracted from attribute
115 111
      */
116
-    private function getCoordinates($attributes)
117
-    {
112
+    private function getCoordinates($attributes) {
118 113
         return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT'];
119 114
     }
120 115
 }
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 if ($parent->ready) {
103 103
                     $success = self::add($parent, $core);
104 104
                 } else {
105
-                    Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR);
105
+                    Helper::log('Could not load parent document with UID '.$doc->parentId, LOG_SEVERITY_ERROR);
106 106
                     return false;
107 107
                 }
108 108
             }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 self::$processedDocs[] = $doc->uid;
112 112
                 // Delete old Solr documents.
113 113
                 $updateQuery = self::$solr->service->createUpdate();
114
-                $updateQuery->addDeleteQuery('uid:' . $doc->uid);
114
+                $updateQuery->addDeleteQuery('uid:'.$doc->uid);
115 115
                 self::$solr->service->update($updateQuery);
116 116
 
117 117
                 // Index every logical unit as separate Solr document.
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
             } catch (\Exception $e) {
177 177
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
178 178
                     Helper::addMessage(
179
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
179
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
180 180
                         Helper::getMessage('flash.error', true),
181 181
                         FlashMessage::ERROR,
182 182
                         true,
183 183
                         'core.template.flashMessages'
184 184
                     );
185 185
                 }
186
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
186
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
187 187
                 return false;
188 188
             }
189 189
         } else {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         // Sanitize input.
217 217
         $pid = max(intval($pid), 0);
218 218
         if (!$pid) {
219
-            Helper::log('Invalid PID ' . $pid . ' for metadata configuration', LOG_SEVERITY_ERROR);
219
+            Helper::log('Invalid PID '.$pid.' for metadata configuration', LOG_SEVERITY_ERROR);
220 220
             return '';
221 221
         }
222 222
         // Load metadata configuration.
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
226 226
         $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
227 227
         $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
228
-        $index_name .= '_' . $suffix;
228
+        $index_name .= '_'.$suffix;
229 229
         return $index_name;
230 230
     }
231 231
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             $updateQuery = self::$solr->service->createUpdate();
334 334
             $solrDoc = $updateQuery->createDocument();
335 335
             // Create unique identifier from document's UID and unit's XML ID.
336
-            $solrDoc->setField('id', $doc->uid . $logicalUnit['id']);
336
+            $solrDoc->setField('id', $doc->uid.$logicalUnit['id']);
337 337
             $solrDoc->setField('uid', $doc->uid);
338 338
             $solrDoc->setField('pid', $doc->pid);
339 339
             if (MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) {
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
                     $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]);
375 375
                     if (in_array($index_name, self::$fields['sortables'])) {
376 376
                         // Add sortable fields to index.
377
-                        $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]);
377
+                        $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
378 378
                     }
379 379
                     if (in_array($index_name, self::$fields['facets'])) {
380 380
                         // Add facets to index.
381
-                        $solrDoc->setField($index_name . '_faceting', $data);
381
+                        $solrDoc->setField($index_name.'_faceting', $data);
382 382
                     }
383 383
                     if (in_array($index_name, self::$fields['autocomplete'])) {
384 384
                         $autocomplete = array_merge($autocomplete, $data);
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
             } catch (\Exception $e) {
404 404
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
405 405
                     Helper::addMessage(
406
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
406
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
407 407
                         Helper::getMessage('flash.error', true),
408 408
                         FlashMessage::ERROR,
409 409
                         true,
410 410
                         'core.template.flashMessages'
411 411
                     );
412 412
                 }
413
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
413
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
414 414
                 return false;
415 415
             }
416 416
         }
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             $updateQuery = self::$solr->service->createUpdate();
449 449
             $solrDoc = $updateQuery->createDocument();
450 450
             // Create unique identifier from document's UID and unit's XML ID.
451
-            $solrDoc->setField('id', $doc->uid . $physicalUnit['id']);
451
+            $solrDoc->setField('id', $doc->uid.$physicalUnit['id']);
452 452
             $solrDoc->setField('uid', $doc->uid);
453 453
             $solrDoc->setField('pid', $doc->pid);
454 454
             $solrDoc->setField('page', $page);
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                             }
484 484
                         }
485 485
                         // Add facets to index.
486
-                        $solrDoc->setField($index_name . '_faceting', $data);
486
+                        $solrDoc->setField($index_name.'_faceting', $data);
487 487
                     }
488 488
                 }
489 489
             }
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
             } catch (\Exception $e) {
501 501
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
502 502
                     Helper::addMessage(
503
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
503
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
504 504
                         Helper::getMessage('flash.error', true),
505 505
                         FlashMessage::ERROR,
506 506
                         true,
507 507
                         'core.template.flashMessages'
508 508
                     );
509 509
                 }
510
-                Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
510
+                Helper::log('Apache Solr threw exception: "'.$e->getMessage().'"', LOG_SEVERITY_ERROR);
511 511
                 return false;
512 512
             }
513 513
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
  * @subpackage dlf
29 29
  * @access public
30 30
  */
31
-class Indexer
32
-{
31
+class Indexer {
33 32
     /**
34 33
      * The extension key
35 34
      *
@@ -90,8 +89,7 @@  discard block
 block discarded – undo
90 89
      *
91 90
      * @return bool true on success or false on failure
92 91
      */
93
-    public static function add(Document &$doc, $core = 0)
94
-    {
92
+    public static function add(Document &$doc, $core = 0) {
95 93
         if (in_array($doc->uid, self::$processedDocs)) {
96 94
             return true;
97 95
         } elseif (self::solrConnect($core, $doc->pid)) {
@@ -211,8 +209,7 @@  discard block
 block discarded – undo
211 209
      *
212 210
      * @return string The field's dynamic index name
213 211
      */
214
-    public static function getIndexFieldName($index_name, $pid = 0)
215
-    {
212
+    public static function getIndexFieldName($index_name, $pid = 0) {
216 213
         // Sanitize input.
217 214
         $pid = max(intval($pid), 0);
218 215
         if (!$pid) {
@@ -238,8 +235,7 @@  discard block
 block discarded – undo
238 235
      *
239 236
      * @return void
240 237
      */
241
-    protected static function loadIndexConf($pid)
242
-    {
238
+    protected static function loadIndexConf($pid) {
243 239
         if (!self::$fieldsLoaded) {
244 240
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
245 241
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -309,8 +305,7 @@  discard block
 block discarded – undo
309 305
      *
310 306
      * @return bool true on success or false on failure
311 307
      */
312
-    protected static function processLogical(Document &$doc, array $logicalUnit)
313
-    {
308
+    protected static function processLogical(Document &$doc, array $logicalUnit) {
314 309
         $success = true;
315 310
         // Get metadata for logical unit.
316 311
         $metadata = $doc->metadataArray[$logicalUnit['id']];
@@ -439,8 +434,7 @@  discard block
 block discarded – undo
439 434
      *
440 435
      * @return bool true on success or false on failure
441 436
      */
442
-    protected static function processPhysical(Document &$doc, $page, array $physicalUnit)
443
-    {
437
+    protected static function processPhysical(Document &$doc, $page, array $physicalUnit) {
444 438
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
445 439
             // Read extension configuration.
446 440
             $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -524,8 +518,7 @@  discard block
 block discarded – undo
524 518
      *
525 519
      * @return bool true on success or false on failure
526 520
      */
527
-    protected static function solrConnect($core, $pid = 0)
528
-    {
521
+    protected static function solrConnect($core, $pid = 0) {
529 522
         // Get Solr instance.
530 523
         if (!self::$solr) {
531 524
             // Connect to Solr server.
@@ -548,8 +541,7 @@  discard block
 block discarded – undo
548 541
      *
549 542
      * @access private
550 543
      */
551
-    private function __construct()
552
-    {
544
+    private function __construct() {
553 545
         // This is a static class, thus no instances should be created.
554 546
     }
555 547
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @var bool
63 63
      * @access protected
64 64
      */
65
-    protected static $fieldsLoaded = false;
65
+    protected static $fieldsLoaded = FALSE;
66 66
 
67 67
     /**
68 68
      * List of already processed documents
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
     public static function add(Document &$doc, $core = 0)
94 94
     {
95 95
         if (in_array($doc->uid, self::$processedDocs)) {
96
-            return true;
96
+            return TRUE;
97 97
         } elseif (self::solrConnect($core, $doc->pid)) {
98
-            $success = true;
98
+            $success = TRUE;
99 99
             // Handle multi-volume documents.
100 100
             if ($doc->parentId) {
101
-                $parent = Document::getInstance($doc->parentId, 0, true);
101
+                $parent = Document::getInstance($doc->parentId, 0, TRUE);
102 102
                 if ($parent->ready) {
103 103
                     $success = self::add($parent, $core);
104 104
                 } else {
105 105
                     Helper::log('Could not load parent document with UID ' . $doc->parentId, LOG_SEVERITY_ERROR);
106
-                    return false;
106
+                    return FALSE;
107 107
                 }
108 108
             }
109 109
             try {
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
                     if ($success) {
158 158
                         Helper::addMessage(
159 159
                             htmlspecialchars(sprintf(Helper::getMessage('flash.documentIndexed'), $resArray['title'], $doc->uid)),
160
-                            Helper::getMessage('flash.done', true),
160
+                            Helper::getMessage('flash.done', TRUE),
161 161
                             FlashMessage::OK,
162
-                            true,
162
+                            TRUE,
163 163
                             'core.template.flashMessages'
164 164
                         );
165 165
                     } else {
166 166
                         Helper::addMessage(
167 167
                             htmlspecialchars(sprintf(Helper::getMessage('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
168
-                            Helper::getMessage('flash.error', true),
168
+                            Helper::getMessage('flash.error', TRUE),
169 169
                             FlashMessage::ERROR,
170
-                            true,
170
+                            TRUE,
171 171
                             'core.template.flashMessages'
172 172
                         );
173 173
                     }
@@ -176,28 +176,28 @@  discard block
 block discarded – undo
176 176
             } catch (\Exception $e) {
177 177
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
178 178
                     Helper::addMessage(
179
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
180
-                        Helper::getMessage('flash.error', true),
179
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
180
+                        Helper::getMessage('flash.error', TRUE),
181 181
                         FlashMessage::ERROR,
182
-                        true,
182
+                        TRUE,
183 183
                         'core.template.flashMessages'
184 184
                     );
185 185
                 }
186 186
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
187
-                return false;
187
+                return FALSE;
188 188
             }
189 189
         } else {
190 190
             if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
191 191
                 Helper::addMessage(
192
-                    Helper::getMessage('flash.solrNoConnection', true),
193
-                    Helper::getMessage('flash.warning', true),
192
+                    Helper::getMessage('flash.solrNoConnection', TRUE),
193
+                    Helper::getMessage('flash.warning', TRUE),
194 194
                     FlashMessage::WARNING,
195
-                    true,
195
+                    TRUE,
196 196
                     'core.template.flashMessages'
197 197
                 );
198 198
             }
199 199
             Helper::log('Could not connect to Apache Solr server', LOG_SEVERITY_ERROR);
200
-            return false;
200
+            return FALSE;
201 201
         }
202 202
     }
203 203
 
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
                 if ($indexing['index_boost'] > 0.0) {
293 293
                     self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']);
294 294
                 } else {
295
-                    self::$fields['fieldboost'][$indexing['index_name']] = false;
295
+                    self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
296 296
                 }
297 297
             }
298
-            self::$fieldsLoaded = true;
298
+            self::$fieldsLoaded = TRUE;
299 299
         }
300 300
     }
301 301
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     protected static function processLogical(Document &$doc, array $logicalUnit)
313 313
     {
314
-        $success = true;
314
+        $success = TRUE;
315 315
         // Get metadata for logical unit.
316 316
         $metadata = $doc->metadataArray[$logicalUnit['id']];
317 317
         if (!empty($metadata)) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             $solrDoc->setField('root', $doc->rootId);
349 349
             $solrDoc->setField('sid', $logicalUnit['id']);
350 350
             // There can be only one toplevel unit per UID, independently of backend configuration
351
-            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false);
351
+            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE);
352 352
             $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']);
353 353
             $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
354 354
             $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
@@ -403,15 +403,15 @@  discard block
 block discarded – undo
403 403
             } catch (\Exception $e) {
404 404
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
405 405
                     Helper::addMessage(
406
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
407
-                        Helper::getMessage('flash.error', true),
406
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
407
+                        Helper::getMessage('flash.error', TRUE),
408 408
                         FlashMessage::ERROR,
409
-                        true,
409
+                        TRUE,
410 410
                         'core.template.flashMessages'
411 411
                     );
412 412
                 }
413 413
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
414
-                return false;
414
+                return FALSE;
415 415
             }
416 416
         }
417 417
         // Check for child elements...
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
             $solrDoc->setField('partof', $doc->parentId);
463 463
             $solrDoc->setField('root', $doc->rootId);
464 464
             $solrDoc->setField('sid', $physicalUnit['id']);
465
-            $solrDoc->setField('toplevel', false);
465
+            $solrDoc->setField('toplevel', FALSE);
466 466
             $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']);
467 467
             $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']);
468 468
 
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
             } catch (\Exception $e) {
501 501
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
502 502
                     Helper::addMessage(
503
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
504
-                        Helper::getMessage('flash.error', true),
503
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
504
+                        Helper::getMessage('flash.error', TRUE),
505 505
                         FlashMessage::ERROR,
506
-                        true,
506
+                        TRUE,
507 507
                         'core.template.flashMessages'
508 508
                     );
509 509
                 }
510 510
                 Helper::log('Apache Solr threw exception: "' . $e->getMessage() . '"', LOG_SEVERITY_ERROR);
511
-                return false;
511
+                return FALSE;
512 512
             }
513 513
         }
514
-        return true;
514
+        return TRUE;
515 515
     }
516 516
 
517 517
     /**
@@ -537,10 +537,10 @@  discard block
 block discarded – undo
537 537
                     self::loadIndexConf($pid);
538 538
                 }
539 539
             } else {
540
-                return false;
540
+                return FALSE;
541 541
             }
542 542
         }
543
-        return true;
543
+        return TRUE;
544 544
     }
545 545
 
546 546
     /**
Please login to merge, or discard this patch.
Classes/Common/Document.php 3 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -671,14 +671,14 @@  discard block
 block discarded – undo
671 671
                     if ($fileContent !== false) {
672 672
                         $textFormat = $this->getTextFormat($fileContent);
673 673
                     } else {
674
-                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
674
+                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"');
675 675
                         return $fullText;
676 676
                     }
677 677
                     break;
678 678
                 }
679 679
             }
680 680
         } else {
681
-            $this->logger->warning('Invalid structure node @ID "' . $id . '"');
681
+            $this->logger->warning('Invalid structure node @ID "'.$id.'"');
682 682
             return $fullText;
683 683
         }
684 684
         // Is this text format supported?
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
                     $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml);
698 698
                     $this->rawTextArray[$id] = $textMiniOcr;
699 699
                 } else {
700
-                    $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"');
700
+                    $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"');
701 701
                 }
702 702
             }
703 703
             $fullText = $textMiniOcr;
704 704
         } else {
705
-            $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"');
705
+            $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"');
706 706
         }
707 707
         return $fullText;
708 708
     }
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
                     $title = self::getTitle($partof, true);
771 771
                 }
772 772
             } else {
773
-                Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
773
+                Helper::log('No document with UID '.$uid.' found or document not accessible', LOG_SEVERITY_WARNING);
774 774
             }
775 775
         } else {
776
-            Helper::log('Invalid UID ' . $uid . ' for document', LOG_SEVERITY_ERROR);
776
+            Helper::log('Invalid UID '.$uid.' for document', LOG_SEVERITY_ERROR);
777 777
         }
778 778
         return $title;
779 779
     }
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
             // the actual loading is format specific
909 909
             return $this->loadLocation($location);
910 910
         } else {
911
-            $this->logger->error('Invalid file location "' . $location . '" for document loading');
911
+            $this->logger->error('Invalid file location "'.$location.'" for document loading');
912 912
         }
913 913
         return false;
914 914
     }
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
             // Retain current PID.
1019 1019
             $pid = $this->pid;
1020 1020
         } elseif (!$pid) {
1021
-            $this->logger->error('Invalid PID ' . $pid . ' for document saving');
1021
+            $this->logger->error('Invalid PID '.$pid.' for document saving');
1022 1022
             return false;
1023 1023
         }
1024 1024
         // Set PID for metadata definitions.
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
         if ($resArray = $result->fetch()) {
1056 1056
             $structure = $resArray['uid'];
1057 1057
         } else {
1058
-            $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"');
1058
+            $this->logger->error('Could not identify document/structure type "'.$queryBuilder->expr()->literal($metadata['type'][0]).'"');
1059 1059
             return false;
1060 1060
         }
1061 1061
         $metadata['type'][0] = $structure;
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
         if ($core) {
1305 1305
             return Indexer::add($this, $core);
1306 1306
         } else {
1307
-            $this->logger->notice('Invalid UID "' . $core . '" for Solr core');
1307
+            $this->logger->notice('Invalid UID "'.$core.'" for Solr core');
1308 1308
             return false;
1309 1309
         }
1310 1310
     }
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
         // Set metadata definitions' PID.
1383 1383
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1384 1384
         if (!$cPid) {
1385
-            $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions');
1385
+            $this->logger->error('Invalid PID '.$cPid.' for metadata definitions');
1386 1386
             return [];
1387 1387
         }
1388 1388
         if (
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
             // Document ready!
1711 1711
             $this->ready = true;
1712 1712
         } else {
1713
-            $this->logger->error('No document with UID ' . $uid . ' found or document not accessible');
1713
+            $this->logger->error('No document with UID '.$uid.' found or document not accessible');
1714 1714
         }
1715 1715
     }
1716 1716
 
@@ -1725,12 +1725,12 @@  discard block
 block discarded – undo
1725 1725
      */
1726 1726
     public function __get($var)
1727 1727
     {
1728
-        $method = '_get' . ucfirst($var);
1728
+        $method = '_get'.ucfirst($var);
1729 1729
         if (
1730 1730
             !property_exists($this, $var)
1731 1731
             || !method_exists($this, $method)
1732 1732
         ) {
1733
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
1733
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
1734 1734
             return;
1735 1735
         } else {
1736 1736
             return $this->$method();
@@ -1763,12 +1763,12 @@  discard block
 block discarded – undo
1763 1763
      */
1764 1764
     public function __set($var, $value)
1765 1765
     {
1766
-        $method = '_set' . ucfirst($var);
1766
+        $method = '_set'.ucfirst($var);
1767 1767
         if (
1768 1768
             !property_exists($this, $var)
1769 1769
             || !method_exists($this, $method)
1770 1770
         ) {
1771
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
1771
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
1772 1772
         } else {
1773 1773
             $this->$method($value);
1774 1774
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
  * @property-read mixed $uid This holds the UID or the URL of the document
49 49
  * @abstract
50 50
  */
51
-abstract class Document
52
-{
51
+abstract class Document {
53 52
     /**
54 53
      * This holds the logger
55 54
      *
@@ -341,8 +340,7 @@  discard block
 block discarded – undo
341 340
      *
342 341
      * @return void
343 342
      */
344
-    public static function clearRegistry()
345
-    {
343
+    public static function clearRegistry() {
346 344
         // Reset registry array.
347 345
         self::$registry = [];
348 346
     }
@@ -607,8 +605,7 @@  discard block
 block discarded – undo
607 605
      *
608 606
      * @return int The physical page number
609 607
      */
610
-    public function getPhysicalPage($logicalPage)
611
-    {
608
+    public function getPhysicalPage($logicalPage) {
612 609
         if (
613 610
             !empty($this->lastSearchedPhysicalPage['logicalPage'])
614 611
             && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage
@@ -653,8 +650,7 @@  discard block
 block discarded – undo
653 650
      *
654 651
      * @return string The OCR full text
655 652
      */
656
-    protected function getFullTextFromXml($id)
657
-    {
653
+    protected function getFullTextFromXml($id) {
658 654
         $fullText = '';
659 655
         // Load available text formats, ...
660 656
         $this->loadFormats();
@@ -716,8 +712,7 @@  discard block
 block discarded – undo
716 712
      *
717 713
      * @return string The format of the OCR full text
718 714
      */
719
-    private function getTextFormat($fileContent)
720
-    {
715
+    private function getTextFormat($fileContent) {
721 716
         // Get the root element's name as text format.
722 717
         return strtoupper(Helper::getXmlFileAsString($fileContent)->getName());
723 718
     }
@@ -734,8 +729,7 @@  discard block
 block discarded – undo
734 729
      *
735 730
      * @return string The title of the document itself or a parent document
736 731
      */
737
-    public static function getTitle($uid, $recursive = false)
738
-    {
732
+    public static function getTitle($uid, $recursive = false) {
739 733
         $title = '';
740 734
         // Sanitize input.
741 735
         $uid = max(intval($uid), 0);
@@ -787,8 +781,7 @@  discard block
 block discarded – undo
787 781
      *
788 782
      * @return array The logical structure node's / resource's parsed metadata array
789 783
      */
790
-    public function getTitledata($cPid = 0)
791
-    {
784
+    public function getTitledata($cPid = 0) {
792 785
         $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
793 786
         // Add information from METS structural map to titledata array.
794 787
         if ($this instanceof MetsDocument) {
@@ -821,8 +814,7 @@  discard block
 block discarded – undo
821 814
      * @return int|bool: false if structure with $logId is not a child of this substructure,
822 815
      * or the actual depth.
823 816
      */
824
-    protected function getTreeDepth($structure, $depth, $logId)
825
-    {
817
+    protected function getTreeDepth($structure, $depth, $logId) {
826 818
         foreach ($structure as $element) {
827 819
             if ($element['id'] == $logId) {
828 820
                 return $depth;
@@ -844,8 +836,7 @@  discard block
 block discarded – undo
844 836
      * @param string $logId: The id of the logical structure element whose depth is requested
845 837
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
846 838
      */
847
-    public function getStructureDepth($logId)
848
-    {
839
+    public function getStructureDepth($logId) {
849 840
         return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId);
850 841
     }
851 842
 
@@ -895,8 +886,7 @@  discard block
 block discarded – undo
895 886
      *
896 887
      * @return bool true on success or false on failure
897 888
      */
898
-    protected function load($location)
899
-    {
889
+    protected function load($location) {
900 890
         // Load XML / JSON-LD file.
901 891
         if (GeneralUtility::isValidUrl($location)) {
902 892
             // Load extension configuration
@@ -929,8 +919,7 @@  discard block
 block discarded – undo
929 919
      *
930 920
      * @return void
931 921
      */
932
-    protected function loadFormats()
933
-    {
922
+    protected function loadFormats() {
934 923
         if (!$this->formatsLoaded) {
935 924
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
936 925
                 ->getQueryBuilderForTable('tx_dlf_formats');
@@ -970,8 +959,7 @@  discard block
 block discarded – undo
970 959
      *
971 960
      * @return void
972 961
      */
973
-    public function registerNamespaces(&$obj)
974
-    {
962
+    public function registerNamespaces(&$obj) {
975 963
         // 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.
976 964
         $this->loadFormats();
977 965
         // Do we have a \SimpleXMLElement or \DOMXPath object?
@@ -1000,8 +988,7 @@  discard block
 block discarded – undo
1000 988
      *
1001 989
      * @return bool true on success or false on failure
1002 990
      */
1003
-    public function save($pid = 0, $core = 0, $owner = null)
1004
-    {
991
+    public function save($pid = 0, $core = 0, $owner = null) {
1005 992
         if (\TYPO3_MODE !== 'BE') {
1006 993
             $this->logger->error('Saving a document is only allowed in the backend');
1007 994
             return false;
@@ -1329,8 +1316,7 @@  discard block
 block discarded – undo
1329 1316
      *
1330 1317
      * @return int The PID of the metadata definitions
1331 1318
      */
1332
-    protected function _getCPid()
1333
-    {
1319
+    protected function _getCPid() {
1334 1320
         return $this->cPid;
1335 1321
     }
1336 1322
 
@@ -1341,8 +1327,7 @@  discard block
 block discarded – undo
1341 1327
      *
1342 1328
      * @return bool Are there any fulltext files available?
1343 1329
      */
1344
-    protected function _getHasFulltext()
1345
-    {
1330
+    protected function _getHasFulltext() {
1346 1331
         $this->ensureHasFulltextIsSet();
1347 1332
         return $this->hasFulltext;
1348 1333
     }
@@ -1354,8 +1339,7 @@  discard block
 block discarded – undo
1354 1339
      *
1355 1340
      * @return string The location of the document
1356 1341
      */
1357
-    protected function _getLocation()
1358
-    {
1342
+    protected function _getLocation() {
1359 1343
         return $this->location;
1360 1344
     }
1361 1345
 
@@ -1377,8 +1361,7 @@  discard block
 block discarded – undo
1377 1361
      *
1378 1362
      * @return array Array of metadata with their corresponding logical structure node ID as key
1379 1363
      */
1380
-    protected function _getMetadataArray()
1381
-    {
1364
+    protected function _getMetadataArray() {
1382 1365
         // Set metadata definitions' PID.
1383 1366
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1384 1367
         if (!$cPid) {
@@ -1403,8 +1386,7 @@  discard block
 block discarded – undo
1403 1386
      *
1404 1387
      * @return int The total number of pages and/or tracks
1405 1388
      */
1406
-    protected function _getNumPages()
1407
-    {
1389
+    protected function _getNumPages() {
1408 1390
         $this->_getPhysicalStructure();
1409 1391
         return $this->numPages;
1410 1392
     }
@@ -1416,8 +1398,7 @@  discard block
 block discarded – undo
1416 1398
      *
1417 1399
      * @return int The UID of the parent document or zero if not applicable
1418 1400
      */
1419
-    protected function _getParentId()
1420
-    {
1401
+    protected function _getParentId() {
1421 1402
         return $this->parentId;
1422 1403
     }
1423 1404
 
@@ -1440,8 +1421,7 @@  discard block
 block discarded – undo
1440 1421
      *
1441 1422
      * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order
1442 1423
      */
1443
-    protected function _getPhysicalStructureInfo()
1444
-    {
1424
+    protected function _getPhysicalStructureInfo() {
1445 1425
         // Is there no physical structure array yet?
1446 1426
         if (!$this->physicalStructureLoaded) {
1447 1427
             // Build physical structure array.
@@ -1457,8 +1437,7 @@  discard block
 block discarded – undo
1457 1437
      *
1458 1438
      * @return int The PID of the document or zero if not in database
1459 1439
      */
1460
-    protected function _getPid()
1461
-    {
1440
+    protected function _getPid() {
1462 1441
         return $this->pid;
1463 1442
     }
1464 1443
 
@@ -1469,8 +1448,7 @@  discard block
 block discarded – undo
1469 1448
      *
1470 1449
      * @return bool Is the document instantiated successfully?
1471 1450
      */
1472
-    protected function _getReady()
1473
-    {
1451
+    protected function _getReady() {
1474 1452
         return $this->ready;
1475 1453
     }
1476 1454
 
@@ -1481,8 +1459,7 @@  discard block
 block discarded – undo
1481 1459
      *
1482 1460
      * @return mixed The METS file's / IIIF manifest's record identifier
1483 1461
      */
1484
-    protected function _getRecordId()
1485
-    {
1462
+    protected function _getRecordId() {
1486 1463
         return $this->recordId;
1487 1464
     }
1488 1465
 
@@ -1493,8 +1470,7 @@  discard block
 block discarded – undo
1493 1470
      *
1494 1471
      * @return int The UID of the root document or zero if not applicable
1495 1472
      */
1496
-    protected function _getRootId()
1497
-    {
1473
+    protected function _getRootId() {
1498 1474
         if (!$this->rootIdLoaded) {
1499 1475
             if ($this->parentId) {
1500 1476
                 $parent = self::getInstance($this->parentId, $this->pid);
@@ -1524,8 +1500,7 @@  discard block
 block discarded – undo
1524 1500
      *
1525 1501
      * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved
1526 1502
      */
1527
-    protected function _getTableOfContents()
1528
-    {
1503
+    protected function _getTableOfContents() {
1529 1504
         // Is there no logical structure array yet?
1530 1505
         if (!$this->tableOfContentsLoaded) {
1531 1506
             // Get all logical structures.
@@ -1566,8 +1541,7 @@  discard block
 block discarded – undo
1566 1541
      *
1567 1542
      * @return mixed The UID or the URL of the document
1568 1543
      */
1569
-    protected function _getUid()
1570
-    {
1544
+    protected function _getUid() {
1571 1545
         return $this->uid;
1572 1546
     }
1573 1547
 
@@ -1580,8 +1554,7 @@  discard block
 block discarded – undo
1580 1554
      *
1581 1555
      * @return void
1582 1556
      */
1583
-    protected function _setCPid($value)
1584
-    {
1557
+    protected function _setCPid($value) {
1585 1558
         $this->cPid = max(intval($value), 0);
1586 1559
     }
1587 1560
 
@@ -1592,8 +1565,7 @@  discard block
 block discarded – undo
1592 1565
      *
1593 1566
      * @return void
1594 1567
      */
1595
-    protected function __clone()
1596
-    {
1568
+    protected function __clone() {
1597 1569
         // This method is defined as protected because singleton objects should not be cloned.
1598 1570
     }
1599 1571
 
@@ -1610,8 +1582,7 @@  discard block
 block discarded – undo
1610 1582
      *
1611 1583
      * @return void
1612 1584
      */
1613
-    protected function __construct($uid, $pid, $preloadedDocument)
1614
-    {
1585
+    protected function __construct($uid, $pid, $preloadedDocument) {
1615 1586
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1616 1587
             ->getQueryBuilderForTable('tx_dlf_documents');
1617 1588
         $location = '';
@@ -1723,8 +1694,7 @@  discard block
 block discarded – undo
1723 1694
      *
1724 1695
      * @return mixed Value of $this->$var
1725 1696
      */
1726
-    public function __get($var)
1727
-    {
1697
+    public function __get($var) {
1728 1698
         $method = '_get' . ucfirst($var);
1729 1699
         if (
1730 1700
             !property_exists($this, $var)
@@ -1746,8 +1716,7 @@  discard block
 block discarded – undo
1746 1716
      *
1747 1717
      * @return bool true if variable is set and not empty, false otherwise
1748 1718
      */
1749
-    public function __isset($var)
1750
-    {
1719
+    public function __isset($var) {
1751 1720
         return !empty($this->__get($var));
1752 1721
     }
1753 1722
 
@@ -1761,8 +1730,7 @@  discard block
 block discarded – undo
1761 1730
      *
1762 1731
      * @return void
1763 1732
      */
1764
-    public function __set($var, $value)
1765
-    {
1733
+    public function __set($var, $value) {
1766 1734
         $method = '_set' . ucfirst($var);
1767 1735
         if (
1768 1736
             !property_exists($this, $var)
Please login to merge, or discard this patch.
Upper-Lower-Casing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      * @var bool
104 104
      * @access protected
105 105
      */
106
-    protected $formatsLoaded = false;
106
+    protected $formatsLoaded = FALSE;
107 107
 
108 108
     /**
109 109
      * Are there any fulltext files available? This also includes IIIF text annotations
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * @var bool
114 114
      * @access protected
115 115
      */
116
-    protected $hasFulltext = false;
116
+    protected $hasFulltext = FALSE;
117 117
 
118 118
     /**
119 119
      * Last searched logical and physical page
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @var array
122 122
      * @access protected
123 123
      */
124
-    protected $lastSearchedPhysicalPage = ['logicalPage' => null, 'physicalPage' => null];
124
+    protected $lastSearchedPhysicalPage = ['logicalPage' => NULL, 'physicalPage' => NULL];
125 125
 
126 126
     /**
127 127
      * This holds the documents location
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @var bool
156 156
      * @access protected
157 157
      */
158
-    protected $metadataArrayLoaded = false;
158
+    protected $metadataArrayLoaded = FALSE;
159 159
 
160 160
     /**
161 161
      * The holds the total number of pages
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @var bool
197 197
      * @access protected
198 198
      */
199
-    protected $physicalStructureLoaded = false;
199
+    protected $physicalStructureLoaded = FALSE;
200 200
 
201 201
     /**
202 202
      * This holds the PID of the document or zero if not in database
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      * @var bool
222 222
      * @access protected
223 223
      */
224
-    protected $ready = false;
224
+    protected $ready = FALSE;
225 225
 
226 226
     /**
227 227
      * The METS file's / IIIF manifest's record identifier
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      * @var bool
256 256
      * @access protected
257 257
      */
258
-    protected $rootIdLoaded = false;
258
+    protected $rootIdLoaded = FALSE;
259 259
 
260 260
     /**
261 261
      * This holds the smLinks between logical and physical structMap
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @var bool
273 273
      * @access protected
274 274
      */
275
-    protected $smLinksLoaded = false;
275
+    protected $smLinksLoaded = FALSE;
276 276
 
277 277
     /**
278 278
      * This holds the logical structure
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      * @var bool
290 290
      * @access protected
291 291
      */
292
-    protected $tableOfContentsLoaded = false;
292
+    protected $tableOfContentsLoaded = FALSE;
293 293
 
294 294
     /**
295 295
      * This holds the document's thumbnail location
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @var bool
307 307
      * @access protected
308 308
      */
309
-    protected $thumbnailLoaded = false;
309
+    protected $thumbnailLoaded = FALSE;
310 310
 
311 311
     /**
312 312
      * This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF)
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
      *
424 424
      * @return \Kitodo\Dlf\Common\Document Instance of this class, either MetsDocument or IiifManifest
425 425
      */
426
-    public static function &getInstance($uid, $pid = 0, $forceReload = false)
426
+    public static function &getInstance($uid, $pid = 0, $forceReload = FALSE)
427 427
     {
428 428
         // Sanitize input.
429 429
         $pid = max(intval($pid), 0);
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
             }
464 464
         }
465 465
         // Create new instance depending on format (METS or IIIF) ...
466
-        $instance = null;
467
-        $documentFormat = null;
468
-        $xml = null;
469
-        $iiif = null;
466
+        $instance = NULL;
467
+        $documentFormat = NULL;
468
+        $xml = NULL;
469
+        $iiif = NULL;
470 470
         // Try to get document format from database
471 471
         if (MathUtility::canBeInterpretedAsInteger($uid)) {
472 472
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -515,17 +515,17 @@  discard block
 block discarded – undo
515 515
                     @ini_set('user_agent', $extConf['useragent']);
516 516
                 }
517 517
                 $content = GeneralUtility::getUrl($location);
518
-                if ($content !== false) {
518
+                if ($content !== FALSE) {
519 519
                     $xml = Helper::getXmlFileAsString($content);
520
-                    if ($xml !== false) {
520
+                    if ($xml !== FALSE) {
521 521
                         /* @var $xml \SimpleXMLElement */
522 522
                         $xml->registerXPathNamespace('mets', 'http://www.loc.gov/METS/');
523 523
                         $xpathResult = $xml->xpath('//mets:mets');
524
-                        $documentFormat = !empty($xpathResult) ? 'METS' : null;
524
+                        $documentFormat = !empty($xpathResult) ? 'METS' : NULL;
525 525
                     } else {
526 526
                         // Try to load file as IIIF resource instead.
527
-                        $contentAsJsonArray = json_decode($content, true);
528
-                        if ($contentAsJsonArray !== null) {
527
+                        $contentAsJsonArray = json_decode($content, TRUE);
528
+                        if ($contentAsJsonArray !== NULL) {
529 529
                             // Load plugin configuration.
530 530
                             $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
531 531
                             IiifHelper::setUrlReader(IiifUrlReader::getInstance());
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      *
581 581
      * @return array Array of the element's id, label, type and physical page indexes/mptr link
582 582
      */
583
-    public abstract function getLogicalStructure($id, $recursive = false);
583
+    public abstract function getLogicalStructure($id, $recursive = FALSE);
584 584
 
585 585
     /**
586 586
      * This extracts all the metadata for a logical structure node
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         } else {
618 618
             $physicalPage = 0;
619 619
             foreach ($this->physicalStructureInfo as $page) {
620
-                if (strpos($page['orderlabel'], $logicalPage) !== false) {
620
+                if (strpos($page['orderlabel'], $logicalPage) !== FALSE) {
621 621
                     $this->lastSearchedPhysicalPage['logicalPage'] = $logicalPage;
622 622
                     $this->lastSearchedPhysicalPage['physicalPage'] = $physicalPage;
623 623
                     return $physicalPage;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                 if (!empty($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext])) {
669 669
                     // Get full text file.
670 670
                     $fileContent = GeneralUtility::getUrl($this->getFileLocation($this->physicalStructureInfo[$id]['files'][$fileGrpFulltext]));
671
-                    if ($fileContent !== false) {
671
+                    if ($fileContent !== FALSE) {
672 672
                         $textFormat = $this->getTextFormat($fileContent);
673 673
                     } else {
674 674
                         $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
      *
735 735
      * @return string The title of the document itself or a parent document
736 736
      */
737
-    public static function getTitle($uid, $recursive = false)
737
+    public static function getTitle($uid, $recursive = FALSE)
738 738
     {
739 739
         $title = '';
740 740
         // Sanitize input.
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
                     && intval($partof)
768 768
                     && $partof != $uid
769 769
                 ) {
770
-                    $title = self::getTitle($partof, true);
770
+                    $title = self::getTitle($partof, TRUE);
771 771
                 }
772 772
             } else {
773 773
                 Helper::log('No document with UID ' . $uid . ' found or document not accessible', LOG_SEVERITY_WARNING);
@@ -828,12 +828,12 @@  discard block
 block discarded – undo
828 828
                 return $depth;
829 829
             } elseif (array_key_exists('children', $element)) {
830 830
                 $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId);
831
-                if ($foundInChildren !== false) {
831
+                if ($foundInChildren !== FALSE) {
832 832
                     return $foundInChildren;
833 833
                 }
834 834
             }
835 835
         }
836
-        return false;
836
+        return FALSE;
837 837
     }
838 838
 
839 839
     /**
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
         } else {
911 911
             $this->logger->error('Invalid file location "' . $location . '" for document loading');
912 912
         }
913
-        return false;
913
+        return FALSE;
914 914
     }
915 915
 
916 916
     /**
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
                     'class' => $resArray['class']
958 958
                 ];
959 959
             }
960
-            $this->formatsLoaded = true;
960
+            $this->formatsLoaded = TRUE;
961 961
         }
962 962
     }
963 963
 
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
      *
1001 1001
      * @return bool true on success or false on failure
1002 1002
      */
1003
-    public function save($pid = 0, $core = 0, $owner = null)
1003
+    public function save($pid = 0, $core = 0, $owner = NULL)
1004 1004
     {
1005 1005
         if (\TYPO3_MODE !== 'BE') {
1006 1006
             $this->logger->error('Saving a document is only allowed in the backend');
1007
-            return false;
1007
+            return FALSE;
1008 1008
         }
1009 1009
         // Make sure $pid is a non-negative integer.
1010 1010
         $pid = max(intval($pid), 0);
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
             $pid = $this->pid;
1020 1020
         } elseif (!$pid) {
1021 1021
             $this->logger->error('Invalid PID ' . $pid . ' for document saving');
1022
-            return false;
1022
+            return FALSE;
1023 1023
         }
1024 1024
         // Set PID for metadata definitions.
1025 1025
         $this->cPid = $pid;
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
         // Check for record identifier.
1033 1033
         if (empty($metadata['record_id'][0])) {
1034 1034
             $this->logger->error('No record identifier found to avoid duplication');
1035
-            return false;
1035
+            return FALSE;
1036 1036
         }
1037 1037
         // Load plugin configuration.
1038 1038
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
             $structure = $resArray['uid'];
1057 1057
         } else {
1058 1058
             $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"');
1059
-            return false;
1059
+            return FALSE;
1060 1060
         }
1061 1061
         $metadata['type'][0] = $structure;
1062 1062
 
@@ -1116,9 +1116,9 @@  discard block
 block discarded – undo
1116 1116
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1117 1117
                     Helper::addMessage(
1118 1118
                         htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])),
1119
-                        Helper::getMessage('flash.attention', true),
1119
+                        Helper::getMessage('flash.attention', TRUE),
1120 1120
                         \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1121
-                        true
1121
+                        TRUE
1122 1122
                     );
1123 1123
                 }
1124 1124
             }
@@ -1169,9 +1169,9 @@  discard block
 block discarded – undo
1169 1169
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1170 1170
                     Helper::addMessage(
1171 1171
                         htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)),
1172
-                        Helper::getMessage('flash.attention', true),
1172
+                        Helper::getMessage('flash.attention', TRUE),
1173 1173
                         \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1174
-                        true
1174
+                        TRUE
1175 1175
                     );
1176 1176
                 }
1177 1177
             }
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
             'author' => implode('; ', $metadata['author']),
1260 1260
             'year' => implode('; ', $metadata['year']),
1261 1261
             'place' => implode('; ', $metadata['place']),
1262
-            'thumbnail' => $this->_getThumbnail(true),
1262
+            'thumbnail' => $this->_getThumbnail(TRUE),
1263 1263
             'metadata' => serialize($listed),
1264 1264
             'metadata_sorting' => serialize($sortable),
1265 1265
             'structure' => $metadata['type'][0],
@@ -1295,9 +1295,9 @@  discard block
 block discarded – undo
1295 1295
         if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1296 1296
             Helper::addMessage(
1297 1297
                 htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)),
1298
-                Helper::getMessage('flash.done', true),
1298
+                Helper::getMessage('flash.done', TRUE),
1299 1299
                 \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
1300
-                true
1300
+                TRUE
1301 1301
             );
1302 1302
         }
1303 1303
         // Add document to index.
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
             return Indexer::add($this, $core);
1306 1306
         } else {
1307 1307
             $this->logger->notice('Invalid UID "' . $core . '" for Solr core');
1308
-            return false;
1308
+            return FALSE;
1309 1309
         }
1310 1310
     }
1311 1311
 
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
         ) {
1392 1392
             $this->prepareMetadataArray($cPid);
1393 1393
             $this->metadataArray[0] = $cPid;
1394
-            $this->metadataArrayLoaded = true;
1394
+            $this->metadataArrayLoaded = TRUE;
1395 1395
         }
1396 1396
         return $this->metadataArray;
1397 1397
     }
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
                 $parent = self::getInstance($this->parentId, $this->pid);
1501 1501
                 $this->rootId = $parent->rootId;
1502 1502
             }
1503
-            $this->rootIdLoaded = true;
1503
+            $this->rootIdLoaded = TRUE;
1504 1504
         }
1505 1505
         return $this->rootId;
1506 1506
     }
@@ -1529,8 +1529,8 @@  discard block
 block discarded – undo
1529 1529
         // Is there no logical structure array yet?
1530 1530
         if (!$this->tableOfContentsLoaded) {
1531 1531
             // Get all logical structures.
1532
-            $this->getLogicalStructure('', true);
1533
-            $this->tableOfContentsLoaded = true;
1532
+            $this->getLogicalStructure('', TRUE);
1533
+            $this->tableOfContentsLoaded = TRUE;
1534 1534
         }
1535 1535
         return $this->tableOfContents;
1536 1536
     }
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
      *
1547 1547
      * @return string The document's thumbnail location
1548 1548
      */
1549
-    protected abstract function _getThumbnail($forceReload = false);
1549
+    protected abstract function _getThumbnail($forceReload = FALSE);
1550 1550
 
1551 1551
     /**
1552 1552
      * This returns the ID of the toplevel logical structure node
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
                 && $this->load($uid))) {
1628 1628
                 // Initialize core METS object.
1629 1629
                 $this->init();
1630
-                if ($this->getDocument() !== null) {
1630
+                if ($this->getDocument() !== NULL) {
1631 1631
                     // Cast to string for safety reasons.
1632 1632
                     $location = (string) $uid;
1633 1633
                     $this->establishRecordId($pid);
@@ -1685,30 +1685,30 @@  discard block
 block discarded – undo
1685 1685
             $this->parentId = $resArray['partof'];
1686 1686
             $this->thumbnail = $resArray['thumbnail'];
1687 1687
             $this->location = $resArray['location'];
1688
-            $this->thumbnailLoaded = true;
1688
+            $this->thumbnailLoaded = TRUE;
1689 1689
             // Load XML file if necessary...
1690 1690
             if (
1691
-                $this->getDocument() === null
1691
+                $this->getDocument() === NULL
1692 1692
                 && $this->load($this->location)
1693 1693
             ) {
1694 1694
                 // ...and set some basic properties.
1695 1695
                 $this->init();
1696 1696
             }
1697 1697
             // Do we have a METS / IIIF object now?
1698
-            if ($this->getDocument() !== null) {
1698
+            if ($this->getDocument() !== NULL) {
1699 1699
                 // Set new location if necessary.
1700 1700
                 if (!empty($location)) {
1701 1701
                     $this->location = $location;
1702 1702
                 }
1703 1703
                 // Document ready!
1704
-                $this->ready = true;
1704
+                $this->ready = TRUE;
1705 1705
             }
1706
-        } elseif ($this->getDocument() !== null) {
1706
+        } elseif ($this->getDocument() !== NULL) {
1707 1707
             // Set location as UID for documents not in database.
1708 1708
             $this->uid = $location;
1709 1709
             $this->location = $location;
1710 1710
             // Document ready!
1711
-            $this->ready = true;
1711
+            $this->ready = TRUE;
1712 1712
         } else {
1713 1713
             $this->logger->error('No document with UID ' . $uid . ' found or document not accessible');
1714 1714
         }
Please login to merge, or discard this patch.