Passed
Pull Request — master (#106)
by
unknown
03:42
created
Classes/Common/Helper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
143 143
                     return false;
144 144
                 } elseif ($checksum == 10) {
145
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
145
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
146 146
                 } elseif (substr($id, -1, 1) != $checksum) {
147 147
                     return false;
148 148
                 }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
315 315
         // Merge initialisation vector and encrypted data.
316 316
         if ($encrypted !== false) {
317
-            $encrypted = base64_encode($iv . $encrypted);
317
+            $encrypted = base64_encode($iv.$encrypted);
318 318
         }
319 319
         return $encrypted;
320 320
     }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
     public static function getHookObjects($scriptRelPath)
369 369
     {
370 370
         $hookObjects = [];
371
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
372
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
371
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
372
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
373 373
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
374 374
             }
375 375
         }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             !$uid
396 396
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
397 397
         ) {
398
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
398
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
399 399
             return '';
400 400
         }
401 401
 
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
         // Should we check for a specific PID, too?
407 407
         if ($pid !== -1) {
408 408
             $pid = max(intval($pid), 0);
409
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
409
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
410 410
         }
411 411
 
412 412
         // Get index_name from database.
413 413
         $result = $queryBuilder
414
-            ->select($table . '.index_name AS index_name')
414
+            ->select($table.'.index_name AS index_name')
415 415
             ->from($table)
416 416
             ->where(
417
-                $queryBuilder->expr()->eq($table . '.uid', $uid),
417
+                $queryBuilder->expr()->eq($table.'.uid', $uid),
418 418
                 $where,
419 419
                 self::whereExpression($table)
420 420
             )
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         if ($resArray = $result->fetch()) {
425 425
             return $resArray['index_name'];
426 426
         } else {
427
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
427
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
428 428
             return '';
429 429
         }
430 430
     }
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
         // Analyze code and set appropriate ISO table.
444 444
         $isoCode = strtolower(trim($code));
445 445
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
446
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml';
446
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml';
447 447
         } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
448
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml';
448
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml';
449 449
         } else {
450 450
             // No ISO code, return unchanged.
451 451
             return $code;
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
                 $lang = $languageService->getLLL($isoCode, $iso639);
464 464
             }
465 465
         } else {
466
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
466
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
467 467
             return $code;
468 468
         }
469 469
         if (!empty($lang)) {
470 470
             return $lang;
471 471
         } else {
472
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
472
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
473 473
             return $code;
474 474
         }
475 475
     }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             '-' => 39,
565 565
             ':' => 17,
566 566
         ];
567
-        $urn = strtolower($base . $id);
567
+        $urn = strtolower($base.$id);
568 568
         if (preg_match('/[^a-z0-9:-]/', $urn)) {
569 569
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
570 570
             return '';
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
579 579
         }
580 580
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
581
-        return $base . $id . $checksum;
581
+        return $base.$id.$checksum;
582 582
     }
583 583
 
584 584
     /**
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         // Sanitize input.
673 673
         $pid = max(intval($pid), 0);
674 674
         if (!$pid) {
675
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
675
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
676 676
             return $index_name;
677 677
         }
678 678
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
         // First fetch the uid of the received index_name
695 695
         $result = $queryBuilder
696 696
             ->select(
697
-                $table . '.uid AS uid',
698
-                $table . '.l18n_parent AS l18n_parent'
697
+                $table.'.uid AS uid',
698
+                $table.'.l18n_parent AS l18n_parent'
699 699
             )
700 700
             ->from($table)
701 701
             ->where(
702
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
703
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
702
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
703
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
704 704
                 self::whereExpression($table, true)
705 705
             )
706 706
             ->setMaxResults(1)
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
             $resArray = $allResults[0];
714 714
 
715 715
             $result = $queryBuilder
716
-                ->select($table . '.index_name AS index_name')
716
+                ->select($table.'.index_name AS index_name')
717 717
                 ->from($table)
718 718
                 ->where(
719
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
720
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
721
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
719
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
720
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
721
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())),
722 722
                     self::whereExpression($table, true)
723 723
                 )
724 724
                 ->setMaxResults(1)
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
         if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) {
737 737
             // Check if this table is allowed for translation.
738 738
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
739
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
739
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
740 740
                 if ($languageAspect->getContentId() > 0) {
741 741
                     $additionalWhere = $queryBuilder->expr()->andX(
742 742
                         $queryBuilder->expr()->orX(
743
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
744
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId()))
743
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
744
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId()))
745 745
                         ),
746
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
746
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
747 747
                     );
748 748
                 }
749 749
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
                     ->select('*')
753 753
                     ->from($table)
754 754
                     ->where(
755
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
755
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
756 756
                         $additionalWhere,
757 757
                         self::whereExpression($table, true)
758 758
                     )
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
                         }
771 771
                     }
772 772
                 } else {
773
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
773
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
774 774
                 }
775 775
             } else {
776
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
776
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
777 777
             }
778 778
         }
779 779
 
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
             return GeneralUtility::makeInstance(ConnectionPool::class)
816 816
                 ->getQueryBuilderForTable($table)
817 817
                 ->expr()
818
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
818
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
819 819
         } else {
820
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
820
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
821 821
             return '1=-1';
822 822
         }
823 823
     }
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
      */
857 857
     public static function polyfillExtbaseClassesForTYPO3v9()
858 858
     {
859
-        $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
859
+        $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php';
860 860
 
861 861
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
862 862
         $configurationManager = $objectManager->get(ConfigurationManager::class);
@@ -912,10 +912,10 @@  discard block
 block discarded – undo
912 912
         try {
913 913
             $response = $requestFactory->request($url, 'GET', $configuration);
914 914
         } catch (\Exception $e) {
915
-            self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
915
+            self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING);
916 916
             return false;
917 917
         }
918
-        $content  = $response->getBody()->getContents();
918
+        $content = $response->getBody()->getContents();
919 919
 
920 920
         return $content;
921 921
     }
Please login to merge, or discard this patch.