Passed
Push — master ( fb1a59...c5195a )
by Andreas
09:51
created
lib/midcom/helper/nav/main.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -296,7 +296,8 @@
 block discarded – undo
296 296
         // the tree. This is, for example, used by the on-delete cache invalidation.
297 297
         try {
298 298
             $object = midcom::get()->dbfactory->get_object_by_guid($guid);
299
-        } catch (midcom_error $e) {
299
+        }
300
+        catch (midcom_error $e) {
300 301
             debug_add("Could not load GUID {$guid}, trying to continue anyway. Last error was: " . $e->getMessage(), MIDCOM_LOG_WARN);
301 302
         }
302 303
         if (!empty($object)) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         while ($parent = $object->get_parent()) {
341 341
             // Verify that this topic is within the current sites tree, if it is not,
342 342
             // we ignore it.
343
-            if (   $parent instanceof midcom_db_topic
343
+            if ($parent instanceof midcom_db_topic
344 344
                 && $this->is_node_in_tree($parent->id, $this->get_root_node())) {
345 345
                 return $parent;
346 346
             }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                     $entry = "<span class=\"{$current_class}\">{$entry}</span>";
395 395
                 }
396 396
             } else {
397
-                if (   !empty($data['napobject'][MIDCOM_NAV_GUID])
397
+                if (!empty($data['napobject'][MIDCOM_NAV_GUID])
398 398
                     && in_array($data['napobject'][MIDCOM_NAV_GUID], $skip_guids)) {
399 399
                     continue;
400 400
                 }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                     $id = "custom-{$key}";
509 509
 
510 510
                     $url = "{$prefix}{$entry[MIDCOM_NAV_URL]}";
511
-                    if (   str_starts_with($entry[MIDCOM_NAV_URL], '/')
511
+                    if (str_starts_with($entry[MIDCOM_NAV_URL], '/')
512 512
                         || preg_match('|^https?://|', $entry[MIDCOM_NAV_URL])) {
513 513
                         $url = $entry[MIDCOM_NAV_URL];
514 514
                     }
Please login to merge, or discard this patch.
lib/midcom/helper/nav/leaf.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@
 block discarded – undo
52 52
         } elseif (!empty($this->data[MIDCOM_NAV_GUID])) {
53 53
             try {
54 54
                 $this->data[MIDCOM_NAV_OBJECT] = midcom::get()->dbfactory->get_object_by_guid($this->data[MIDCOM_NAV_GUID]);
55
-            } catch (midcom_error $e) {
55
+            }
56
+            catch (midcom_error $e) {
56 57
             }
57 58
         } else {
58 59
             debug_add("Warning: The leaf {$this->leafid} of topic {$topic->id} does set neither a GUID nor an object.");
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function is_readable_by(string $user_id) : bool
30 30
     {
31
-        return (   empty($this->object)
31
+        return (empty($this->object)
32 32
                 || !$this->guid
33 33
                 || !$user_id
34 34
                 || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, $this->object->__midcom_class_name__, $user_id));
Please login to merge, or discard this patch.
lib/midcom/helper/metadata.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -658,7 +658,8 @@
 block discarded – undo
658 658
             && mgd_is_guid($guid)) {
659 659
             try {
660 660
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
661
-            } catch (midcom_error $e) {
661
+            }
662
+            catch (midcom_error $e) {
662 663
                 debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN);
663 664
                 debug_print_r("Source was:", $source);
664 665
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         if (in_array($key, $this->field_config['timebased'])) {
256 256
             // This is ugly, but seems the only possible way...
257
-            if (   isset($this->__metadata->$key)
257
+            if (isset($this->__metadata->$key)
258 258
                 && (string) $this->__metadata->$key !== "0001-01-01T00:00:00+00:00") {
259 259
                 return (int) $this->__metadata->$key->format('U');
260 260
             }
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
         }
316 316
 
317 317
         $now = time();
318
-        if (   $this->get('schedulestart')
318
+        if ($this->get('schedulestart')
319 319
             && $this->get('schedulestart') > $now) {
320 320
             return false;
321 321
         }
322
-        if (   $this->get('scheduleend')
322
+        if ($this->get('scheduleend')
323 323
             && $this->get('scheduleend') < $now) {
324 324
             return false;
325 325
         }
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
     public function is_object_visible_onsite() : bool
336 336
     {
337 337
         return
338
-        (   (   midcom::get()->config->get('show_hidden_objects')
338
+        ((midcom::get()->config->get('show_hidden_objects')
339 339
              || $this->is_visible())
340
-         && (   midcom::get()->config->get('show_unapproved_objects')
340
+         && (midcom::get()->config->get('show_unapproved_objects')
341 341
              || $this->is_approved())
342 342
         );
343 343
     }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $guid = $source;
395 395
         }
396 396
 
397
-        if (   $object === null
397
+        if ($object === null
398 398
             && mgd_is_guid($guid)) {
399 399
             try {
400 400
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         }
428 428
 
429 429
         // Lock was created by the user, return "not locked"
430
-        if (   !empty(midcom::get()->auth->user->guid)
430
+        if (!empty(midcom::get()->auth->user->guid)
431 431
             && $this->get('locker') === midcom::get()->auth->user->guid) {
432 432
             return false;
433 433
         }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      */
455 455
     public function can_unlock() : bool
456 456
     {
457
-        return (  (midcom::get()->auth->user && midcom::get()->auth->user->guid == $this->__object->metadata->locker)
457
+        return ((midcom::get()->auth->user && midcom::get()->auth->user->guid == $this->__object->metadata->locker)
458 458
                 || $this->__object->can_do('midcom:unlock')
459 459
                 || midcom::get()->auth->can_user_do('midcom:unlock', null, midcom_services_auth::class));
460 460
     }
Please login to merge, or discard this patch.
lib/midcom/admin/folder/handler/order.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@
 block discarded – undo
69 69
         // Use the DB Factory to resolve the class and to get the object
70 70
         try {
71 71
             $object = midcom::get()->dbfactory->get_object_by_guid($identifier);
72
-        } catch (midcom_error $e) {
72
+        }
73
+        catch (midcom_error $e) {
73 74
             // This is probably a pseudo leaf, store the score to the current node
74 75
             $this->_topic->set_parameter('midcom.helper.nav.score', $identifier, $score);
75 76
             return true;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
         }
90 90
 
91 91
         // Approve if possible
92
-        if (   $approval_status
92
+        if ($approval_status
93 93
             && $object->can_do('midcom:approve')) {
94 94
             $object->metadata->approve();
95 95
         }
Please login to merge, or discard this patch.
lib/midcom/services/permalinks/main.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@
 block discarded – undo
72 72
 
73 73
         try {
74 74
             $object = midcom::get()->dbfactory->get_object_by_guid($guid);
75
-        } catch (midcom_error $e) {
75
+        }
76
+        catch (midcom_error $e) {
76 77
             debug_add("Failed to resolve the GUID {$guid}, this is most probably an access denied error.", MIDCOM_LOG_ERROR);
77 78
             debug_add('Last MidCOM error string: ' . $e->getMessage());
78 79
             return null;
Please login to merge, or discard this patch.
lib/midcom/services/indexer/document/midcom.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
      */
110 110
     public function members_to_fields()
111 111
     {
112
-        if (   empty($this->topic_guid)
112
+        if (empty($this->topic_guid)
113 113
             || empty($this->topic_url)
114 114
             || empty($this->component)) {
115 115
             //if one of those is missing, we override all three to ensure consistency
Please login to merge, or discard this patch.
lib/midcom/config/test.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
             $this->add('Setting: upload_max_filesize', self::OK, ini_get('upload_max_filesize'));
105 105
         } else {
106 106
             $this->add('Setting: upload_max_filesize',
107
-                             self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})");
107
+                                self::WARNING, "To make bulk uploads (for exampe in the Image Gallery) useful, you should increase the Upload limit to something above 50 MB. (Current setting: {$upload_limit})");
108 108
         }
109 109
 
110 110
         $post_limit = $this->ini_get_filesize('post_max_size');
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,8 @@
 block discarded – undo
81 81
                 $class = $config->get_backend_class();
82 82
                 new $class(new midcom_db_topic, $config);
83 83
                 $this->add("MidCOM RCS", self::OK, $class);
84
-            } catch (midcom_error $e) {
84
+            }
85
+            catch (midcom_error $e) {
85 86
                 $this->add("MidCOM RCS", self::ERROR, $e->getMessage());
86 87
             }
87 88
         } else {
Please login to merge, or discard this patch.
lib/midgard/admin/asgard/toolbar.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,8 @@
 block discarded – undo
117 117
                                 }
118 118
                                 break;
119 119
                         }
120
-                    } catch (midcom_error $e) {
120
+                    }
121
+                    catch (midcom_error $e) {
121 122
                         $e->log();
122 123
                     }
123 124
                 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             ];
143 143
         }
144 144
 
145
-        if (   midcom::get()->config->get('midcom_services_rcs_enable')
145
+        if (midcom::get()->config->get('midcom_services_rcs_enable')
146 146
             && $object->can_do('midgard:update')
147 147
             && $object->_use_rcs) {
148 148
             $buttons[] = [
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     private function get_toolbar_update_items(midcom_core_dbaobject $object) : array
204 204
     {
205 205
         $buttons = [];
206
-        if (   $object instanceof midcom_db_topic
206
+        if ($object instanceof midcom_db_topic
207 207
             && $object->component
208 208
             && $object->can_do('midcom:component_config')) {
209 209
             $buttons[] = [
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             MIDCOM_TOOLBAR_ENABLED => $object->can_do('midgard:privileges'),
242 242
         ];
243 243
 
244
-        if (   midcom::get()->componentloader->is_installed('midcom.helper.replicator')
244
+        if (midcom::get()->componentloader->is_installed('midcom.helper.replicator')
245 245
             && midcom::get()->auth->admin) {
246 246
             $buttons[] = [
247 247
                 MIDCOM_TOOLBAR_URL => "__mfa/asgard_midcom.helper.replicator/object/{$object->guid}/",
Please login to merge, or discard this patch.
lib/midgard/admin/user/handler/list.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,7 +217,8 @@
 block discarded – undo
217 217
 
218 218
         try {
219 219
             $account = new midcom_core_account($person);
220
-        } catch (midcom_error $e) {
220
+        }
221
+        catch (midcom_error $e) {
221 222
             midcom::get()->uimessages->add($this->_l10n->get('midgard.admin.user'), sprintf($this->_l10n->get('failed to get the user with id %s'), $person->id), 'error');
222 223
             return;
223 224
         }
Please login to merge, or discard this patch.