Passed
Pull Request — master (#87)
by Alexander
02:55
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.
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
@@ -231,8 +226,7 @@  discard block
 block discarded – undo
231 226
      * @return void
232 227
      */
233 228
     //TODO: find better way to handle logger in static class
234
-    public static function log($message, $severity = 0)
235
-    {
229
+    public static function log($message, $severity = 0) {
236 230
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
237 231
 
238 232
         switch ($severity) {
@@ -262,8 +256,7 @@  discard block
 block discarded – undo
262 256
      *
263 257
      * @return mixed Hashed string or false on error
264 258
      */
265
-    public static function digest($string)
266
-    {
259
+    public static function digest($string) {
267 260
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
268 261
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
269 262
             return false;
@@ -282,8 +275,7 @@  discard block
 block discarded – undo
282 275
      *
283 276
      * @return mixed Encrypted string or false on error
284 277
      */
285
-    public static function encrypt($string)
286
-    {
278
+    public static function encrypt($string) {
287 279
         if (
288 280
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
289 281
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -316,8 +308,7 @@  discard block
 block discarded – undo
316 308
      *
317 309
      * @return string The unqualified class name
318 310
      */
319
-    public static function getUnqualifiedClassName($qualifiedClassname)
320
-    {
311
+    public static function getUnqualifiedClassName($qualifiedClassname) {
321 312
         $nameParts = explode('\\', $qualifiedClassname);
322 313
         return end($nameParts);
323 314
     }
@@ -331,8 +322,7 @@  discard block
 block discarded – undo
331 322
      *
332 323
      * @return string The cleaned up string
333 324
      */
334
-    public static function getCleanString($string)
335
-    {
325
+    public static function getCleanString($string) {
336 326
         // Convert to lowercase.
337 327
         $string = strtolower($string);
338 328
         // Remove non-alphanumeric characters.
@@ -353,8 +343,7 @@  discard block
 block discarded – undo
353 343
      *
354 344
      * @return array Array of hook objects for the class
355 345
      */
356
-    public static function getHookObjects($scriptRelPath)
357
-    {
346
+    public static function getHookObjects($scriptRelPath) {
358 347
         $hookObjects = [];
359 348
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
360 349
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -375,8 +364,7 @@  discard block
 block discarded – undo
375 364
      *
376 365
      * @return string "index_name" for the given UID
377 366
      */
378
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
379
-    {
367
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
380 368
         // Sanitize input.
381 369
         $uid = max(intval($uid), 0);
382 370
         if (
@@ -428,8 +416,7 @@  discard block
 block discarded – undo
428 416
      *
429 417
      * @return string "label" for the given UID
430 418
      */
431
-    public static function getLabelFromUid($uid, $table, $pid = -1)
432
-    {
419
+    public static function getLabelFromUid($uid, $table, $pid = -1) {
433 420
         // Sanitize input.
434 421
         $uid = max(intval($uid), 0);
435 422
         if (
@@ -479,8 +466,7 @@  discard block
 block discarded – undo
479 466
      *
480 467
      * @return string Localized full name of language or unchanged input
481 468
      */
482
-    public static function getLanguageName($code)
483
-    {
469
+    public static function getLanguageName($code) {
484 470
         // Analyze code and set appropriate ISO table.
485 471
         $isoCode = strtolower(trim($code));
486 472
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -525,8 +511,7 @@  discard block
 block discarded – undo
525 511
      *
526 512
      * @return string The translated string or the given key on failure
527 513
      */
528
-    public static function getMessage($key, $hsc = false, $default = '')
529
-    {
514
+    public static function getMessage($key, $hsc = false, $default = '') {
530 515
         // Set initial output to default value.
531 516
         $translated = (string) $default;
532 517
         // Load common messages file.
@@ -568,8 +553,7 @@  discard block
 block discarded – undo
568 553
      *
569 554
      * @return string "uid" for the given index_name
570 555
      */
571
-    public static function getUidFromIndexName($index_name, $table, $pid = -1)
572
-    {
556
+    public static function getUidFromIndexName($index_name, $table, $pid = -1) {
573 557
         if (
574 558
             !$index_name
575 559
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
@@ -620,8 +604,7 @@  discard block
 block discarded – undo
620 604
      *
621 605
      * @return string Uniform Resource Name as string
622 606
      */
623
-    public static function getURN($base, $id)
624
-    {
607
+    public static function getURN($base, $id) {
625 608
         $concordance = [
626 609
             '0' => 1,
627 610
             '1' => 2,
@@ -688,8 +671,7 @@  discard block
 block discarded – undo
688 671
      *
689 672
      * @return bool Is $id a valid PPN?
690 673
      */
691
-    public static function isPPN($id)
692
-    {
674
+    public static function isPPN($id) {
693 675
         return self::checkIdentifier($id, 'PPN');
694 676
     }
695 677
 
@@ -702,8 +684,7 @@  discard block
 block discarded – undo
702 684
      *
703 685
      * @return mixed Session value for given key or null on failure
704 686
      */
705
-    public static function loadFromSession($key)
706
-    {
687
+    public static function loadFromSession($key) {
707 688
         // Cast to string for security reasons.
708 689
         $key = (string) $key;
709 690
         if (!$key) {
@@ -735,8 +716,7 @@  discard block
 block discarded – undo
735 716
      *
736 717
      * @return array Merged array
737 718
      */
738
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
739
-    {
719
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
740 720
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
741 721
         return $original;
742 722
     }
@@ -753,8 +733,7 @@  discard block
 block discarded – undo
753 733
      *
754 734
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
755 735
      */
756
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
757
-    {
736
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) {
758 737
         if (
759 738
             \TYPO3_MODE === 'BE'
760 739
             && $GLOBALS['BE_USER']->isAdmin()
@@ -800,8 +779,7 @@  discard block
 block discarded – undo
800 779
      *
801 780
      * @return string All flash messages in the queue rendered as HTML.
802 781
      */
803
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
804
-    {
782
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
805 783
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
806 784
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
807 785
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -820,8 +798,7 @@  discard block
 block discarded – undo
820 798
      *
821 799
      * @return bool true on success, false on failure
822 800
      */
823
-    public static function saveToSession($value, $key)
824
-    {
801
+    public static function saveToSession($value, $key) {
825 802
         // Cast to string for security reasons.
826 803
         $key = (string) $key;
827 804
         if (!$key) {
@@ -853,8 +830,7 @@  discard block
 block discarded – undo
853 830
      *
854 831
      * @return string Localized label for $index_name
855 832
      */
856
-    public static function translate($index_name, $table, $pid)
857
-    {
833
+    public static function translate($index_name, $table, $pid) {
858 834
         // Load labels into static variable for future use.
859 835
         static $labels = [];
860 836
         // Sanitize input.
@@ -977,8 +953,7 @@  discard block
 block discarded – undo
977 953
      *
978 954
      * @return string Additional WHERE expression
979 955
      */
980
-    public static function whereExpression($table, $showHidden = false)
981
-    {
956
+    public static function whereExpression($table, $showHidden = false) {
982 957
         if (\TYPO3_MODE === 'FE') {
983 958
             // Should we ignore the record's hidden flag?
984 959
             $ignoreHide = 0;
@@ -1007,8 +982,7 @@  discard block
 block discarded – undo
1007 982
      *
1008 983
      * @access private
1009 984
      */
1010
-    private function __construct()
1011
-    {
985
+    private function __construct() {
1012 986
         // This is a static class, thus no instances should be created.
1013 987
     }
1014 988
 }
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.
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/Document.php 3 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
                     if ($fileContent !== false) {
682 682
                         $textFormat = $this->getTextFormat($fileContent);
683 683
                     } else {
684
-                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "' . $id . '"');
684
+                        $this->logger->warning('Couldn\'t load full text file for structure node @ID "'.$id.'"');
685 685
                         return $fullText;
686 686
                     }
687 687
                     break;
688 688
                 }
689 689
             }
690 690
         } else {
691
-            $this->logger->warning('Invalid structure node @ID "' . $id . '"');
691
+            $this->logger->warning('Invalid structure node @ID "'.$id.'"');
692 692
             return $fullText;
693 693
         }
694 694
         // Is this text format supported?
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
                     $textMiniOcr = $obj->getTextAsMiniOcr($ocrTextXml);
708 708
                     $this->rawTextArray[$id] = $textMiniOcr;
709 709
                 } else {
710
-                    $this->logger->warning('Invalid class/method "' . $class . '->getRawText()" for text format "' . $textFormat . '"');
710
+                    $this->logger->warning('Invalid class/method "'.$class.'->getRawText()" for text format "'.$textFormat.'"');
711 711
                 }
712 712
             }
713 713
             $fullText = $textMiniOcr;
714 714
         } else {
715
-            $this->logger->warning('Unsupported text format "' . $textFormat . '" in physical node with @ID "' . $id . '"');
715
+            $this->logger->warning('Unsupported text format "'.$textFormat.'" in physical node with @ID "'.$id.'"');
716 716
         }
717 717
         return $fullText;
718 718
     }
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
                     $title = self::getTitle($partof, true);
808 808
                 }
809 809
             } else {
810
-                $logger->warning('No document with UID ' . $uid . ' found or document not accessible');
810
+                $logger->warning('No document with UID '.$uid.' found or document not accessible');
811 811
             }
812 812
         } else {
813
-            $logger->error('Invalid UID ' . $uid . ' for document');
813
+            $logger->error('Invalid UID '.$uid.' for document');
814 814
         }
815 815
         return $title;
816 816
     }
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
             // the actual loading is format specific
946 946
             return $this->loadLocation($location);
947 947
         } else {
948
-            $this->logger->error('Invalid file location "' . $location . '" for document loading');
948
+            $this->logger->error('Invalid file location "'.$location.'" for document loading');
949 949
         }
950 950
         return false;
951 951
     }
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
             // Retain current PID.
1056 1056
             $pid = $this->pid;
1057 1057
         } elseif (!$pid) {
1058
-            $this->logger->error('Invalid PID ' . $pid . ' for document saving');
1058
+            $this->logger->error('Invalid PID '.$pid.' for document saving');
1059 1059
             return false;
1060 1060
         }
1061 1061
         // Set PID for metadata definitions.
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
         if ($resArray = $result->fetch()) {
1093 1093
             $structure = $resArray['uid'];
1094 1094
         } else {
1095
-            $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"');
1095
+            $this->logger->error('Could not identify document/structure type "'.$queryBuilder->expr()->literal($metadata['type'][0]).'"');
1096 1096
             return false;
1097 1097
         }
1098 1098
         $metadata['type'][0] = $structure;
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
         if ($core) {
1342 1342
             return Indexer::add($this, $core);
1343 1343
         } else {
1344
-            $this->logger->notice('Invalid UID "' . $core . '" for Solr core');
1344
+            $this->logger->notice('Invalid UID "'.$core.'" for Solr core');
1345 1345
             return false;
1346 1346
         }
1347 1347
     }
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
         // Set metadata definitions' PID.
1420 1420
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1421 1421
         if (!$cPid) {
1422
-            $this->logger->error('Invalid PID ' . $cPid . ' for metadata definitions');
1422
+            $this->logger->error('Invalid PID '.$cPid.' for metadata definitions');
1423 1423
             return [];
1424 1424
         }
1425 1425
         if (
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
             // Document ready!
1748 1748
             $this->ready = true;
1749 1749
         } else {
1750
-            $this->logger->error('No document with UID ' . $uid . ' found or document not accessible');
1750
+            $this->logger->error('No document with UID '.$uid.' found or document not accessible');
1751 1751
         }
1752 1752
     }
1753 1753
 
@@ -1762,12 +1762,12 @@  discard block
 block discarded – undo
1762 1762
      */
1763 1763
     public function __get($var)
1764 1764
     {
1765
-        $method = '_get' . ucfirst($var);
1765
+        $method = '_get'.ucfirst($var);
1766 1766
         if (
1767 1767
             !property_exists($this, $var)
1768 1768
             || !method_exists($this, $method)
1769 1769
         ) {
1770
-            $this->logger->warning('There is no getter function for property "' . $var . '"');
1770
+            $this->logger->warning('There is no getter function for property "'.$var.'"');
1771 1771
             return;
1772 1772
         } else {
1773 1773
             return $this->$method();
@@ -1800,12 +1800,12 @@  discard block
 block discarded – undo
1800 1800
      */
1801 1801
     public function __set($var, $value)
1802 1802
     {
1803
-        $method = '_set' . ucfirst($var);
1803
+        $method = '_set'.ucfirst($var);
1804 1804
         if (
1805 1805
             !property_exists($this, $var)
1806 1806
             || !method_exists($this, $method)
1807 1807
         ) {
1808
-            $this->logger->warning('There is no setter function for property "' . $var . '"');
1808
+            $this->logger->warning('There is no setter function for property "'.$var.'"');
1809 1809
         } else {
1810 1810
             $this->$method($value);
1811 1811
         }
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
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
740 734
 
741 735
         $title = '';
@@ -789,8 +783,7 @@  discard block
 block discarded – undo
789 783
      *
790 784
      * @return array The logical structure node's / resource's parsed metadata array
791 785
      */
792
-    public function getTitledata($cPid = 0)
793
-    {
786
+    public function getTitledata($cPid = 0) {
794 787
         $titledata = $this->getMetadata($this->_getToplevelId(), $cPid);
795 788
         // Add information from METS structural map to titledata array.
796 789
         if ($this instanceof MetsDocument) {
@@ -823,8 +816,7 @@  discard block
 block discarded – undo
823 816
      * @return int|bool: false if structure with $logId is not a child of this substructure,
824 817
      * or the actual depth.
825 818
      */
826
-    protected function getTreeDepth($structure, $depth, $logId)
827
-    {
819
+    protected function getTreeDepth($structure, $depth, $logId) {
828 820
         foreach ($structure as $element) {
829 821
             if ($element['id'] == $logId) {
830 822
                 return $depth;
@@ -846,8 +838,7 @@  discard block
 block discarded – undo
846 838
      * @param string $logId: The id of the logical structure element whose depth is requested
847 839
      * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC.
848 840
      */
849
-    public function getStructureDepth($logId)
850
-    {
841
+    public function getStructureDepth($logId) {
851 842
         return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId);
852 843
     }
853 844
 
@@ -897,8 +888,7 @@  discard block
 block discarded – undo
897 888
      *
898 889
      * @return bool true on success or false on failure
899 890
      */
900
-    protected function load($location)
901
-    {
891
+    protected function load($location) {
902 892
         // Load XML / JSON-LD file.
903 893
         if (GeneralUtility::isValidUrl($location)) {
904 894
             // Load extension configuration
@@ -931,8 +921,7 @@  discard block
 block discarded – undo
931 921
      *
932 922
      * @return void
933 923
      */
934
-    protected function loadFormats()
935
-    {
924
+    protected function loadFormats() {
936 925
         if (!$this->formatsLoaded) {
937 926
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
938 927
                 ->getQueryBuilderForTable('tx_dlf_formats');
@@ -972,8 +961,7 @@  discard block
 block discarded – undo
972 961
      *
973 962
      * @return void
974 963
      */
975
-    public function registerNamespaces(&$obj)
976
-    {
964
+    public function registerNamespaces(&$obj) {
977 965
         // 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.
978 966
         $this->loadFormats();
979 967
         // Do we have a \SimpleXMLElement or \DOMXPath object?
@@ -1002,8 +990,7 @@  discard block
 block discarded – undo
1002 990
      *
1003 991
      * @return bool true on success or false on failure
1004 992
      */
1005
-    public function save($pid = 0, $core = 0, $owner = null)
1006
-    {
993
+    public function save($pid = 0, $core = 0, $owner = null) {
1007 994
         if (\TYPO3_MODE !== 'BE') {
1008 995
             $this->logger->error('Saving a document is only allowed in the backend');
1009 996
             return false;
@@ -1331,8 +1318,7 @@  discard block
 block discarded – undo
1331 1318
      *
1332 1319
      * @return int The PID of the metadata definitions
1333 1320
      */
1334
-    protected function _getCPid()
1335
-    {
1321
+    protected function _getCPid() {
1336 1322
         return $this->cPid;
1337 1323
     }
1338 1324
 
@@ -1343,8 +1329,7 @@  discard block
 block discarded – undo
1343 1329
      *
1344 1330
      * @return bool Are there any fulltext files available?
1345 1331
      */
1346
-    protected function _getHasFulltext()
1347
-    {
1332
+    protected function _getHasFulltext() {
1348 1333
         $this->ensureHasFulltextIsSet();
1349 1334
         return $this->hasFulltext;
1350 1335
     }
@@ -1356,8 +1341,7 @@  discard block
 block discarded – undo
1356 1341
      *
1357 1342
      * @return string The location of the document
1358 1343
      */
1359
-    protected function _getLocation()
1360
-    {
1344
+    protected function _getLocation() {
1361 1345
         return $this->location;
1362 1346
     }
1363 1347
 
@@ -1379,8 +1363,7 @@  discard block
 block discarded – undo
1379 1363
      *
1380 1364
      * @return array Array of metadata with their corresponding logical structure node ID as key
1381 1365
      */
1382
-    protected function _getMetadataArray()
1383
-    {
1366
+    protected function _getMetadataArray() {
1384 1367
         // Set metadata definitions' PID.
1385 1368
         $cPid = ($this->cPid ? $this->cPid : $this->pid);
1386 1369
         if (!$cPid) {
@@ -1405,8 +1388,7 @@  discard block
 block discarded – undo
1405 1388
      *
1406 1389
      * @return int The total number of pages and/or tracks
1407 1390
      */
1408
-    protected function _getNumPages()
1409
-    {
1391
+    protected function _getNumPages() {
1410 1392
         $this->_getPhysicalStructure();
1411 1393
         return $this->numPages;
1412 1394
     }
@@ -1418,8 +1400,7 @@  discard block
 block discarded – undo
1418 1400
      *
1419 1401
      * @return int The UID of the parent document or zero if not applicable
1420 1402
      */
1421
-    protected function _getParentId()
1422
-    {
1403
+    protected function _getParentId() {
1423 1404
         return $this->parentId;
1424 1405
     }
1425 1406
 
@@ -1442,8 +1423,7 @@  discard block
 block discarded – undo
1442 1423
      *
1443 1424
      * @return array Array of elements' type, label and file representations ordered by @ID attribute / Canvas order
1444 1425
      */
1445
-    protected function _getPhysicalStructureInfo()
1446
-    {
1426
+    protected function _getPhysicalStructureInfo() {
1447 1427
         // Is there no physical structure array yet?
1448 1428
         if (!$this->physicalStructureLoaded) {
1449 1429
             // Build physical structure array.
@@ -1459,8 +1439,7 @@  discard block
 block discarded – undo
1459 1439
      *
1460 1440
      * @return int The PID of the document or zero if not in database
1461 1441
      */
1462
-    protected function _getPid()
1463
-    {
1442
+    protected function _getPid() {
1464 1443
         return $this->pid;
1465 1444
     }
1466 1445
 
@@ -1471,8 +1450,7 @@  discard block
 block discarded – undo
1471 1450
      *
1472 1451
      * @return bool Is the document instantiated successfully?
1473 1452
      */
1474
-    protected function _getReady()
1475
-    {
1453
+    protected function _getReady() {
1476 1454
         return $this->ready;
1477 1455
     }
1478 1456
 
@@ -1483,8 +1461,7 @@  discard block
 block discarded – undo
1483 1461
      *
1484 1462
      * @return mixed The METS file's / IIIF manifest's record identifier
1485 1463
      */
1486
-    protected function _getRecordId()
1487
-    {
1464
+    protected function _getRecordId() {
1488 1465
         return $this->recordId;
1489 1466
     }
1490 1467
 
@@ -1495,8 +1472,7 @@  discard block
 block discarded – undo
1495 1472
      *
1496 1473
      * @return int The UID of the root document or zero if not applicable
1497 1474
      */
1498
-    protected function _getRootId()
1499
-    {
1475
+    protected function _getRootId() {
1500 1476
         if (!$this->rootIdLoaded) {
1501 1477
             if ($this->parentId) {
1502 1478
                 $parent = self::getInstance($this->parentId, $this->pid);
@@ -1526,8 +1502,7 @@  discard block
 block discarded – undo
1526 1502
      *
1527 1503
      * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved
1528 1504
      */
1529
-    protected function _getTableOfContents()
1530
-    {
1505
+    protected function _getTableOfContents() {
1531 1506
         // Is there no logical structure array yet?
1532 1507
         if (!$this->tableOfContentsLoaded) {
1533 1508
             // Get all logical structures.
@@ -1568,8 +1543,7 @@  discard block
 block discarded – undo
1568 1543
      *
1569 1544
      * @return mixed The UID or the URL of the document
1570 1545
      */
1571
-    protected function _getUid()
1572
-    {
1546
+    protected function _getUid() {
1573 1547
         return $this->uid;
1574 1548
     }
1575 1549
 
@@ -1582,8 +1556,7 @@  discard block
 block discarded – undo
1582 1556
      *
1583 1557
      * @return void
1584 1558
      */
1585
-    protected function _setCPid($value)
1586
-    {
1559
+    protected function _setCPid($value) {
1587 1560
         $this->cPid = max(intval($value), 0);
1588 1561
     }
1589 1562
 
@@ -1594,8 +1567,7 @@  discard block
 block discarded – undo
1594 1567
      *
1595 1568
      * @return void
1596 1569
      */
1597
-    protected function __clone()
1598
-    {
1570
+    protected function __clone() {
1599 1571
         // This method is defined as protected because singleton objects should not be cloned.
1600 1572
     }
1601 1573
 
@@ -1612,8 +1584,7 @@  discard block
 block discarded – undo
1612 1584
      *
1613 1585
      * @return void
1614 1586
      */
1615
-    protected function __construct($uid, $pid, $preloadedDocument)
1616
-    {
1587
+    protected function __construct($uid, $pid, $preloadedDocument) {
1617 1588
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1618 1589
             ->getQueryBuilderForTable('tx_dlf_documents');
1619 1590
         $location = '';
@@ -1725,8 +1696,7 @@  discard block
 block discarded – undo
1725 1696
      *
1726 1697
      * @return mixed Value of $this->$var
1727 1698
      */
1728
-    public function __get($var)
1729
-    {
1699
+    public function __get($var) {
1730 1700
         $method = '_get' . ucfirst($var);
1731 1701
         if (
1732 1702
             !property_exists($this, $var)
@@ -1748,8 +1718,7 @@  discard block
 block discarded – undo
1748 1718
      *
1749 1719
      * @return bool true if variable is set and not empty, false otherwise
1750 1720
      */
1751
-    public function __isset($var)
1752
-    {
1721
+    public function __isset($var) {
1753 1722
         return !empty($this->__get($var));
1754 1723
     }
1755 1724
 
@@ -1763,8 +1732,7 @@  discard block
 block discarded – undo
1763 1732
      *
1764 1733
      * @return void
1765 1734
      */
1766
-    public function __set($var, $value)
1767
-    {
1735
+    public function __set($var, $value) {
1768 1736
         $method = '_set' . ucfirst($var);
1769 1737
         if (
1770 1738
             !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
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
740 740
 
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
                     && intval($partof)
770 770
                     && $partof != $uid
771 771
                 ) {
772
-                    $title = self::getTitle($partof, true);
772
+                    $title = self::getTitle($partof, TRUE);
773 773
                 }
774 774
             } else {
775 775
                 $logger->warning('No document with UID ' . $uid . ' found or document not accessible');
@@ -830,12 +830,12 @@  discard block
 block discarded – undo
830 830
                 return $depth;
831 831
             } elseif (array_key_exists('children', $element)) {
832 832
                 $foundInChildren = $this->getTreeDepth($element['children'], $depth + 1, $logId);
833
-                if ($foundInChildren !== false) {
833
+                if ($foundInChildren !== FALSE) {
834 834
                     return $foundInChildren;
835 835
                 }
836 836
             }
837 837
         }
838
-        return false;
838
+        return FALSE;
839 839
     }
840 840
 
841 841
     /**
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
         } else {
913 913
             $this->logger->error('Invalid file location "' . $location . '" for document loading');
914 914
         }
915
-        return false;
915
+        return FALSE;
916 916
     }
917 917
 
918 918
     /**
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                     'class' => $resArray['class']
960 960
                 ];
961 961
             }
962
-            $this->formatsLoaded = true;
962
+            $this->formatsLoaded = TRUE;
963 963
         }
964 964
     }
965 965
 
@@ -1002,11 +1002,11 @@  discard block
 block discarded – undo
1002 1002
      *
1003 1003
      * @return bool true on success or false on failure
1004 1004
      */
1005
-    public function save($pid = 0, $core = 0, $owner = null)
1005
+    public function save($pid = 0, $core = 0, $owner = NULL)
1006 1006
     {
1007 1007
         if (\TYPO3_MODE !== 'BE') {
1008 1008
             $this->logger->error('Saving a document is only allowed in the backend');
1009
-            return false;
1009
+            return FALSE;
1010 1010
         }
1011 1011
         // Make sure $pid is a non-negative integer.
1012 1012
         $pid = max(intval($pid), 0);
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
             $pid = $this->pid;
1022 1022
         } elseif (!$pid) {
1023 1023
             $this->logger->error('Invalid PID ' . $pid . ' for document saving');
1024
-            return false;
1024
+            return FALSE;
1025 1025
         }
1026 1026
         // Set PID for metadata definitions.
1027 1027
         $this->cPid = $pid;
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
         // Check for record identifier.
1035 1035
         if (empty($metadata['record_id'][0])) {
1036 1036
             $this->logger->error('No record identifier found to avoid duplication');
1037
-            return false;
1037
+            return FALSE;
1038 1038
         }
1039 1039
         // Load plugin configuration.
1040 1040
         $conf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey);
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             $structure = $resArray['uid'];
1059 1059
         } else {
1060 1060
             $this->logger->error('Could not identify document/structure type "' . $queryBuilder->expr()->literal($metadata['type'][0]) . '"');
1061
-            return false;
1061
+            return FALSE;
1062 1062
         }
1063 1063
         $metadata['type'][0] = $structure;
1064 1064
 
@@ -1118,9 +1118,9 @@  discard block
 block discarded – undo
1118 1118
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1119 1119
                     Helper::addMessage(
1120 1120
                         htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])),
1121
-                        Helper::getMessage('flash.attention', true),
1121
+                        Helper::getMessage('flash.attention', TRUE),
1122 1122
                         \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1123
-                        true
1123
+                        TRUE
1124 1124
                     );
1125 1125
                 }
1126 1126
             }
@@ -1171,9 +1171,9 @@  discard block
 block discarded – undo
1171 1171
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1172 1172
                     Helper::addMessage(
1173 1173
                         htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)),
1174
-                        Helper::getMessage('flash.attention', true),
1174
+                        Helper::getMessage('flash.attention', TRUE),
1175 1175
                         \TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
1176
-                        true
1176
+                        TRUE
1177 1177
                     );
1178 1178
                 }
1179 1179
             }
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
             'author' => implode('; ', $metadata['author']),
1262 1262
             'year' => implode('; ', $metadata['year']),
1263 1263
             'place' => implode('; ', $metadata['place']),
1264
-            'thumbnail' => $this->_getThumbnail(true),
1264
+            'thumbnail' => $this->_getThumbnail(TRUE),
1265 1265
             'metadata' => serialize($listed),
1266 1266
             'metadata_sorting' => serialize($sortable),
1267 1267
             'structure' => $metadata['type'][0],
@@ -1297,9 +1297,9 @@  discard block
 block discarded – undo
1297 1297
         if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
1298 1298
             Helper::addMessage(
1299 1299
                 htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)),
1300
-                Helper::getMessage('flash.done', true),
1300
+                Helper::getMessage('flash.done', TRUE),
1301 1301
                 \TYPO3\CMS\Core\Messaging\FlashMessage::OK,
1302
-                true
1302
+                TRUE
1303 1303
             );
1304 1304
         }
1305 1305
         // Add document to index.
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
             return Indexer::add($this, $core);
1308 1308
         } else {
1309 1309
             $this->logger->notice('Invalid UID "' . $core . '" for Solr core');
1310
-            return false;
1310
+            return FALSE;
1311 1311
         }
1312 1312
     }
1313 1313
 
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
         ) {
1394 1394
             $this->prepareMetadataArray($cPid);
1395 1395
             $this->metadataArray[0] = $cPid;
1396
-            $this->metadataArrayLoaded = true;
1396
+            $this->metadataArrayLoaded = TRUE;
1397 1397
         }
1398 1398
         return $this->metadataArray;
1399 1399
     }
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
                 $parent = self::getInstance($this->parentId, $this->pid);
1503 1503
                 $this->rootId = $parent->rootId;
1504 1504
             }
1505
-            $this->rootIdLoaded = true;
1505
+            $this->rootIdLoaded = TRUE;
1506 1506
         }
1507 1507
         return $this->rootId;
1508 1508
     }
@@ -1531,8 +1531,8 @@  discard block
 block discarded – undo
1531 1531
         // Is there no logical structure array yet?
1532 1532
         if (!$this->tableOfContentsLoaded) {
1533 1533
             // Get all logical structures.
1534
-            $this->getLogicalStructure('', true);
1535
-            $this->tableOfContentsLoaded = true;
1534
+            $this->getLogicalStructure('', TRUE);
1535
+            $this->tableOfContentsLoaded = TRUE;
1536 1536
         }
1537 1537
         return $this->tableOfContents;
1538 1538
     }
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
      *
1549 1549
      * @return string The document's thumbnail location
1550 1550
      */
1551
-    protected abstract function _getThumbnail($forceReload = false);
1551
+    protected abstract function _getThumbnail($forceReload = FALSE);
1552 1552
 
1553 1553
     /**
1554 1554
      * This returns the ID of the toplevel logical structure node
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
                 && $this->load($uid))) {
1630 1630
                 // Initialize core METS object.
1631 1631
                 $this->init();
1632
-                if ($this->getDocument() !== null) {
1632
+                if ($this->getDocument() !== NULL) {
1633 1633
                     // Cast to string for safety reasons.
1634 1634
                     $location = (string) $uid;
1635 1635
                     $this->establishRecordId($pid);
@@ -1687,30 +1687,30 @@  discard block
 block discarded – undo
1687 1687
             $this->parentId = $resArray['partof'];
1688 1688
             $this->thumbnail = $resArray['thumbnail'];
1689 1689
             $this->location = $resArray['location'];
1690
-            $this->thumbnailLoaded = true;
1690
+            $this->thumbnailLoaded = TRUE;
1691 1691
             // Load XML file if necessary...
1692 1692
             if (
1693
-                $this->getDocument() === null
1693
+                $this->getDocument() === NULL
1694 1694
                 && $this->load($this->location)
1695 1695
             ) {
1696 1696
                 // ...and set some basic properties.
1697 1697
                 $this->init();
1698 1698
             }
1699 1699
             // Do we have a METS / IIIF object now?
1700
-            if ($this->getDocument() !== null) {
1700
+            if ($this->getDocument() !== NULL) {
1701 1701
                 // Set new location if necessary.
1702 1702
                 if (!empty($location)) {
1703 1703
                     $this->location = $location;
1704 1704
                 }
1705 1705
                 // Document ready!
1706
-                $this->ready = true;
1706
+                $this->ready = TRUE;
1707 1707
             }
1708
-        } elseif ($this->getDocument() !== null) {
1708
+        } elseif ($this->getDocument() !== NULL) {
1709 1709
             // Set location as UID for documents not in database.
1710 1710
             $this->uid = $location;
1711 1711
             $this->location = $location;
1712 1712
             // Document ready!
1713
-            $this->ready = true;
1713
+            $this->ready = TRUE;
1714 1714
         } else {
1715 1715
             $this->logger->error('No document with UID ' . $uid . ' found or document not accessible');
1716 1716
         }
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/Common/Indexer.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 if ($parent->ready) {
106 106
                     $success = self::add($parent, $core);
107 107
                 } else {
108
-                    $logger->error('Could not load parent document with UID ' . $doc->parentId);
108
+                    $logger->error('Could not load parent document with UID '.$doc->parentId);
109 109
                     return false;
110 110
                 }
111 111
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 self::$processedDocs[] = $doc->uid;
115 115
                 // Delete old Solr documents.
116 116
                 $updateQuery = self::$solr->service->createUpdate();
117
-                $updateQuery->addDeleteQuery('uid:' . $doc->uid);
117
+                $updateQuery->addDeleteQuery('uid:'.$doc->uid);
118 118
                 self::$solr->service->update($updateQuery);
119 119
 
120 120
                 // Index every logical unit as separate Solr document.
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
             } catch (\Exception $e) {
180 180
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
181 181
                     Helper::addMessage(
182
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
182
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
183 183
                         Helper::getMessage('flash.error', true),
184 184
                         FlashMessage::ERROR,
185 185
                         true,
186 186
                         'core.template.flashMessages'
187 187
                     );
188 188
                 }
189
-                $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
189
+                $logger->error('Apache Solr threw exception: "'.$e->getMessage().'"');
190 190
                 return false;
191 191
             }
192 192
         } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         // Sanitize input.
222 222
         $pid = max(intval($pid), 0);
223 223
         if (!$pid) {
224
-            $logger->error('Invalid PID ' . $pid . ' for metadata configuration');
224
+            $logger->error('Invalid PID '.$pid.' for metadata configuration');
225 225
             return '';
226 226
         }
227 227
         // Load metadata configuration.
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u');
231 231
         $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u');
232 232
         $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u');
233
-        $index_name .= '_' . $suffix;
233
+        $index_name .= '_'.$suffix;
234 234
         return $index_name;
235 235
     }
236 236
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             $updateQuery = self::$solr->service->createUpdate();
341 341
             $solrDoc = $updateQuery->createDocument();
342 342
             // Create unique identifier from document's UID and unit's XML ID.
343
-            $solrDoc->setField('id', $doc->uid . $logicalUnit['id']);
343
+            $solrDoc->setField('id', $doc->uid.$logicalUnit['id']);
344 344
             $solrDoc->setField('uid', $doc->uid);
345 345
             $solrDoc->setField('pid', $doc->pid);
346 346
             if (MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) {
@@ -381,11 +381,11 @@  discard block
 block discarded – undo
381 381
                     $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]);
382 382
                     if (in_array($index_name, self::$fields['sortables'])) {
383 383
                         // Add sortable fields to index.
384
-                        $solrDoc->setField($index_name . '_sorting', $metadata[$index_name . '_sorting'][0]);
384
+                        $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]);
385 385
                     }
386 386
                     if (in_array($index_name, self::$fields['facets'])) {
387 387
                         // Add facets to index.
388
-                        $solrDoc->setField($index_name . '_faceting', $data);
388
+                        $solrDoc->setField($index_name.'_faceting', $data);
389 389
                     }
390 390
                     if (in_array($index_name, self::$fields['autocomplete'])) {
391 391
                         $autocomplete = array_merge($autocomplete, $data);
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
             } catch (\Exception $e) {
411 411
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
412 412
                     Helper::addMessage(
413
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
413
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
414 414
                         Helper::getMessage('flash.error', true),
415 415
                         FlashMessage::ERROR,
416 416
                         true,
417 417
                         'core.template.flashMessages'
418 418
                     );
419 419
                 }
420
-                $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
420
+                $logger->error('Apache Solr threw exception: "'.$e->getMessage().'"');
421 421
                 return false;
422 422
             }
423 423
         }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             $updateQuery = self::$solr->service->createUpdate();
458 458
             $solrDoc = $updateQuery->createDocument();
459 459
             // Create unique identifier from document's UID and unit's XML ID.
460
-            $solrDoc->setField('id', $doc->uid . $physicalUnit['id']);
460
+            $solrDoc->setField('id', $doc->uid.$physicalUnit['id']);
461 461
             $solrDoc->setField('uid', $doc->uid);
462 462
             $solrDoc->setField('pid', $doc->pid);
463 463
             $solrDoc->setField('page', $page);
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                             }
493 493
                         }
494 494
                         // Add facets to index.
495
-                        $solrDoc->setField($index_name . '_faceting', $data);
495
+                        $solrDoc->setField($index_name.'_faceting', $data);
496 496
                     }
497 497
                 }
498 498
             }
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
             } catch (\Exception $e) {
510 510
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
511 511
                     Helper::addMessage(
512
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
512
+                        Helper::getMessage('flash.solrException', true).'<br />'.htmlspecialchars($e->getMessage()),
513 513
                         Helper::getMessage('flash.error', true),
514 514
                         FlashMessage::ERROR,
515 515
                         true,
516 516
                         'core.template.flashMessages'
517 517
                     );
518 518
                 }
519
-                $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
519
+                $logger->error('Apache Solr threw exception: "'.$e->getMessage().'"');
520 520
                 return false;
521 521
             }
522 522
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  * @subpackage dlf
30 30
  * @access public
31 31
  */
32
-class Indexer
33
-{
32
+class Indexer {
34 33
     /**
35 34
      * The extension key
36 35
      *
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
      *
92 91
      * @return bool true on success or false on failure
93 92
      */
94
-    public static function add(Document &$doc, $core = 0)
95
-    {
93
+    public static function add(Document &$doc, $core = 0) {
96 94
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
97 95
 
98 96
         if (in_array($doc->uid, self::$processedDocs)) {
@@ -214,8 +212,7 @@  discard block
 block discarded – undo
214 212
      *
215 213
      * @return string The field's dynamic index name
216 214
      */
217
-    public static function getIndexFieldName($index_name, $pid = 0)
218
-    {
215
+    public static function getIndexFieldName($index_name, $pid = 0) {
219 216
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
220 217
 
221 218
         // Sanitize input.
@@ -243,8 +240,7 @@  discard block
 block discarded – undo
243 240
      *
244 241
      * @return void
245 242
      */
246
-    protected static function loadIndexConf($pid)
247
-    {
243
+    protected static function loadIndexConf($pid) {
248 244
         if (!self::$fieldsLoaded) {
249 245
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
250 246
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -314,8 +310,7 @@  discard block
 block discarded – undo
314 310
      *
315 311
      * @return bool true on success or false on failure
316 312
      */
317
-    protected static function processLogical(Document &$doc, array $logicalUnit)
318
-    {
313
+    protected static function processLogical(Document &$doc, array $logicalUnit) {
319 314
         $logger = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
320 315
 
321 316
         $success = true;
@@ -446,8 +441,7 @@  discard block
 block discarded – undo
446 441
      *
447 442
      * @return bool true on success or false on failure
448 443
      */
449
-    protected static function processPhysical(Document &$doc, $page, array $physicalUnit)
450
-    {
444
+    protected static function processPhysical(Document &$doc, $page, array $physicalUnit) {
451 445
         $logger = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
452 446
 
453 447
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
@@ -533,8 +527,7 @@  discard block
 block discarded – undo
533 527
      *
534 528
      * @return bool true on success or false on failure
535 529
      */
536
-    protected static function solrConnect($core, $pid = 0)
537
-    {
530
+    protected static function solrConnect($core, $pid = 0) {
538 531
         // Get Solr instance.
539 532
         if (!self::$solr) {
540 533
             // Connect to Solr server.
@@ -557,8 +550,7 @@  discard block
 block discarded – undo
557 550
      *
558 551
      * @access private
559 552
      */
560
-    private function __construct()
561
-    {
553
+    private function __construct() {
562 554
         // This is a static class, thus no instances should be created.
563 555
     }
564 556
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @var bool
64 64
      * @access protected
65 65
      */
66
-    protected static $fieldsLoaded = false;
66
+    protected static $fieldsLoaded = FALSE;
67 67
 
68 68
     /**
69 69
      * List of already processed documents
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
97 97
 
98 98
         if (in_array($doc->uid, self::$processedDocs)) {
99
-            return true;
99
+            return TRUE;
100 100
         } elseif (self::solrConnect($core, $doc->pid)) {
101
-            $success = true;
101
+            $success = TRUE;
102 102
             // Handle multi-volume documents.
103 103
             if ($doc->parentId) {
104
-                $parent = Document::getInstance($doc->parentId, 0, true);
104
+                $parent = Document::getInstance($doc->parentId, 0, TRUE);
105 105
                 if ($parent->ready) {
106 106
                     $success = self::add($parent, $core);
107 107
                 } else {
108 108
                     $logger->error('Could not load parent document with UID ' . $doc->parentId);
109
-                    return false;
109
+                    return FALSE;
110 110
                 }
111 111
             }
112 112
             try {
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
                     if ($success) {
161 161
                         Helper::addMessage(
162 162
                             htmlspecialchars(sprintf(Helper::getMessage('flash.documentIndexed'), $resArray['title'], $doc->uid)),
163
-                            Helper::getMessage('flash.done', true),
163
+                            Helper::getMessage('flash.done', TRUE),
164 164
                             FlashMessage::OK,
165
-                            true,
165
+                            TRUE,
166 166
                             'core.template.flashMessages'
167 167
                         );
168 168
                     } else {
169 169
                         Helper::addMessage(
170 170
                             htmlspecialchars(sprintf(Helper::getMessage('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
171
-                            Helper::getMessage('flash.error', true),
171
+                            Helper::getMessage('flash.error', TRUE),
172 172
                             FlashMessage::ERROR,
173
-                            true,
173
+                            TRUE,
174 174
                             'core.template.flashMessages'
175 175
                         );
176 176
                     }
@@ -179,28 +179,28 @@  discard block
 block discarded – undo
179 179
             } catch (\Exception $e) {
180 180
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
181 181
                     Helper::addMessage(
182
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
183
-                        Helper::getMessage('flash.error', true),
182
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
183
+                        Helper::getMessage('flash.error', TRUE),
184 184
                         FlashMessage::ERROR,
185
-                        true,
185
+                        TRUE,
186 186
                         'core.template.flashMessages'
187 187
                     );
188 188
                 }
189 189
                 $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
190
-                return false;
190
+                return FALSE;
191 191
             }
192 192
         } else {
193 193
             if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
194 194
                 Helper::addMessage(
195
-                    Helper::getMessage('flash.solrNoConnection', true),
196
-                    Helper::getMessage('flash.warning', true),
195
+                    Helper::getMessage('flash.solrNoConnection', TRUE),
196
+                    Helper::getMessage('flash.warning', TRUE),
197 197
                     FlashMessage::WARNING,
198
-                    true,
198
+                    TRUE,
199 199
                     'core.template.flashMessages'
200 200
                 );
201 201
             }
202 202
             $logger->error('Could not connect to Apache Solr server');
203
-            return false;
203
+            return FALSE;
204 204
         }
205 205
     }
206 206
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
                 if ($indexing['index_boost'] > 0.0) {
298 298
                     self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']);
299 299
                 } else {
300
-                    self::$fields['fieldboost'][$indexing['index_name']] = false;
300
+                    self::$fields['fieldboost'][$indexing['index_name']] = FALSE;
301 301
                 }
302 302
             }
303
-            self::$fieldsLoaded = true;
303
+            self::$fieldsLoaded = TRUE;
304 304
         }
305 305
     }
306 306
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         $logger = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__);
320 320
 
321
-        $success = true;
321
+        $success = TRUE;
322 322
         // Get metadata for logical unit.
323 323
         $metadata = $doc->metadataArray[$logicalUnit['id']];
324 324
         if (!empty($metadata)) {
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $solrDoc->setField('root', $doc->rootId);
356 356
             $solrDoc->setField('sid', $logicalUnit['id']);
357 357
             // There can be only one toplevel unit per UID, independently of backend configuration
358
-            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? true : false);
358
+            $solrDoc->setField('toplevel', $logicalUnit['id'] == $doc->toplevelId ? TRUE : FALSE);
359 359
             $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']);
360 360
             $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']);
361 361
             $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']);
@@ -410,15 +410,15 @@  discard block
 block discarded – undo
410 410
             } catch (\Exception $e) {
411 411
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
412 412
                     Helper::addMessage(
413
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
414
-                        Helper::getMessage('flash.error', true),
413
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
414
+                        Helper::getMessage('flash.error', TRUE),
415 415
                         FlashMessage::ERROR,
416
-                        true,
416
+                        TRUE,
417 417
                         'core.template.flashMessages'
418 418
                     );
419 419
                 }
420 420
                 $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
421
-                return false;
421
+                return FALSE;
422 422
             }
423 423
         }
424 424
         // Check for child elements...
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             $solrDoc->setField('partof', $doc->parentId);
472 472
             $solrDoc->setField('root', $doc->rootId);
473 473
             $solrDoc->setField('sid', $physicalUnit['id']);
474
-            $solrDoc->setField('toplevel', false);
474
+            $solrDoc->setField('toplevel', FALSE);
475 475
             $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']);
476 476
             $solrDoc->setField('collection', $doc->metadataArray[$doc->toplevelId]['collection']);
477 477
 
@@ -509,18 +509,18 @@  discard block
 block discarded – undo
509 509
             } catch (\Exception $e) {
510 510
                 if (!(\TYPO3_REQUESTTYPE & \TYPO3_REQUESTTYPE_CLI)) {
511 511
                     Helper::addMessage(
512
-                        Helper::getMessage('flash.solrException', true) . '<br />' . htmlspecialchars($e->getMessage()),
513
-                        Helper::getMessage('flash.error', true),
512
+                        Helper::getMessage('flash.solrException', TRUE) . '<br />' . htmlspecialchars($e->getMessage()),
513
+                        Helper::getMessage('flash.error', TRUE),
514 514
                         FlashMessage::ERROR,
515
-                        true,
515
+                        TRUE,
516 516
                         'core.template.flashMessages'
517 517
                     );
518 518
                 }
519 519
                 $logger->error('Apache Solr threw exception: "' . $e->getMessage() . '"');
520
-                return false;
520
+                return FALSE;
521 521
             }
522 522
         }
523
-        return true;
523
+        return TRUE;
524 524
     }
525 525
 
526 526
     /**
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
                     self::loadIndexConf($pid);
547 547
                 }
548 548
             } else {
549
-                return false;
549
+                return FALSE;
550 550
             }
551 551
         }
552
-        return true;
552
+        return TRUE;
553 553
     }
554 554
 
555 555
     /**
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.