Passed
Push — master ( 0c04d4...cce3fe )
by Andreas
21:48
created
src/midcom/datamanager/helper/autocomplete.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     private function apply_constraints(midcom_core_query $query, array $constraints)
84 84
     {
85 85
         foreach ($constraints as $key => $data) {
86
-            if (   !array_key_exists('value', $data)
86
+            if (!array_key_exists('value', $data)
87 87
                 || empty($data['field'])
88 88
                 || empty($data['op'])) {
89 89
                 debug_add("Constraint #{$key} is not correctly defined, skipping", MIDCOM_LOG_WARN);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     {
145 145
         $query = $this->request["term"];
146 146
         $wildcard_query = $query;
147
-        if (   isset($this->request['auto_wildcards'])
147
+        if (isset($this->request['auto_wildcards'])
148 148
             && !str_contains($query, '%')) {
149 149
             switch ($this->request['auto_wildcards']) {
150 150
                 case 'start':
@@ -252,9 +252,7 @@  discard block
 block discarded – undo
252 252
                 return $label;
253 253
             }
254 254
         }
255
-        return midcom_helper_reflector::get($object)->get_object_label($object) ?:
256
-            self::build_label($object, array_column($result_headers, 'name')) ?:
257
-            get_class($object) . ' #' . $object->id;
255
+        return midcom_helper_reflector::get($object)->get_object_label($object) ?: self::build_label($object, array_column($result_headers, 'name')) ?: get_class($object) . ' #' . $object->id;
258 256
     }
259 257
 
260 258
     private static function build_label($object, array $fields) : string
@@ -289,7 +287,7 @@  discard block
 block discarded – undo
289 287
             }
290 288
             return self::sanitize_label($value);
291 289
         }
292
-        if (   $field == 'username'
290
+        if ($field == 'username'
293 291
             && $object instanceof midcom_db_person) {
294 292
             $account = new midcom_core_account($object);
295 293
             return self::sanitize_label($account->get_username());
Please login to merge, or discard this patch.