Passed
Push — master ( 3b4316...c86071 )
by Andreas
12:30
created
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.
lib/org/openpsa/user/handler/person/account.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]);
45 45
         $response = $workflow->run($request);
46 46
 
47
-        if (   $workflow->get_state() == 'save'
47
+        if ($workflow->get_state() == 'save'
48 48
             && $this->create_account($this->person, $data["controller"]->get_form_values())) {
49 49
             midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('person %s created'), $this->person->name));
50 50
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $person = new midcom_db_person($guid);
78 78
         $accounthelper = new org_openpsa_user_accounthelper($person);
79 79
         if ($accounthelper->welcome_email()) {
80
-            midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email ));
80
+            midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('password reset and mail to %s sent'), $person->email));
81 81
         } else {
82 82
             midcom::get()->uimessages->add($this->_l10n->get($this->_component), $accounthelper->errstr, 'error');
83 83
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $accounthelper = new org_openpsa_user_accounthelper($this->person);
134 134
 
135 135
         // Update account
136
-        if (   !$accounthelper->set_account($controller->get_form_values()["username"], $password)
136
+        if (!$accounthelper->set_account($controller->get_form_values()["username"], $password)
137 137
             && midcom_connection::get_error() != MGD_ERR_OK) {
138 138
             // Failure, give a message
139 139
             midcom::get()->uimessages->add($this->_l10n->get($this->_component), $this->_l10n->get("failed to update the user account, reason") . ': ' . $accounthelper->errstr, 'error');
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/create.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,8 @@
 block discarded – undo
63 63
         if ($group > 0) {
64 64
             try {
65 65
                 $this->parent = new org_openpsa_products_product_group_dba($group);
66
-            } catch (midcom_error $e) {
66
+            }
67
+            catch (midcom_error $e) {
67 68
                 $e->log();
68 69
             }
69 70
         }
Please login to merge, or discard this patch.
lib/net/nehmer/blog/handler/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             ]);
39 39
         }
40 40
 
41
-        if (   $this->_article->topic === $this->_topic->id
41
+        if ($this->_article->topic === $this->_topic->id
42 42
             && $this->_article->can_do('midgard:delete')) {
43 43
             $delete = $this->get_workflow('delete', ['object' => $this->_article]);
44 44
             $buttons[] = $delete->get_button($this->router->generate('delete', ['guid' => $this->_article->guid]));
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         if ($this->_config->get('comments_enable')) {
74 74
             if ($node = net_nehmer_comments_interface::get_node($this->_topic, $this->_config->get('comments_topic'))) {
75 75
                 $data['comments_url'] = $node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}/";
76
-                if (   $this->_topic->can_do('midgard:update')
76
+                if ($this->_topic->can_do('midgard:update')
77 77
                     && $this->_topic->can_do('net.nehmer.comments:moderation')) {
78 78
                     net_nehmer_comments_viewer::add_head_elements();
79 79
                 }
Please login to merge, or discard this patch.
src/midcom/datamanager/helper/autocomplete.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     private function apply_constraints(midcom_core_query $query, array $constraints)
77 77
     {
78 78
         foreach ($constraints as $key => $data) {
79
-            if (   !array_key_exists('value', $data)
79
+            if (!array_key_exists('value', $data)
80 80
                 || empty($data['field'])
81 81
                 || empty($data['op'])) {
82 82
                 debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $query = $this->request["term"];
139 139
         $wildcard_query = $query;
140
-        if (   isset($this->request['auto_wildcards'])
140
+        if (isset($this->request['auto_wildcards'])
141 141
             && !str_contains($query, '%')) {
142 142
             switch ($this->request['auto_wildcards']) {
143 143
                 case 'start':
@@ -245,9 +245,7 @@  discard block
 block discarded – undo
245 245
                 return $label;
246 246
             }
247 247
         }
248
-        return midcom_helper_reflector::get($object)->get_object_label($object) ?:
249
-            self::build_label($object, array_column($result_headers, 'name')) ?:
250
-            $object::class . ' #' . $object->id;
248
+        return midcom_helper_reflector::get($object)->get_object_label($object) ?: self::build_label($object, array_column($result_headers, 'name')) ?: $object::class . ' #' . $object->id;
251 249
     }
252 250
 
253 251
     private static function build_label($object, array $fields) : string
@@ -282,7 +280,7 @@  discard block
 block discarded – undo
282 280
             }
283 281
             return self::sanitize_label($value);
284 282
         }
285
-        if (   $field == 'username'
283
+        if ($field == 'username'
286 284
             && $object instanceof midcom_db_person) {
287 285
             $account = new midcom_core_account($object);
288 286
             return self::sanitize_label($account->get_username());
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/nameresolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function get_object_name(?string $name_property = null) : ?string
33 33
     {
34 34
         $name_property ??= midcom_helper_reflector::get_name_property($this->_object);
35
-        if (    empty($name_property)
35
+        if (empty($name_property)
36 36
             || !midcom_helper_reflector::get($this->_object)->property_exists($name_property)) {
37 37
             // Could not resolve valid property
38 38
             return null;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
             $qb->add_constraint($child_name_property, '=', $name);
126 126
             if ($qb->count()) {
127
-                debug_add("Name clash in sibling class {$schema_type} for " . $this->_object::class . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" );
127
+                debug_add("Name clash in sibling class {$schema_type} for " . $this->_object::class . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')");
128 128
                 return false;
129 129
             }
130 130
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         } while (!$this->name_is_unique());
200 200
 
201 201
         // Get a copy of the current, usable name
202
-        $ret = (string)$this->_object->{$name_prop};
202
+        $ret = (string) $this->_object->{$name_prop};
203 203
         // Restore the original name
204 204
         $this->_object->{$name_prop} = $original_name;
205 205
         return $ret;
Please login to merge, or discard this patch.