Passed
Push — master ( 4e3bf7...c9bf3c )
by Andreas
29:31
created
lib/midcom/helper/toolbar.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 
341 341
         $item = array_replace($defaults, $item);
342 342
 
343
-        if (   !empty($item[MIDCOM_TOOLBAR_ACCESSKEY])
343
+        if (!empty($item[MIDCOM_TOOLBAR_ACCESSKEY])
344 344
             && !array_key_exists($item[MIDCOM_TOOLBAR_ACCESSKEY], $used_access_keys)) {
345 345
             // We have valid access key, add it to help text
346 346
             $prefix = 'Alt-';
347
-            if (   isset($_SERVER['HTTP_USER_AGENT'])
347
+            if (isset($_SERVER['HTTP_USER_AGENT'])
348 348
                 && strstr($_SERVER['HTTP_USER_AGENT'], 'Macintosh')) {
349 349
                 // Mac users
350 350
                 $prefix = 'Ctrl-Alt-';
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     private function set_url(array &$item, string $url)
367 367
     {
368 368
         $item[MIDCOM_TOOLBAR__ORIGINAL_URL] = $url;
369
-        if (   (   empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"])
369
+        if ((empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"])
370 370
                 // Some items may want to keep their links unmutilated
371 371
                 || $item[MIDCOM_TOOLBAR_OPTIONS]["rel"] != "directlink")
372 372
             && !str_starts_with($url, '/')
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         if ($index == 0) {
393 393
             array_shift($this->items);
394
-        } elseif ($index == count($this->items) -1) {
394
+        } elseif ($index == count($this->items) - 1) {
395 395
             array_pop($this->items);
396 396
         } else {
397 397
             $this->items = array_merge(array_slice($this->items, 0, $index),
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
      */
515 515
     public function render() : string
516 516
     {
517
-        $visible_items = array_filter($this->items, function ($item) {
517
+        $visible_items = array_filter($this->items, function($item) {
518 518
             return !$item[MIDCOM_TOOLBAR_HIDDEN];
519 519
         });
520 520
         $this->rendered = true;
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
             // Try finding uppercase version of the accesskey first
578 578
             $accesskey = strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]);
579 579
             $position = strpos($label, $accesskey);
580
-            if (   $position === false
580
+            if ($position === false
581 581
                 && midcom::get()->i18n->get_current_language() == 'en') {
582 582
                 // Try lowercase, too
583 583
                 $accesskey = strtolower($accesskey);
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
             $attributes['title'] = $item[MIDCOM_TOOLBAR_HELPTEXT];
638 638
         }
639 639
 
640
-        if (   $item[MIDCOM_TOOLBAR_ENABLED]
640
+        if ($item[MIDCOM_TOOLBAR_ENABLED]
641 641
             && $item[MIDCOM_TOOLBAR_ACCESSKEY] !== null) {
642 642
             $attributes['class'] = 'accesskey';
643 643
             $attributes['accesskey'] = $item[MIDCOM_TOOLBAR_ACCESSKEY];
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
     public function get_index_from_url(string $url) : ?int
701 701
     {
702 702
         foreach ($this->items as $i => $item) {
703
-            if (   $item[MIDCOM_TOOLBAR_URL] == $url
703
+            if ($item[MIDCOM_TOOLBAR_URL] == $url
704 704
                 || $item[MIDCOM_TOOLBAR__ORIGINAL_URL] == $url) {
705 705
                 return $i;
706 706
             }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      *
719 719
      * @param mixed $index The integer index or URL to check
720 720
      */
721
-    protected function _check_index($index, bool $raise_error = true) :?int
721
+    protected function _check_index($index, bool $raise_error = true) : ?int
722 722
     {
723 723
         if (is_string($index)) {
724 724
             $url = $index;
Please login to merge, or discard this patch.