Passed
Push — master ( 05b81b...989dc8 )
by Andreas
12:34
created
src/midcom/datamanager/extension/transformer/multipleTransformer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                     return [];
55 55
                 }
56 56
                 $results = explode($this->multiple_separator, substr($input, 1, -1));
57
-                if (   !empty($this->config['widget_config']['id_field'])
57
+                if (!empty($this->config['widget_config']['id_field'])
58 58
                     && $this->config['widget_config']['id_field'] == 'id') {
59 59
                     $results = array_map(intval(...), $results);
60 60
                 }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function reverseTransform(mixed $array) : mixed
69 69
     {
70
-        if (!is_array($array) ) {
70
+        if (!is_array($array)) {
71 71
             throw new TransformationFailedException('Expected an array.');
72 72
         }
73 73
 
Please login to merge, or discard this patch.
src/midcom/dba/privileges.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function set_privilege($privilege, $assignee = null, int $value = MIDCOM_PRIVILEGE_ALLOW, string $classname = '') : bool
68 68
     {
69
-        if (   !$this->can_do('midgard:update')
69
+        if (!$this->can_do('midgard:update')
70 70
             || !$this->can_do('midgard:privileges')) {
71 71
             debug_add("Failed to set a privilege, midgard:update or midgard:privileges on " . static::class . " {$this->guid} not granted for the current user.",
72 72
             MIDCOM_LOG_ERROR);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function unset_privilege($privilege, $assignee = null, string $classname = '') : bool
98 98
     {
99
-        if (   !$this->can_do('midgard:update')
99
+        if (!$this->can_do('midgard:update')
100 100
             || !$this->can_do('midgard:privileges')) {
101 101
             debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on " . static::class . " {$this->guid} not granted for the current user.",
102 102
             MIDCOM_LOG_ERROR);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      *     midcom_core_group object or subtype thereof.
126 126
      * @param string $classname An optional class name to which a SELF privilege is restricted to.
127 127
      */
128
-    public function get_privilege(string $privilege, midcom_core_user|midcom_core_group|string $assignee, string $classname = '')
128
+    public function get_privilege(string $privilege, midcom_core_user | midcom_core_group | string $assignee, string $classname = '')
129 129
     {
130 130
         if (!$this->can_do('midgard:privileges')) {
131 131
             debug_add("Failed to get a privilege, midgard:update or midgard:privileges on " . static::class . " {$this->guid} not granted for the current user.",
Please login to merge, or discard this patch.
lib/midcom/helper/imagefilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         $tmpfile = null;
324 324
         $imagesize = getimagesize($this->_filename);
325 325
 
326
-        if (   $imagesize[2] == IMAGETYPE_JPEG
326
+        if ($imagesize[2] == IMAGETYPE_JPEG
327 327
             && $this->_jpegtran_available()) {
328 328
             /* jpegtran */
329 329
             $operations = [
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         $imagesize = getimagesize($this->_filename);
391 391
 
392 392
         // Try lossless jpegtran rotation if possible
393
-        if (   $imagesize[2] == IMAGETYPE_JPEG
393
+        if ($imagesize[2] == IMAGETYPE_JPEG
394 394
             && ($rotate % 90 == 0)
395 395
             && $this->_jpegtran_available()) {
396 396
             $tmpfile = $this->_get_tempfile();
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      */
503 503
     public function fill(?int $x = null, ?int $y = null, ?string $color = null, string $gravity = 'center')
504 504
     {
505
-        if (   empty($x)
505
+        if (empty($x)
506 506
             || empty($y)
507 507
             || empty($color)) {
508 508
             //This is a bit silly, but here for backwards compatibility...
Please login to merge, or discard this patch.
lib/midgard/admin/asgard/navigation.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $this->_component = 'midgard.admin.asgard';
35 35
 
36 36
         $this->_object = $object;
37
-        $this->_request_data =& $request_data;
37
+        $this->_request_data = & $request_data;
38 38
 
39 39
         $root_types = midgard_admin_asgard_plugin::get_root_classes();
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             // we go through the path bottom up and show the first root type we find
51 51
             foreach (array_reverse($this->_object_path) as $node) {
52 52
                 foreach (array_keys($root_types) as $root_type) {
53
-                    if (   $node instanceof $root_type
53
+                    if ($node instanceof $root_type
54 54
                         || midcom_helper_reflector::is_same_class($root_type, $node->__midcom_class_name__)) {
55 55
                         $this->expanded_root_types[] = $root_type;
56 56
                         break;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     protected function _is_collapsed(string $type, int $total) : bool
64 64
     {
65
-        return (   $total > $this->_config->get('max_navigation_entries')
65
+        return ($total > $this->_config->get('max_navigation_entries')
66 66
                 && empty($_GET['show_all_' . $type]));
67 67
     }
68 68
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         foreach ($ref->get_child_classes() as $class) {
79 79
             $qb = $ref->_child_objects_type_qb($class, $object, false);
80 80
 
81
-            if (   !$qb
81
+            if (!$qb
82 82
                 || !($count = $qb->count_unchecked())) {
83 83
                 continue;
84 84
             }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $qb = $ref->_root_objects_qb();
126 126
 
127
-        if (   !$qb
127
+        if (!$qb
128 128
             || !($total = $qb->count_unchecked())) {
129 129
             return;
130 130
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
         echo "<a href=\"" . midcom_connection::get_url('self') . "__mfa/asgard/object/{$mode}/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n";
205
-        if (   $selected
205
+        if ($selected
206 206
             || $autoexpand) {
207 207
             $this->_list_child_elements($object, $level + 1);
208 208
         }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                 continue;
223 223
             }
224 224
 
225
-            if (   method_exists($class, 'navigation')
225
+            if (method_exists($class, 'navigation')
226 226
                 && ($this->_request_data['plugin_name'] == "asgard_{$component}")) {
227 227
                 $this->_request_data['expanded'] = true;
228 228
                 midcom_show_style('midgard_admin_asgard_navigation_section_header');
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
         if ($this->_is_selected($object)) {
257 257
             $css_class .= ' selected';
258 258
         }
259
-        if (   is_object($this->_object)
260
-            && (   $object->guid == $this->_object->guid
261
-                || (   $this->_object instanceof midcom_db_parameter
259
+        if (is_object($this->_object)
260
+            && ($object->guid == $this->_object->guid
261
+                || ($this->_object instanceof midcom_db_parameter
262 262
                     && $object->guid == $this->_object->parentguid))) {
263 263
             $css_class .= ' current';
264 264
         }
265
-        if ( !$object->can_do('midgard:update')) {
265
+        if (!$object->can_do('midgard:update')) {
266 266
             $css_class .= ' readonly';
267 267
         }
268 268
         return $css_class;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         // Get the types that might have special display conditions
284 284
         // @TODO: Should this just include to the configuration selection, although it would break the consistency
285 285
         // of other similar preference sets, which simply override the global settings?
286
-        if (   ($selected = midgard_admin_asgard_plugin::get_preference('midgard_types'))
286
+        if (($selected = midgard_admin_asgard_plugin::get_preference('midgard_types'))
287 287
             && preg_match_all('/\|([a-z0-9\.\-_]+)/', $selected, $regs)) {
288 288
             $types = array_flip($regs[1]);
289 289
             if ($exclude) {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             }
302 302
 
303 303
             // If the regular expression has been set, check which types should be shown
304
-            $label_mapping = array_filter($label_mapping, function ($root_type) use ($regexp, $exclude) {
304
+            $label_mapping = array_filter($label_mapping, function($root_type) use ($regexp, $exclude) {
305 305
                 return preg_match($regexp, $root_type) == $exclude;
306 306
             }, ARRAY_FILTER_USE_KEY);
307 307
         }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
          * click if nothing is expanded
332 332
          */
333 333
         $types_shown = false;
334
-        if (    !empty($expanded_types)
334
+        if (!empty($expanded_types)
335 335
              && midgard_admin_asgard_plugin::get_preference('navigation_type') === 'dropdown') {
336 336
             $this->_draw_select_navigation();
337 337
             $types_shown = true;
Please login to merge, or discard this patch.
lib/org/openpsa/user/accounthelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $account = $this->get_account();
152 152
         if (!empty($new_password)) {
153 153
             // check if the new encrypted password was already used
154
-            if (   !$this->check_password_reuse($new_password)
154
+            if (!$this->check_password_reuse($new_password)
155 155
                 || !$this->check_password_strength($new_password)) {
156 156
                 return false;
157 157
             }
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
     public static function get_person_by_formdata(array $data) : ?midcom_db_person
425 425
     {
426
-        if (   empty($data['username'])
426
+        if (empty($data['username'])
427 427
             || empty($data['password'])) {
428 428
             return null;
429 429
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
          * If the maximum number of attempts is reached and the oldest attempt
473 473
          * on the stack is within our defined timeframe, we block the account
474 474
          */
475
-        if (   count($attempts) >= $max_attempts
475
+        if (count($attempts) >= $max_attempts
476 476
             && $attempts[$max_attempts - 1] >= (time() - ($timeframe * 60))) {
477 477
             $this->disable_account();
478 478
             $stat = false;
Please login to merge, or discard this patch.
lib/org/openpsa/user/validator.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $result = $this->is_username_available($fields);
60 60
         $accounthelper = $this->get_accounthelper();
61
-        if (   $fields['password']['switch']
61
+        if ($fields['password']['switch']
62 62
             && !$accounthelper->check_password_strength((string) $fields['password']['password'])) {
63 63
             $result = ['password' => $accounthelper->errstr];
64 64
         }
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $result = [];
163 163
 
164 164
         $accounthelper = $this->get_accounthelper(new midcom_db_person($fields["person"]));
165
-        if (!$accounthelper->check_password_reuse($fields['new_password'])){
165
+        if (!$accounthelper->check_password_reuse($fields['new_password'])) {
166 166
             $result['new_password'] = $accounthelper->errstr;
167
-        } elseif (!$accounthelper->check_password_strength($fields['new_password'])){
167
+        } elseif (!$accounthelper->check_password_strength($fields['new_password'])) {
168 168
             $result['new_password'] = $accounthelper->errstr;
169 169
         }
170 170
         return $result ?: true;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -162,9 +162,9 @@
 block discarded – undo
162 162
         $result = [];
163 163
 
164 164
         $accounthelper = $this->get_accounthelper(new midcom_db_person($fields["person"]));
165
-        if (!$accounthelper->check_password_reuse($fields['new_password'])){
165
+        if (!$accounthelper->check_password_reuse($fields['new_password'])) {
166 166
             $result['new_password'] = $accounthelper->errstr;
167
-        } elseif (!$accounthelper->check_password_strength($fields['new_password'])){
167
+        } elseif (!$accounthelper->check_password_strength($fields['new_password'])) {
168 168
             $result['new_password'] = $accounthelper->errstr;
169 169
         }
170 170
         return $result ?: true;
Please login to merge, or discard this patch.
lib/net/nehmer/comments/handler/view.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
         if (!$this->_schemadb) {
67 67
             $this->_schemadb = schemadb::from_path($this->_config->get('schemadb'));
68 68
 
69
-            if (   $this->_config->get('use_captcha')
70
-                || (   !midcom::get()->auth->user
69
+            if ($this->_config->get('use_captcha')
70
+                || (!midcom::get()->auth->user
71 71
                     && $this->_config->get('use_captcha_if_anonymous'))) {
72 72
                 $fields = $this->_schemadb->get('comment')->get('fields');
73 73
                 $fields['captcha'] = [
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 $this->_schemadb->get('comment')->set('fields', $fields);
81 81
             }
82 82
 
83
-            if (   $this->_config->get('ratings_enable')
83
+            if ($this->_config->get('ratings_enable')
84 84
                 && $this->_schemadb->get('comment')->has_field('rating')) {
85 85
                 $this->_schemadb->get('comment')->get_field('rating')['hidden'] = false;
86 86
             }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $this->_comments = $this->_comments->execute();
146 146
         }
147 147
 
148
-        if (   midcom::get()->auth->user
148
+        if (midcom::get()->auth->user
149 149
             || $this->_config->get('allow_anonymous')) {
150 150
             $this->_init_post_controller($request);
151 151
             if ($response = $this->_process_post($request)) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     private function _process_post(Request $request)
176 176
     {
177
-        if (   !midcom::get()->auth->user
177
+        if (!midcom::get()->auth->user
178 178
             && !midcom::get()->auth->request_sudo($this->_component)) {
179 179
             throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting');
180 180
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 }
188 188
 
189 189
                 $formdata = $this->_post_controller->get_form_values();
190
-                if (   $formdata['subscribe']
190
+                if ($formdata['subscribe']
191 191
                     && midcom::get()->auth->user) {
192 192
                     // User wants to subscribe to receive notifications about this comments thread
193 193
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     private function _get_last_modified() : int
223 223
     {
224
-        return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) {
224
+        return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) {
225 225
             return max($item->metadata->revised, $carry);
226 226
         }, 0);
227 227
     }
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
                 $data['comment_toolbar'] = $this->populate_post_toolbar($comment);
241 241
                 midcom_show_style('comments-item');
242 242
 
243
-                if (   midcom::get()->auth->admin
244
-                    || (   midcom::get()->auth->user
243
+                if (midcom::get()->auth->admin
244
+                    || (midcom::get()->auth->user
245 245
                         && $comment->can_do('midgard:delete'))) {
246 246
                     midcom_show_style('comments-admintoolbar');
247 247
                 }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             midcom_show_style('comments-nonefound');
252 252
         }
253 253
 
254
-        if (   midcom::get()->auth->user
254
+        if (midcom::get()->auth->user
255 255
             || $this->_config->get('allow_anonymous')) {
256 256
             midcom_show_style('post-comment');
257 257
         } else {
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
@@ -185,7 +185,8 @@
 block discarded – undo
185 185
 
186 186
         try {
187 187
             $account = new midcom_core_account($person);
188
-        } catch (midcom_error) {
188
+        }
189
+        catch (midcom_error) {
189 190
             midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('failed to get the user with id %s'), $person->id), 'error');
190 191
             return;
191 192
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/campaign/rules.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,8 @@
 block discarded – undo
90 90
         if ($request->request->has('midcom_helper_datamanager2_save')) {
91 91
             try {
92 92
                 $rules = $this->_load_rules($request);
93
-            } catch (midcom_error $e) {
93
+            }
94
+            catch (midcom_error $e) {
94 95
                 midcom::get()->uimessages->add($this->_component, $this->_l10n->get($e->getMessage()), 'error');
95 96
                 return;
96 97
             }
Please login to merge, or discard this patch.