Passed
Push — master ( cf00ea...cda971 )
by Andreas
09:47
created
lib/midcom/helper/reflector/main.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @return static
53 53
      */
54
-    public static function get(string|object $src) : self
54
+    public static function get(string | object $src) : self
55 55
     {
56 56
         $identifier = get_called_class() . (is_object($src) ? get_class($src) : $src);
57 57
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
         $label_prop = $this->get_label_property();
288 288
 
289
-        if (    $label_prop != 'guid'
289
+        if ($label_prop != 'guid'
290 290
              && $this->property_exists($label_prop)) {
291 291
             $search_properties[$label_prop] = true;
292 292
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                 continue;
337 337
             }
338 338
 
339
-            if (   !$this->is_link($property)
339
+            if (!$this->is_link($property)
340 340
                 && $this->get_midgard_type($property) != MGD_TYPE_GUID) {
341 341
                 continue;
342 342
             }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     protected static function class_rewrite(string $schema_type) : string
371 371
     {
372 372
         $extends = midcom_baseclasses_components_configuration::get('midcom.helper.reflector', 'config')->get_array('class_extends');
373
-        if (   isset($extends[$schema_type])
373
+        if (isset($extends[$schema_type])
374 374
             && class_exists($extends[$schema_type])) {
375 375
             return $extends[$schema_type];
376 376
         }
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     /**
391 391
      * Get the MgdSchema classname for given class
392 392
      */
393
-    public static function resolve_baseclass(string|object $classname) : string
393
+    public static function resolve_baseclass(string | object $classname) : string
394 394
     {
395 395
         static $cached = [];
396 396
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,8 @@
 block discarded – undo
153 153
         if ($object instanceof mgdobject) {
154 154
             try {
155 155
                 $obj = midcom::get()->dbfactory->convert_midgard_to_midcom($object);
156
-            } catch (midcom_error) {
156
+            }
157
+            catch (midcom_error) {
157 158
                 return null;
158 159
             }
159 160
         } else {
Please login to merge, or discard this patch.
lib/midcom/helper/_dbfactory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             throw new midcom_error_midgard($e, $guid);
57 57
         }
58
-        if (   get_class($tmp) == 'midgard_person'
58
+        if (get_class($tmp) == 'midgard_person'
59 59
             && $this->person_class != 'midgard_person') {
60 60
             $tmp = new $this->person_class($guid);
61 61
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @param string $classname Which DBA are we dealing with
69 69
      */
70
-    public function get_cached(string $classname, string|int $src) : midcom_core_dbaobject
70
+    public function get_cached(string $classname, string | int $src) : midcom_core_dbaobject
71 71
     {
72 72
         static $cache = [];
73 73
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         }
85 85
         $object = new $classname($src);
86 86
         $cache[$classname][$object->guid] = $object;
87
-        $cache[$classname][$object->id] =& $cache[$classname][$object->guid];
87
+        $cache[$classname][$object->id] = & $cache[$classname][$object->guid];
88 88
         return $cache[$classname][$object->guid];
89 89
     }
90 90
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             return true;
132 132
         }
133 133
 
134
-        if (   isset($object->__object)
134
+        if (isset($object->__object)
135 135
             && is_object($object->__object)
136 136
             && $object->__object instanceof $class) {
137 137
             // Decorator whose MgdSchema object matches
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             return $this->get_parent_data_uncached($object);
155 155
         });
156 156
 
157
-        if (   empty($parent_guid)
157
+        if (empty($parent_guid)
158 158
             || $parent_guid === $object->guid) {
159 159
             return null;
160 160
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@  discard block
 block discarded – undo
50 50
     {
51 51
         try {
52 52
             $tmp = midgard_object_class::get_object_by_guid($guid);
53
-        } catch (mgd_exception $e) {
53
+        }
54
+        catch (mgd_exception $e) {
54 55
             debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO);
55 56
 
56 57
             throw new midcom_error_midgard($e, $guid);
@@ -159,7 +160,8 @@  discard block
 block discarded – undo
159 160
 
160 161
         try {
161 162
             return $this->get_cached($classname, $parent_guid);
162
-        } catch (midcom_error) {
163
+        }
164
+        catch (midcom_error) {
163 165
             return null;
164 166
         }
165 167
     }
Please login to merge, or discard this patch.
lib/midcom/services/indexer/main.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
      *
72 72
      * @return boolean Indicating success.
73 73
      */
74
-    public function index(midcom_services_indexer_document|array $documents) : bool
74
+    public function index(midcom_services_indexer_document | array $documents) : bool
75 75
     {
76 76
         if ($this->_disabled) {
77 77
             return true;
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,7 +93,8 @@  discard block
 block discarded – undo
93 93
         try {
94 94
             $this->_backend->index($documents);
95 95
             return true;
96
-        } catch (Exception $e) {
96
+        }
97
+        catch (Exception $e) {
97 98
             if ($batch) {
98 99
                 throw $e;
99 100
             }
@@ -122,7 +123,8 @@  discard block
 block discarded – undo
122 123
         try {
123 124
             $this->_backend->delete($RIs);
124 125
             return true;
125
-        } catch (Exception $e) {
126
+        }
127
+        catch (Exception $e) {
126 128
             debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR);
127 129
             return false;
128 130
         }
@@ -142,7 +144,8 @@  discard block
 block discarded – undo
142 144
         try {
143 145
             $this->_backend->delete_all($constraint);
144 146
             return true;
145
-        } catch (Exception $e) {
147
+        }
148
+        catch (Exception $e) {
146 149
             debug_add("Deleting error: " . $e->getMessage(), MIDCOM_LOG_ERROR);
147 150
             return false;
148 151
         }
@@ -175,7 +178,8 @@  discard block
 block discarded – undo
175 178
 
176 179
         try {
177 180
             $result_raw = $this->_backend->query($query, $filter, $options);
178
-        } catch (Exception $e) {
181
+        }
182
+        catch (Exception $e) {
179 183
             debug_add("Query error: " . $e->getMessage(), MIDCOM_LOG_ERROR);
180 184
             return $result;
181 185
         }
@@ -196,7 +200,8 @@  discard block
 block discarded – undo
196 200
             if (!empty($document->topic_guid)) {
197 201
                 try {
198 202
                     midcom_db_topic::get_cached($document->topic_guid);
199
-                } catch (midcom_error) {
203
+                }
204
+                catch (midcom_error) {
200 205
                     // Skip document, the object is hidden.
201 206
                     debug_add("Skipping the generic document {$document->title}, its topic seems to be invisible, we cannot proceed.");
202 207
                     continue;
@@ -209,7 +214,8 @@  discard block
 block discarded – undo
209 214
                 // Strip language code from end of RI if it looks like "<GUID>_<LANG>"
210 215
                 try {
211 216
                     midcom::get()->dbfactory->get_object_by_guid(preg_replace('/^([0-9a-f]{32,80})_[a-z]{2}$/', '\\1', $document->RI));
212
-                } catch (midcom_error) {
217
+                }
218
+                catch (midcom_error) {
213 219
                     // Skip document, the object is hidden, deleted or otherwise unavailable.
214 220
                     //@todo Maybe nonexistent objects should be removed from index?
215 221
                     continue;
Please login to merge, or discard this patch.
lib/midcom/services/dbclassloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      * Get a MidCOM DB class name for a MgdSchema Object.
108 108
      * We also ensure that the corresponding component has been loaded.
109 109
      */
110
-    public function get_midcom_class_name_for_mgdschema_object(string|object $classname) : ?string
110
+    public function get_midcom_class_name_for_mgdschema_object(string | object $classname) : ?string
111 111
     {
112 112
         static $dba_classes_by_mgdschema = [];
113 113
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * Simple helper to check whether we are dealing with a MidCOM Database object
158 158
      * or a subclass thereof.
159 159
      */
160
-    public function is_midcom_db_object(object|string $object) : bool
160
+    public function is_midcom_db_object(object | string $object) : bool
161 161
     {
162 162
         return is_subclass_of($object, midcom_core_dbaobject::class)
163 163
             || is_a($object, midcom_core_dbaproxy::class, true);
Please login to merge, or discard this patch.
lib/org/openpsa/widgets/contact.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     /**
94 94
      * Retrieve an object, uses in-request caching
95 95
      */
96
-    public static function get(string|int $src) : self
96
+    public static function get(string | int $src) : self
97 97
     {
98 98
         static $cache = [];
99 99
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
             }
137 137
         }
138 138
 
139
-        if (   $this->_config->get('jabber_enable_presence')
139
+        if ($this->_config->get('jabber_enable_presence')
140 140
             && $person->get_parameter('org.openpsa.jabber', 'jid')) {
141 141
             $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid');
142 142
         }
143 143
 
144
-        if (   $this->_config->get('skype_enable_presence')
144
+        if ($this->_config->get('skype_enable_presence')
145 145
             && $person->get_parameter('org.openpsa.skype', 'name')) {
146 146
             $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name');
147 147
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         if (!empty($attachments[$type])) {
179 179
             return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">';
180 180
         }
181
-        if (   $this->_config->get('gravatar_enable')
181
+        if ($this->_config->get('gravatar_enable')
182 182
             && !empty($this->contact_details['email'])) {
183 183
             $size = ($type == 'view') ? 500 : 32;
184 184
             $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon';
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
     private function _show_groups()
293 293
     {
294
-        if (   !$this->show_groups
294
+        if (!$this->show_groups
295 295
             || empty($this->contact_details['id'])) {
296 296
             return;
297 297
         }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                     $default_shown = true;
356 356
                     $cards_to_show[] = $cardname;
357 357
                 }
358
-            } elseif (    $customer->$property
358
+            } elseif ($customer->$property
359 359
                       || ($customer->street && !$inherited_cards_only && !$default_shown)) {
360 360
                 $inherited_cards_only = false;
361 361
                 $multiple_addresses = true;
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 
378 378
         foreach ($cards_to_show as $cardname) {
379 379
             echo '<div class="vcard">';
380
-            if (   $multiple_addresses
381
-                || (   $cardname != 'visiting'
380
+            if ($multiple_addresses
381
+                || ($cardname != 'visiting'
382 382
                     && !$inherited_cards_only)) {
383 383
                 echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n";
384 384
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,7 +103,8 @@  discard block
 block discarded – undo
103 103
 
104 104
         try {
105 105
             $person = midcom_db_person::get_cached($src);
106
-        } catch (midcom_error) {
106
+        }
107
+        catch (midcom_error) {
107 108
             return $cache[$src] = new self(new midcom_db_person);
108 109
         }
109 110
 
@@ -303,7 +304,8 @@  discard block
 block discarded – undo
303 304
         foreach ($mc->get_rows(['gid', 'extra']) as $data) {
304 305
             try {
305 306
                 $group = org_openpsa_contacts_group_dba::get_cached($data['gid']);
306
-            } catch (midcom_error $e) {
307
+            }
308
+            catch (midcom_error $e) {
307 309
                 $e->log();
308 310
                 continue;
309 311
             }
Please login to merge, or discard this patch.
lib/midcom/services/uimessages.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
      */
134 134
     public function show(bool $show_simple = false)
135 135
     {
136
-        if (   $show_simple
136
+        if ($show_simple
137 137
             || !midcom::get()->auth->can_user_do('midcom:ajax', class: static::class)) {
138 138
             $this->show_simple();
139 139
             return;
Please login to merge, or discard this patch.
lib/midcom/services/toolbars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@
 block discarded – undo
272 272
 
273 273
     private function add_head_elements(bool $centralized = false) : bool
274 274
     {
275
-        if (   !midcom::get()->auth->user
275
+        if (!midcom::get()->auth->user
276 276
             || !midcom::get()->config->get('toolbars_enable_centralized')
277 277
             || !midcom::get()->auth->can_user_do('midcom:centralized_toolbar', class: __CLASS__)) {
278 278
             return false;
Please login to merge, or discard this patch.
lib/midcom/baseclasses/core/dbobject.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         if ($parent = $object->get_parent()) {
120 120
             // Attachments are a special case
121 121
             if ($object instanceof midcom_db_attachment) {
122
-                if (   !$parent->can_do('midgard:attachments')
122
+                if (!$parent->can_do('midgard:attachments')
123 123
                     || !$parent->can_do('midgard:update')) {
124 124
                     debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.",
125 125
                         MIDCOM_LOG_ERROR);
126 126
                     midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
127 127
                     return false;
128 128
                 }
129
-            } elseif (   !$parent->can_do('midgard:create')
129
+            } elseif (!$parent->can_do('midgard:create')
130 130
                       && !midcom::get()->auth->can_user_do('midgard:create', class: get_class($object))) {
131 131
                 debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.",
132 132
                     MIDCOM_LOG_ERROR);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             }
239 239
 
240 240
             // Default the owner to first group of current user
241
-            if (   empty($object->metadata->owner)
241
+            if (empty($object->metadata->owner)
242 242
                 && $first_group = midcom::get()->auth->user->get_first_group_guid()) {
243 243
                 $object->metadata->set('owner', $first_group);
244 244
             }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
      */
463 463
     public static function get_by_guid(midcom_core_dbaobject $object, string $guid) : bool
464 464
     {
465
-        if (   !midcom::get()->auth->admin
465
+        if (!midcom::get()->auth->admin
466 466
             && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) {
467 467
             debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR);
468 468
             return false;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -423,7 +423,8 @@
 block discarded – undo
423 423
          */
424 424
         try {
425 425
             return $object->get_by_id($object->id);
426
-        } catch (Exception) {
426
+        }
427
+        catch (Exception) {
427 428
             return false;
428 429
         }
429 430
     }
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/handler/group/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             ];
45 45
         }
46 46
 
47
-        if (   midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class)
47
+        if (midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class)
48 48
             && $this->group->can_do('midgard:create')) {
49 49
                 $buttons[] = $workflow->get_button($this->router->generate('person_new_group', ['guid' => $this->group->guid]), [
50 50
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'),
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         $siteconfig = org_openpsa_core_siteconfig::get_instance();
56 56
         $user_url = $siteconfig->get_node_full_url('org.openpsa.user');
57
-        if (   $user_url
57
+        if ($user_url
58 58
             && midcom::get()->auth->can_user_do('org.openpsa.user:access', class: org_openpsa_user_interface::class)) {
59 59
             $buttons[] = [
60 60
                 MIDCOM_TOOLBAR_URL => $user_url . "group/{$this->group->guid}/",
Please login to merge, or discard this patch.