Passed
Push — master ( 805652...eccbd5 )
by Andreas
26:13
created
lib/org/openpsa/sales/handler/list.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,8 @@
 block discarded – undo
113 113
         try {
114 114
             $this->_request_data['customer'] = new org_openpsa_contacts_group_dba($guid);
115 115
             $qb->add_constraint('customer', '=', $this->_request_data['customer']->id);
116
-        } catch (midcom_error $e) {
116
+        }
117
+        catch (midcom_error $e) {
117 118
             $this->_request_data['customer'] = new org_openpsa_contacts_person_dba($guid);
118 119
             $qb->add_constraint('customerContact', '=', $this->_request_data['customer']->id);
119 120
         }
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/midcom/interfaces.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,8 @@
 block discarded – undo
159 159
 
160 160
         try {
161 161
             $object = new $classname($guid);
162
-        } catch (midcom_error $e) {
162
+        }
163
+        catch (midcom_error $e) {
163 164
             $handler->print_error($type . " {$guid} not found, error " . $e->getMessage());
164 165
             return false;
165 166
         }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 
78 78
     public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) : ?string
79 79
     {
80
-        if (   $object instanceof org_openpsa_contacts_group_dba
80
+        if ($object instanceof org_openpsa_contacts_group_dba
81 81
             || $object instanceof midcom_db_group) {
82 82
             return "group/{$object->guid}/";
83 83
         }
84
-        if (   $object instanceof org_openpsa_contacts_person_dba
84
+        if ($object instanceof org_openpsa_contacts_person_dba
85 85
             || $object instanceof midcom_db_person) {
86 86
             return "person/{$object->guid}/";
87 87
         }
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
             // We have a feed URL, but we should check if it is GeoRSS as well
111 111
             $items = net_nemein_rss_fetch::raw_fetch($data['rss_url'])->get_items();
112 112
 
113
-            if (   !empty($items)
114
-                && (   $items[0]->get_latitude()
113
+            if (!empty($items)
114
+                && ($items[0]->get_latitude()
115 115
                     || $items[0]->get_longitude())) {
116 116
                 // This is a GeoRSS feed
117 117
                 $data['georss_url'] = $data['rss_url'];
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/duplicates/check.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -382,7 +382,8 @@
 block discarded – undo
382 382
             try {
383 383
                 $obj1 = $class::get_cached($arr1['guid']);
384 384
                 $obj2 = $class::get_cached($arr2['guid']);
385
-            } catch (midcom_error $e) {
385
+            }
386
+            catch (midcom_error $e) {
386 387
                 $e->log();
387 388
                 continue;
388 389
             }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             // if user's lastname is part of the email address, check to see if the difference is only in the domain part
129 129
             $email1 = preg_replace('/@.+/', '', $person1['email']);
130 130
             $email2 = preg_replace('/@.+/', '', $person2['email']);
131
-            if (   str_contains($email1, $person1['lastname'])
131
+            if (str_contains($email1, $person1['lastname'])
132 132
                 && $email1 == $email2) {
133 133
                 $ret['email_match'] = true;
134 134
                 $ret['p'] += 0.5;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
     private function match(string $property, array $data1, array $data2) : bool
176 176
     {
177
-        if (   !empty($data1[$property])
177
+        if (!empty($data1[$property])
178 178
             && $data1[$property] == $data2[$property]) {
179 179
             return true;
180 180
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         $persons = $this->get_person_candidates();
326 326
 
327 327
         $params = [];
328
-        $params['objects'] =& $persons;
328
+        $params['objects'] = & $persons;
329 329
         $params['mode'] = 'person';
330 330
 
331 331
         array_walk($persons, [$this, 'check_all_arraywalk'], $params);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 continue;
388 388
             }
389 389
 
390
-            if (   $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
390
+            if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid)
391 391
                 || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) {
392 392
                 // Not-duplicate parameter found, returning zero probability
393 393
                 continue;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
         $groups = $this->get_group_candidates();
416 416
         $params = [];
417
-        $params['objects'] =& $groups;
417
+        $params['objects'] = & $groups;
418 418
         $params['mode'] = 'group';
419 419
         array_walk($groups, [$this, 'check_all_arraywalk'], $params);
420 420
 
Please login to merge, or discard this patch.
lib/org/openpsa/reports/handler/invoices/report.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,8 @@
 block discarded – undo
114 114
                         && $deliverable->end > $this->_request_data['start'])) {
115 115
                     $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry));
116 116
                 }
117
-            } catch (midcom_error $e) {
117
+            }
118
+            catch (midcom_error $e) {
118 119
             }
119 120
         }
120 121
         $invoices = array_merge($invoices, $this->_get_deliverable_invoices());
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     private function _get_invoices_for_subscription(org_openpsa_sales_salesproject_deliverable_dba $deliverable, midcom_services_at_entry_dba $at_entry) : array
66 66
     {
67
-        if (   $deliverable->invoiceByActualUnits
67
+        if ($deliverable->invoiceByActualUnits
68 68
             && $at_entry->arguments['cycle'] > 1) {
69 69
             $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1);
70 70
             if ($invoice_sum == 0) {
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
         $time = $at_entry->start;
81 81
         $scheduler = new org_openpsa_invoices_scheduler($deliverable);
82 82
 
83
-        while (   $time < $this->_request_data['end']
84
-               && (   $time < $deliverable->end
83
+        while ($time < $this->_request_data['end']
84
+               && ($time < $deliverable->end
85 85
                    || $deliverable->continuous)) {
86 86
             $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base);
87 87
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
         foreach ($qb->execute() as $at_entry) {
124 124
             try {
125 125
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']);
126
-                if (   $deliverable->continuous
127
-                    || (   $deliverable->start < $this->_request_data['end']
126
+                if ($deliverable->continuous
127
+                    || ($deliverable->start < $this->_request_data['end']
128 128
                         && $deliverable->end > $this->_request_data['start'])) {
129 129
                     $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry));
130 130
                 }
Please login to merge, or discard this patch.
lib/org/openpsa/reports/handler/sales/report.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
             $owner = org_openpsa_contacts_person_dba::get_cached($salesproject->owner);
72 72
             $row['index_owner'] = $owner->name;
73 73
             $row['owner'] = org_openpsa_widgets_contact::get($owner->guid)->show_inline();
74
-        } catch (midcom_error $e) {
74
+        }
75
+        catch (midcom_error $e) {
75 76
             $e->log();
76 77
         }
77 78
         $row['amount'] = $object->pricePerUnit * $object->units;
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/campaign/ruleresolver.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -269,7 +269,8 @@
 block discarded – undo
269 269
             $guid = $mc_parameter->get_subkey($parameter_key, 'parentguid');
270 270
             try {
271 271
                 $parent = midcom::get()->dbfactory->get_object_by_guid($guid);
272
-            } catch (midcom_error $e) {
272
+            }
273
+            catch (midcom_error $e) {
273 274
                 $e->log();
274 275
                 continue;
275 276
             }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     private function add_misc_rule(array $rule, string $class, string $person_property) : bool
300 300
     {
301
-        $persons = [ 0 => -1];
301
+        $persons = [0 => -1];
302 302
         $match = $rule['match'];
303 303
         $constraint_match = "IN";
304 304
         if ($rule['match'] == '<>') {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         $ret = [];
375 375
 
376 376
         foreach ($object->get_properties() as $property) {
377
-            if (   $property[0] == '_'
377
+            if ($property[0] == '_'
378 378
                 || in_array($property, $skip_properties)
379 379
                 || property_exists($object, $property)) {
380 380
                 // Skip private or otherwise invalid properties
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/campaign/member.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@
 block discarded – undo
151 151
             return;
152 152
         }
153 153
         foreach ($parameters as $param_data) {
154
-            if (   empty($param_data['domain'])
154
+            if (empty($param_data['domain'])
155 155
                 || empty($param_data['name'])
156 156
                 || empty($param_data['value'])) {
157 157
                 // TODO: Log warning
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/export.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@  discard block
 block discarded – undo
59 59
     {
60 60
         try {
61 61
             $person = new org_openpsa_contacts_person_dba($member->person);
62
-        } catch (midcom_error $e) {
62
+        }
63
+        catch (midcom_error $e) {
63 64
             $e->log();
64 65
             return;
65 66
         }
@@ -82,7 +83,8 @@  discard block
 block discarded – undo
82 83
                 $row['organization_member'] = $membership;
83 84
                 try {
84 85
                     $row['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid);
85
-                } catch (midcom_error $e) {
86
+                }
87
+                catch (midcom_error $e) {
86 88
                     debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN);
87 89
                     continue;
88 90
                 }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/message/report.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,8 @@
 block discarded – undo
142 142
                 try {
143 143
                     $person = org_openpsa_contacts_person_dba::get_cached($link->person);
144 144
                     $segment = $person->get_parameter('org.openpsa.directmarketing.segments', $segmentation_param);
145
-                } catch (midcom_error $e) {
145
+                }
146
+                catch (midcom_error $e) {
146 147
                 }
147 148
                 if (empty($segment)) {
148 149
                     $segment = $this->_l10n->get('no segment');
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $qb_receipts->add_constraint('message', '=', $this->_message->id);
44 44
         $qb_receipts->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT);
45 45
         $receipts = $qb_receipts->execute_unchecked();
46
-        $receipt_data =& $this->_request_data['report']['receipt_data'];
46
+        $receipt_data = & $this->_request_data['report']['receipt_data'];
47 47
         $receipt_data['first_send'] = $receipts[0]->timestamp ?? 0;
48 48
         $receipt_data['last_send'] = 0;
49 49
         $receipt_data['sent'] = count($receipts);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     private function _get_campaign_data(int $first_send)
78 78
     {
79
-        $campaign_data =& $this->_request_data['report']['campaign_data'];
79
+        $campaign_data = & $this->_request_data['report']['campaign_data'];
80 80
         $qb_unsub = org_openpsa_directmarketing_campaign_member_dba::new_query_builder();
81 81
         $qb_unsub->add_constraint('campaign', '=', $this->_message->campaign);
82 82
         $qb_unsub->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     private function _get_link_data($segmentation_param)
101 101
     {
102 102
         $this->_request_data['report']['link_data'] = [];
103
-        $link_data =& $this->_request_data['report']['link_data'];
103
+        $link_data = & $this->_request_data['report']['link_data'];
104 104
 
105 105
         $link_data['counts'] = [];
106 106
         $link_data['percentages'] = ['of_links' => [], 'of_recipients' => []];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         foreach ($links as $link) {
127 127
             $segment = '';
128 128
             $segment_notfound = false;
129
-            if (   $segmentation_param
129
+            if ($segmentation_param
130 130
                 && !empty($link->person)) {
131 131
                 try {
132 132
                     $person = org_openpsa_contacts_person_dba::get_cached($link->person);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 if (!isset($link_data['segments'][$segment])) {
141 141
                     $link_data['segments'][$segment] = $segment_prototype;
142 142
                 }
143
-                $segment_data =& $link_data['segments'][$segment];
143
+                $segment_data = & $link_data['segments'][$segment];
144 144
             } else {
145 145
                 $segment_data = $segment_prototype;
146 146
             }
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
         $this->_initialize_field($array['percentages']['of_links'], $link);
251 251
         $this->_initialize_field($array['percentages']['of_recipients'], $link);
252 252
 
253
-        $link_data =& $this->_request_data['report']['link_data'];
254
-        $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total']/$link_data['total'])*100;
255
-        $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/$link_data['total'])*100;
253
+        $link_data = & $this->_request_data['report']['link_data'];
254
+        $array['percentages']['of_links'][$link->target]['total'] = ($array['counts'][$link->target]['total'] / $link_data['total']) * 100;
255
+        $array['percentages']['of_links'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / $link_data['total']) * 100;
256 256
 
257
-        $receipt_data =& $this->_request_data['report']['receipt_data'];
258
-        $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target])-1)/($receipt_data['sent']-$receipt_data['bounced']))*100;
259
-        $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token]/($receipt_data['sent']-$receipt_data['bounced']))*100;
257
+        $receipt_data = & $this->_request_data['report']['receipt_data'];
258
+        $array['percentages']['of_recipients'][$link->target]['total'] = ((count($array['counts'][$link->target]) - 1) / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100;
259
+        $array['percentages']['of_recipients'][$link->target][$link->token] = ($array['counts'][$link->target][$link->token] / ($receipt_data['sent'] - $receipt_data['bounced'])) * 100;
260 260
 
261
-        if (   !isset($array['percentages']['of_recipients']['total'])
261
+        if (!isset($array['percentages']['of_recipients']['total'])
262 262
             || $array['percentages']['of_recipients'][$link->target]['total'] > $array['percentages']['of_recipients']['total']) {
263 263
             $array['percentages']['of_recipients']['total'] = $array['percentages']['of_recipients'][$link->target]['total'];
264 264
         }
Please login to merge, or discard this patch.