Passed
Pull Request — master (#70)
by Alexander
03:07
created
Classes/Common/Indexer.php 1 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 int 0 on success or 1 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)) {
@@ -213,8 +211,7 @@  discard block
 block discarded – undo
213 211
      *
214 212
      * @return string The field's dynamic index name
215 213
      */
216
-    public static function getIndexFieldName($index_name, $pid = 0)
217
-    {
214
+    public static function getIndexFieldName($index_name, $pid = 0) {
218 215
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
219 216
 
220 217
         // Sanitize input.
@@ -242,8 +239,7 @@  discard block
 block discarded – undo
242 239
      *
243 240
      * @return void
244 241
      */
245
-    protected static function loadIndexConf($pid)
246
-    {
242
+    protected static function loadIndexConf($pid) {
247 243
         if (!self::$fieldsLoaded) {
248 244
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
249 245
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -313,8 +309,7 @@  discard block
 block discarded – undo
313 309
      *
314 310
      * @return int 0 on success or 1 on failure
315 311
      */
316
-    protected static function processLogical(Document &$doc, array $logicalUnit)
317
-    {
312
+    protected static function processLogical(Document &$doc, array $logicalUnit) {
318 313
         $errors = 0;
319 314
         // Get metadata for logical unit.
320 315
         $metadata = $doc->metadataArray[$logicalUnit['id']];
@@ -434,8 +429,7 @@  discard block
 block discarded – undo
434 429
      *
435 430
      * @return int 0 on success or 1 on failure
436 431
      */
437
-    protected static function processPhysical(Document &$doc, $page, array $physicalUnit)
438
-    {
432
+    protected static function processPhysical(Document &$doc, $page, array $physicalUnit) {
439 433
         if (
440 434
             $doc->hasFulltext
441 435
             && $fulltext = $doc->getRawText($physicalUnit['id'])
@@ -520,8 +514,7 @@  discard block
 block discarded – undo
520 514
      *
521 515
      * @return bool true on success or false on failure
522 516
      */
523
-    protected static function solrConnect($core, $pid = 0)
524
-    {
517
+    protected static function solrConnect($core, $pid = 0) {
525 518
         // Get Solr instance.
526 519
         if (!self::$solr) {
527 520
             // Connect to Solr server.
@@ -544,8 +537,7 @@  discard block
 block discarded – undo
544 537
      *
545 538
      * @access private
546 539
      */
547
-    private function __construct()
548
-    {
540
+    private function __construct() {
549 541
         // This is a static class, thus no instances should be created.
550 542
     }
551 543
 }
Please login to merge, or discard this patch.
Classes/Common/Helper.php 1 patch
Braces   +24 added lines, -48 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))
@@ -207,8 +203,7 @@  discard block
 block discarded – undo
207 203
      * @return void
208 204
      */
209 205
     //TODO: find better way to handle logger in static class
210
-    public static function log($message, $severity = 0)
211
-    {
206
+    public static function log($message, $severity = 0) {
212 207
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
213 208
 
214 209
         switch ($severity) {
@@ -238,8 +233,7 @@  discard block
 block discarded – undo
238 233
      *
239 234
      * @return mixed Hashed string or false on error
240 235
      */
241
-    public static function digest($string)
242
-    {
236
+    public static function digest($string) {
243 237
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
244 238
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
245 239
             return false;
@@ -258,8 +252,7 @@  discard block
 block discarded – undo
258 252
      *
259 253
      * @return mixed Encrypted string or false on error
260 254
      */
261
-    public static function encrypt($string)
262
-    {
255
+    public static function encrypt($string) {
263 256
         if (
264 257
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
265 258
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -292,8 +285,7 @@  discard block
 block discarded – undo
292 285
      *
293 286
      * @return string The unqualified class name
294 287
      */
295
-    public static function getUnqualifiedClassName($qualifiedClassname)
296
-    {
288
+    public static function getUnqualifiedClassName($qualifiedClassname) {
297 289
         $nameParts = explode('\\', $qualifiedClassname);
298 290
         return end($nameParts);
299 291
     }
@@ -307,8 +299,7 @@  discard block
 block discarded – undo
307 299
      *
308 300
      * @return string The cleaned up string
309 301
      */
310
-    public static function getCleanString($string)
311
-    {
302
+    public static function getCleanString($string) {
312 303
         // Convert to lowercase.
313 304
         $string = strtolower($string);
314 305
         // Remove non-alphanumeric characters.
@@ -329,8 +320,7 @@  discard block
 block discarded – undo
329 320
      *
330 321
      * @return array Array of hook objects for the class
331 322
      */
332
-    public static function getHookObjects($scriptRelPath)
333
-    {
323
+    public static function getHookObjects($scriptRelPath) {
334 324
         $hookObjects = [];
335 325
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
336 326
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -351,8 +341,7 @@  discard block
 block discarded – undo
351 341
      *
352 342
      * @return string "index_name" for the given UID
353 343
      */
354
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
355
-    {
344
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
356 345
         // Sanitize input.
357 346
         $uid = max(intval($uid), 0);
358 347
         if (
@@ -402,8 +391,7 @@  discard block
 block discarded – undo
402 391
      *
403 392
      * @return string Localized full name of language or unchanged input
404 393
      */
405
-    public static function getLanguageName($code)
406
-    {
394
+    public static function getLanguageName($code) {
407 395
         // Analyze code and set appropriate ISO table.
408 396
         $isoCode = strtolower(trim($code));
409 397
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -448,8 +436,7 @@  discard block
 block discarded – undo
448 436
      *
449 437
      * @return string The translated string or the given key on failure
450 438
      */
451
-    public static function getMessage($key, $hsc = false, $default = '')
452
-    {
439
+    public static function getMessage($key, $hsc = false, $default = '') {
453 440
         // Set initial output to default value.
454 441
         $translated = (string) $default;
455 442
         // Load common messages file.
@@ -491,8 +478,7 @@  discard block
 block discarded – undo
491 478
      *
492 479
      * @return string "uid" for the given index_name
493 480
      */
494
-    public static function getUidFromIndexName($index_name, $table, $pid = -1)
495
-    {
481
+    public static function getUidFromIndexName($index_name, $table, $pid = -1) {
496 482
         if (
497 483
             !$index_name
498 484
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
@@ -543,8 +529,7 @@  discard block
 block discarded – undo
543 529
      *
544 530
      * @return string Uniform Resource Name as string
545 531
      */
546
-    public static function getURN($base, $id)
547
-    {
532
+    public static function getURN($base, $id) {
548 533
         $concordance = [
549 534
             '0' => 1,
550 535
             '1' => 2,
@@ -611,8 +596,7 @@  discard block
 block discarded – undo
611 596
      *
612 597
      * @return bool Is $id a valid PPN?
613 598
      */
614
-    public static function isPPN($id)
615
-    {
599
+    public static function isPPN($id) {
616 600
         return self::checkIdentifier($id, 'PPN');
617 601
     }
618 602
 
@@ -625,8 +609,7 @@  discard block
 block discarded – undo
625 609
      *
626 610
      * @return mixed Session value for given key or null on failure
627 611
      */
628
-    public static function loadFromSession($key)
629
-    {
612
+    public static function loadFromSession($key) {
630 613
         // Cast to string for security reasons.
631 614
         $key = (string) $key;
632 615
         if (!$key) {
@@ -658,8 +641,7 @@  discard block
 block discarded – undo
658 641
      *
659 642
      * @return array Merged array
660 643
      */
661
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
662
-    {
644
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
663 645
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
664 646
         return $original;
665 647
     }
@@ -676,8 +658,7 @@  discard block
 block discarded – undo
676 658
      *
677 659
      * @return array Array of substituted "NEW..." identifiers and their actual UIDs.
678 660
      */
679
-    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false)
680
-    {
661
+    public static function processDBasAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) {
681 662
         if (
682 663
             \TYPO3_MODE === 'BE'
683 664
             && $GLOBALS['BE_USER']->isAdmin()
@@ -723,8 +704,7 @@  discard block
 block discarded – undo
723 704
      *
724 705
      * @return string All flash messages in the queue rendered as HTML.
725 706
      */
726
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
727
-    {
707
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
728 708
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
729 709
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
730 710
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -743,8 +723,7 @@  discard block
 block discarded – undo
743 723
      *
744 724
      * @return bool true on success, false on failure
745 725
      */
746
-    public static function saveToSession($value, $key)
747
-    {
726
+    public static function saveToSession($value, $key) {
748 727
         // Cast to string for security reasons.
749 728
         $key = (string) $key;
750 729
         if (!$key) {
@@ -776,8 +755,7 @@  discard block
 block discarded – undo
776 755
      *
777 756
      * @return string Localized label for $index_name
778 757
      */
779
-    public static function translate($index_name, $table, $pid)
780
-    {
758
+    public static function translate($index_name, $table, $pid) {
781 759
         // Load labels into static variable for future use.
782 760
         static $labels = [];
783 761
         // Sanitize input.
@@ -900,8 +878,7 @@  discard block
 block discarded – undo
900 878
      *
901 879
      * @return string Additional WHERE expression
902 880
      */
903
-    public static function whereExpression($table, $showHidden = false)
904
-    {
881
+    public static function whereExpression($table, $showHidden = false) {
905 882
         if (\TYPO3_MODE === 'FE') {
906 883
             // Should we ignore the record's hidden flag?
907 884
             $ignoreHide = 0;
@@ -930,8 +907,7 @@  discard block
 block discarded – undo
930 907
      *
931 908
      * @access private
932 909
      */
933
-    private function __construct()
934
-    {
910
+    private function __construct() {
935 911
         // This is a static class, thus no instances should be created.
936 912
     }
937 913
 }
Please login to merge, or discard this patch.
Classes/Hooks/UserFunc.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
  * @subpackage dlf
31 31
  * @access public
32 32
  */
33
-class UserFunc implements LoggerAwareInterface
34
-{
33
+class UserFunc implements LoggerAwareInterface {
35 34
     use LoggerAwareTrait;
36 35
 
37 36
     /**
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
      *
54 53
      * @return string HTML <img> tag for thumbnail
55 54
      */
56
-    public function displayThumbnail(&$params)
57
-    {
55
+    public function displayThumbnail(&$params) {
58 56
         // Simulate TCA field type "passthrough".
59 57
         $output = '<input type="hidden" name="' . $params['itemFormElName'] . '" value="' . $params['itemFormElValue'] . '" />';
60 58
         if (!empty($params['itemFormElValue'])) {
Please login to merge, or discard this patch.
Classes/Hooks/ConfigurationForm.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
  * @subpackage dlf
29 29
  * @access public
30 30
  */
31
-class ConfigurationForm
32
-{
31
+class ConfigurationForm {
33 32
     /**
34 33
      * This holds the current configuration
35 34
      *
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      *
46 45
      * @return string Message informing the user of success or failure
47 46
      */
48
-    public function checkSolrConnection()
49
-    {
47
+    public function checkSolrConnection() {
50 48
         $solr = Solr::getInstance();
51 49
         if ($solr->ready) {
52 50
             Helper::addMessage(
@@ -71,8 +69,7 @@  discard block
 block discarded – undo
71 69
      *
72 70
      * @return string Message informing the user of success or failure
73 71
      */
74
-    public function checkMetadataFormats()
75
-    {
72
+    public function checkMetadataFormats() {
76 73
         // We need to do some bootstrapping manually as of TYPO3 9.
77 74
         // Load table configuration array into $GLOBALS['TCA'].
78 75
         ExtensionManagementUtility::loadBaseTca(false);
@@ -201,8 +198,7 @@  discard block
 block discarded – undo
201 198
      *
202 199
      * @return void
203 200
      */
204
-    public function __construct()
205
-    {
201
+    public function __construct() {
206 202
         // Load localization file.
207 203
         $GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml');
208 204
         // Get current configuration.
Please login to merge, or discard this patch.
Classes/Common/AbstractPlugin.php 1 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
  * @access public
30 30
  * @abstract
31 31
  */
32
-abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface
33
-{
32
+abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin implements LoggerAwareInterface {
34 33
     use LoggerAwareTrait;
35 34
 
36 35
     public $extKey = 'dlf';
@@ -73,8 +72,7 @@  discard block
 block discarded – undo
73 72
      *
74 73
      * @return void
75 74
      */
76
-    protected function getTemplate($part = '###TEMPLATE###')
77
-    {
75
+    protected function getTemplate($part = '###TEMPLATE###') {
78 76
         $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
79 77
         if (!empty($this->conf['templateFile'])) {
80 78
             // Load template file from configuration.
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
      *
99 97
      * @return void
100 98
      */
101
-    protected function init(array $conf)
102
-    {
99
+    protected function init(array $conf) {
103 100
         // Read FlexForm configuration.
104 101
         $flexFormConf = [];
105 102
         $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf);
@@ -137,8 +134,7 @@  discard block
 block discarded – undo
137 134
      *
138 135
      * @return void
139 136
      */
140
-    protected function loadDocument()
141
-    {
137
+    protected function loadDocument() {
142 138
         // Check for required variable.
143 139
         if (
144 140
             !empty($this->piVars['id'])
@@ -209,8 +205,7 @@  discard block
 block discarded – undo
209 205
      *
210 206
      * @return array The resulting typoscript array
211 207
      */
212
-    protected function parseTS($string = '')
213
-    {
208
+    protected function parseTS($string = '') {
214 209
         $parser = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::class);
215 210
         $parser->parse($string);
216 211
         return $parser->setup;
@@ -229,8 +224,7 @@  discard block
 block discarded – undo
229 224
      *
230 225
      * @return string The input string wrapped in <a> tags
231 226
      */
232
-    public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0)
233
-    {
227
+    public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0) {
234 228
         $conf = [];
235 229
         if (!$cache) {
236 230
             $conf['no_cache'] = true;
@@ -253,8 +247,7 @@  discard block
 block discarded – undo
253 247
      *
254 248
      * @return string HTML content wrapped, ready to return to the parent object.
255 249
      */
256
-    public function pi_wrapInBaseClass($content)
257
-    {
250
+    public function pi_wrapInBaseClass($content) {
258 251
         if (!$this->frontendController->config['config']['disableWrapInBaseClass']) {
259 252
             // Use class name instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins.
260 253
             $content = '<div class="tx-dlf-' . strtolower(Helper::getUnqualifiedClassName(get_class($this))) . '">' . $content . '</div>';
@@ -274,8 +267,7 @@  discard block
 block discarded – undo
274 267
      *
275 268
      * @return void
276 269
      */
277
-    protected function setCache($cache = true)
278
-    {
270
+    protected function setCache($cache = true) {
279 271
         if ($cache) {
280 272
             // Set cObject type to "USER" (default).
281 273
             $this->pi_USER_INT_obj = false;
Please login to merge, or discard this patch.