@@ -76,7 +76,7 @@ discard block |
||
| 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 |
||
| 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': |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | return $config; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public static function create_item_label($object, array $result_headers, null|string|callable $titlefield) : string |
|
| 238 | + public static function create_item_label($object, array $result_headers, null | string | callable $titlefield) : string |
|
| 239 | 239 | { |
| 240 | 240 | if (!empty($titlefield)) { |
| 241 | 241 | if (is_callable($titlefield)) { |
@@ -245,9 +245,7 @@ discard block |
||
| 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 |
||
| 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()); |