@@ -32,7 +32,7 @@ |
||
| 32 | 32 | echo " <td><a href='" . $data['router']->generate('preview', ['guid' => $guid, 'revision' => $number]) . "'>{$revision['version']}</a></td>\n"; |
| 33 | 33 | echo " <td>" . $formatter->datetime($revision['date']) . "</td>\n"; |
| 34 | 34 | |
| 35 | - if ( $revision['user'] |
|
| 35 | + if ($revision['user'] |
|
| 36 | 36 | && $user = midcom::get()->auth->get_user($revision['user'])) { |
| 37 | 37 | $person_label = $user->get_storage()->name; |
| 38 | 38 | echo " <td>{$person_label}</td>\n"; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function form_widget_simple(FormView $view, array $data) |
| 19 | 19 | { |
| 20 | - if ( !empty($data['value']) |
|
| 20 | + if (!empty($data['value']) |
|
| 21 | 21 | || is_numeric($data['value'])) { |
| 22 | 22 | return $data['value']; |
| 23 | 23 | } |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | |
| 144 | 144 | public function form_widget_simple(FormView $view, array $data) |
| 145 | 145 | { |
| 146 | - if ( !empty($data['value']) |
|
| 146 | + if (!empty($data['value']) |
|
| 147 | 147 | || is_numeric($data['value'])) { |
| 148 | 148 | return $this->escape($data['value']); |
| 149 | 149 | } |
@@ -45,7 +45,8 @@ discard block |
||
| 45 | 45 | $object = self::_load_backend($backend, $params); |
| 46 | 46 | debug_add('Using backend ' . $backend); |
| 47 | 47 | return $object; |
| 48 | - } catch (midcom_error $e) { |
|
| 48 | + } |
|
| 49 | + catch (midcom_error $e) { |
|
| 49 | 50 | debug_add('Failed to load backend ' . $backend . ', message:' . $e->getMessage()); |
| 50 | 51 | } |
| 51 | 52 | } |
@@ -80,7 +81,8 @@ discard block |
||
| 80 | 81 | $ret = $this->mail($message); |
| 81 | 82 | $this->error = null; |
| 82 | 83 | return $ret; |
| 83 | - } catch (Exception $e) { |
|
| 84 | + } |
|
| 85 | + catch (Exception $e) { |
|
| 84 | 86 | $this->error = $e->getMessage(); |
| 85 | 87 | return false; |
| 86 | 88 | } |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | { |
| 34 | 34 | try { |
| 35 | 35 | midcom::get()->cache->invalidate_all(); |
| 36 | - } catch (\Throwable $e) { |
|
| 36 | + } |
|
| 37 | + catch (\Throwable $e) { |
|
| 37 | 38 | $output->writeln($e->getMessage()); |
| 38 | 39 | } |
| 39 | 40 | $fs = new Filesystem; |
@@ -64,7 +64,8 @@ |
||
| 64 | 64 | try { |
| 65 | 65 | $this->__object = $this->__midcom_class_name__::get_cached($this->__identifier); |
| 66 | 66 | return true; |
| 67 | - } catch (midcom_error $e) { |
|
| 67 | + } |
|
| 68 | + catch (midcom_error $e) { |
|
| 68 | 69 | $e->log(); |
| 69 | 70 | } |
| 70 | 71 | return false; |
@@ -73,7 +73,8 @@ |
||
| 73 | 73 | if (is_a($stat, midcom_services_indexer_client::class)) { |
| 74 | 74 | try { |
| 75 | 75 | $stat->reindex(); |
| 76 | - } catch (RequestException $e) { |
|
| 76 | + } |
|
| 77 | + catch (RequestException $e) { |
|
| 77 | 78 | if ($e->hasResponse()) { |
| 78 | 79 | $crawler = new Crawler($e->getResponse()->getBody()->getContents()); |
| 79 | 80 | $body = $crawler->filterXPath('//body')->html(); |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | $address = addslashes($address); |
| 167 | 167 | return preg_replace_callback( |
| 168 | 168 | '/href="(http:\/\/.*?)"/i', |
| 169 | - function ($match) use ($address) { |
|
| 169 | + function($match) use ($address) { |
|
| 170 | 170 | return 'href="' . str_replace("URL", rawurlencode($match[1]), $address) . '"'; |
| 171 | 171 | }, |
| 172 | 172 | $html); |
@@ -148,13 +148,13 @@ |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | - * Inserts a link detector to the given HTML source. All outgoing |
|
| 152 | - * HTTP links in the source HTML are replaced with the given |
|
| 153 | - * link detector address so that the token "URL" is replaced with |
|
| 154 | - * encoded form of the original link. It is expected that the link detector |
|
| 155 | - * address points to a script that records the passed link and |
|
| 156 | - * forwards the client to the real link target. |
|
| 157 | - */ |
|
| 151 | + * Inserts a link detector to the given HTML source. All outgoing |
|
| 152 | + * HTTP links in the source HTML are replaced with the given |
|
| 153 | + * link detector address so that the token "URL" is replaced with |
|
| 154 | + * encoded form of the original link. It is expected that the link detector |
|
| 155 | + * address points to a script that records the passed link and |
|
| 156 | + * forwards the client to the real link target. |
|
| 157 | + */ |
|
| 158 | 158 | private function _insert_link_detector(string $html, string $address) : string |
| 159 | 159 | { |
| 160 | 160 | $address = addslashes($address); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $this->calculate_price(false); |
| 83 | 83 | |
| 84 | - if ( $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 84 | + if ($this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 85 | 85 | && $this->continuous) { |
| 86 | 86 | $this->end = 0; |
| 87 | 87 | } elseif ($this->end < $this->start) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $calculator->run($this); |
| 170 | 170 | $cost = $calculator->get_cost(); |
| 171 | 171 | $price = $calculator->get_price(); |
| 172 | - if ( $price != $this->price |
|
| 172 | + if ($price != $this->price |
|
| 173 | 173 | || $cost != $this->cost) { |
| 174 | 174 | $this->price = $price; |
| 175 | 175 | $this->cost = $cost; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $units = $agreement_hours['invoiceable']; |
| 217 | 217 | $uninvoiceableUnits = $agreement_hours['reported'] - ($agreement_hours['invoiceable'] + $agreement_hours['invoiced']); |
| 218 | 218 | |
| 219 | - if ( $units != $this->units |
|
| 219 | + if ($units != $this->units |
|
| 220 | 220 | || $uninvoiceableUnits != $this->uninvoiceableUnits) { |
| 221 | 221 | debug_add("agreement values have changed, setting units to " . $units . ", uninvoiceable: " . $uninvoiceableUnits); |
| 222 | 222 | $this->units = $units; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function invoice() : bool |
| 272 | 272 | { |
| 273 | - if ( $this->state >= self::STATE_INVOICED |
|
| 273 | + if ($this->state >= self::STATE_INVOICED |
|
| 274 | 274 | || $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
| 275 | 275 | return false; |
| 276 | 276 | } |