Passed
Push — master ( 936202...c84ff9 )
by Andreas
09:27
created
src/midcom/datamanager/extension/transformer/jsdateTransformer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
             }
34 34
         }
35 35
 
36
-        if (   empty($input)
37
-            || (   $input instanceof DateTime
36
+        if (empty($input)
37
+            || ($input instanceof DateTime
38 38
                 && $input->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) {
39 39
             return $result;
40 40
         }
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
             throw new TransformationFailedException('Expected an array.');
60 60
         }
61 61
 
62
-        if (   empty($array['date'])
63
-            || (   $array['date'] instanceof DateTime
62
+        if (empty($array['date'])
63
+            || ($array['date'] instanceof DateTime
64 64
                 && $array['date']->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) {
65 65
             return null;
66 66
         }
Please login to merge, or discard this patch.
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.
lib/midcom/response/relocate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public function setTargetUrl(string $url) : static
29 29
     {
30
-        if (   !str_starts_with($url, "/")
30
+        if (!str_starts_with($url, "/")
31 31
             && !preg_match('|^https?://|', $url)) {
32 32
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) ?: '/';
33 33
             $url = $prefix . $url;
Please login to merge, or discard this patch.
src/midcom/grid/provider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private array $_search = [];
77 77
 
78
-    public function __construct(array|client $source, string $datatype = 'json')
78
+    public function __construct(array | client $source, string $datatype = 'json')
79 79
     {
80 80
         $this->_datatype = $datatype;
81 81
         if ($source instanceof client) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     private function _convert_to_localdata() : string
204 204
     {
205
-        return "var " . $this->_grid->get_identifier() . '_entries = ' .  json_encode($this->get_rows()) . ";\n";
205
+        return "var " . $this->_grid->get_identifier() . '_entries = ' . json_encode($this->get_rows()) . ";\n";
206 206
     }
207 207
 
208 208
     private function _render_json()
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             $this->_sort_field = $query['sidx'];
234 234
             $this->_sort_direction = strtoupper($query['sord'] ?? 'ASC');
235 235
         }
236
-        if (   !empty($query['_search'])
236
+        if (!empty($query['_search'])
237 237
             && $query['_search'] === 'true') {
238 238
             foreach ($query as $field => $value) {
239 239
                 if (in_array($field, ['_search', 'nd', 'page', 'rows', 'sidx', 'sord'])) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
         $this->_total_rows = $query->count();
258 258
 
259
-        if (   $this->_datatype == 'json'
259
+        if ($this->_datatype == 'json'
260 260
             && !empty($this->_results_per_page)) {
261 261
             $query->set_limit($this->_results_per_page);
262 262
             if (!empty($this->_offset)) {
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 " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" );
127
+                debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$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.
lib/midcom/db/attachment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         return "{$cacheroot}/{$subdir}/{$this->guid}/{$this->name}";
156 156
     }
157 157
 
158
-    public static function get_url(midgard_attachment|midcom_db_attachment|string $attachment, ?string $name = null) : string
158
+    public static function get_url(midgard_attachment | midcom_db_attachment | string $attachment, ?string $name = null) : string
159 159
     {
160 160
         if (is_string($attachment)) {
161 161
             $guid = $attachment;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function update_cache()
302 302
     {
303 303
         // Check if the attachment can be read anonymously
304
-        if (   midcom::get()->config->get('attachment_cache_enabled')
304
+        if (midcom::get()->config->get('attachment_cache_enabled')
305 305
             && !$this->can_do('midgard:read', 'EVERYONE')) {
306 306
             // Not public file, ensure it is removed
307 307
             $this->remove_from_cache();
Please login to merge, or discard this patch.
lib/org/openpsa/user/handler/person/create.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
     public function _handler_create(Request $request, array &$data, ?string $guid = null)
61 61
     {
62
-        midcom::get()->auth->require_user_do('org.openpsa.user:manage', class: org_openpsa_user_interface::class);
62
+        midcom::get()->auth->require_user_do('org.openpsa.user:manage', class : org_openpsa_user_interface::class);
63 63
 
64 64
         if ($guid !== null) {
65 65
             // Get the organization
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/handler/person/create.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function _handler_create(Request $request, ?string $guid = null)
23 23
     {
24
-        midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_contacts_person_dba::class);
24
+        midcom::get()->auth->require_user_do('midgard:create', class : org_openpsa_contacts_person_dba::class);
25 25
 
26 26
         $defaults = [];
27 27
         if (!empty($guid)) {
Please login to merge, or discard this patch.
lib/org/openpsa/sales/handler/edit.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function _handler_new(Request $request, ?string $guid = null)
39 39
     {
40
-        midcom::get()->auth->require_user_do('midgard:create', class: org_openpsa_sales_salesproject_dba::class);
40
+        midcom::get()->auth->require_user_do('midgard:create', class : org_openpsa_sales_salesproject_dba::class);
41 41
 
42 42
         $this->_salesproject = new org_openpsa_sales_salesproject_dba;
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $schemadb = schemadb::from_path($this->_config->get('schemadb_salesproject'));
49 49
 
50 50
         if ($guid) {
51
-            $field =& $schemadb->get('default')->get_field('customer');
51
+            $field = & $schemadb->get('default')->get_field('customer');
52 52
             try {
53 53
                 $customer = new org_openpsa_contacts_group_dba($guid);
54 54
                 $field['type_config']['options'] = [0 => '', $customer->id => $customer->official];
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@  discard block
 block discarded – undo
54 54
                 $field['type_config']['options'] = [0 => '', $customer->id => $customer->official];
55 55
 
56 56
                 $defaults['customer'] = $customer->id;
57
-            } catch (midcom_error) {
57
+            }
58
+            catch (midcom_error) {
58 59
                 $customer = new org_openpsa_contacts_person_dba($guid);
59 60
                 $defaults['customerContact'] = $customer->id;
60 61
                 $field['type_config']['options'] = $this->list_groups([$customer->id => true]);
@@ -126,7 +127,8 @@  discard block
 block discarded – undo
126 127
             try {
127 128
                 $company = new org_openpsa_contacts_group_dba($company_id);
128 129
                 $ret[$company->id] = $company->get_label();
129
-            } catch (midcom_error $e) {
130
+            }
131
+            catch (midcom_error $e) {
130 132
                 $e->log();
131 133
             }
132 134
         }
Please login to merge, or discard this patch.