@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($this->_config->get('sales_pdfbuilder_class')) { |
86 | - if ( $this->_salesproject->can_do('midgard:update') |
|
86 | + if ($this->_salesproject->can_do('midgard:update') |
|
87 | 87 | && $this->is_pdf_creatable()) { |
88 | 88 | $workflow = $this->get_workflow('datamanager'); |
89 | 89 | $buttons[] = $workflow->get_button($this->router->generate('create_offer', ['guid' => $this->_salesproject->guid]), [ |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | case 'ordered': |
205 | 205 | if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
206 | 206 | $entries = $deliverable->get_at_entries(); |
207 | - if ( $entries |
|
207 | + if ($entries |
|
208 | 208 | && $entries[0]->status == midcom_services_at_entry_dba::SCHEDULED |
209 | 209 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class)) { |
210 | 210 | return '<button class="run_cycle"><i class="fa fa-refresh"></i>' . $this->_l10n->get('generate now') . '</button>'; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'delivered': |
217 | - if ( $deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
217 | + if ($deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
218 | 218 | && midcom::get()->auth->can_user_do('midgard:create', class: org_openpsa_invoices_invoice_dba::class)) { |
219 | 219 | $client_class = $this->_config->get('calculator'); |
220 | 220 | $client = new $client_class(); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function configureOptions(OptionsResolver $resolver) : void |
24 | 24 | { |
25 | - $map_attr = function (Options $options, $value) { |
|
25 | + $map_attr = function(Options $options, $value) { |
|
26 | 26 | $value ??= []; |
27 | 27 | $value['rows'] = $options['widget_config']['height']; |
28 | 28 | $value['cols'] = $options['widget_config']['width']; |
@@ -33,8 +33,8 @@ discard block |
||
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 |
||
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 | } |
@@ -54,7 +54,7 @@ discard block |
||
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 |
||
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 |
@@ -27,7 +27,7 @@ |
||
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; |
@@ -75,7 +75,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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)) { |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -155,7 +155,7 @@ discard block |
||
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 |
||
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(); |
@@ -59,7 +59,7 @@ |
||
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 |