Completed
Pull Request — master (#198)
by
unknown
19:02
created
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
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      */
314 314
     private function add_misc_rule(array $rule, $class, $person_property)
315 315
     {
316
-        $persons = [ 0 => -1];
316
+        $persons = [0 => -1];
317 317
         $match = $rule['match'];
318 318
         $constraint_match = "IN";
319 319
         if ($rule['match'] == '<>') {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         $ret = [];
391 391
 
392 392
         foreach ($object->get_properties() as $property) {
393
-            if (   preg_match('/^_/', $property)
393
+            if (preg_match('/^_/', $property)
394 394
                 || in_array($property, $skip_properties)
395 395
                 || property_exists($object, $property)) {
396 396
                 // 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'] = time();
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($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.
lib/org/openpsa/directmarketing/handler/message/compose.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         }
59 59
 
60 60
         //Substyle handling
61
-        if (   !empty($data['message_array']['substyle'])
61
+        if (!empty($data['message_array']['substyle'])
62 62
             && !preg_match('/^builtin:/', $data['message_array']['substyle'])) {
63 63
             debug_add("Appending substyle {$data['message_array']['substyle']}");
64 64
             midcom::get()->style->append_substyle($data['message_array']['substyle']);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     private function _real_show_compose($handler_id, array &$data)
118 118
     {
119 119
         $prefix = '';
120
-        if (   !empty($data['message_array']['substyle'])
120
+        if (!empty($data['message_array']['substyle'])
121 121
             && preg_match('/^builtin:(.*)/', $data['message_array']['substyle'], $matches_style)) {
122 122
             $prefix = $matches_style[1] . '-';
123 123
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/link/log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         if (!$this->timestamp) {
25 25
             $this->timestamp = time();
26 26
         }
27
-        if (   !$this->referrer
27
+        if (!$this->referrer
28 28
             && !empty($_SERVER['HTTP_REFERER'])) {
29 29
             $this->referrer = $_SERVER['HTTP_REFERER'];
30 30
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/importer.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -300,7 +300,8 @@
 block discarded – undo
300 300
                     $organization = $this->_import_subscribers_organization($subscriber);
301 301
                     $this->_import_subscribers_organization_member($subscriber, $person, $organization);
302 302
                 }
303
-            } catch (midcom_error $e) {
303
+            }
304
+            catch (midcom_error $e) {
304 305
                 $e->log();
305 306
                 // Clean up possibly created data
306 307
                 $this->_clean_new_objects();
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
 
124
-            if (   !$person
124
+            if (!$person
125 125
                 && !empty($subscriber['person']['handphone'])) {
126 126
                 // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker
127 127
                 $qb = org_openpsa_contacts_person_dba::new_query_builder();
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             // User is or has been subscriber earlier, update status
168 168
             $member = $members[0];
169 169
 
170
-            if (   $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED
170
+            if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED
171 171
                 || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) {
172 172
                 $this->_import_status['already_subscribed']++;
173 173
                 return;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
             $qb = org_openpsa_contacts_group_dba::new_query_builder();
209 209
             $schema = $this->_schemadbs['organization']->get('default');
210
-            if (   $schema->has_field('company_id')
210
+            if ($schema->has_field('company_id')
211 211
                 && !empty($subscriber['organization']['company_id'])) {
212 212
                 // Imported data has a company id, we use that instead of name
213 213
                 $qb->add_constraint($schema->get_field('company_id')['storage']['location'], '=', $subscriber['organization']['company_id']);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 // Seek by official name
216 216
                 $qb->add_constraint('official', '=', $subscriber['organization']['official']);
217 217
 
218
-                if (   $schema->has_field('city')
218
+                if ($schema->has_field('city')
219 219
                     && !empty($subscriber['organization']['city'])) {
220 220
                     // Imported data has a city, we use also that for matching
221 221
                     $qb->add_constraint($schema->get_field('city')['storage']['location'], '=', $subscriber['organization']['city']);
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/exec/cleanup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     echo "            <th>{$type}</th>\n";
35 35
     echo "            <td style=\"text-align: right;\">" . number_format($count) . "</td>\n";
36 36
     if (isset($cleanups_kept[$type])) {
37
-        echo "            <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) ."</td>\n";
37
+        echo "            <td style=\"text-align: right;\">" . number_format($cleanups_kept[$type]) . "</td>\n";
38 38
     }
39 39
     echo "        </tr>\n";
40 40
 }
Please login to merge, or discard this patch.
src/midcom/events/watcher.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@
 block discarded – undo
48 48
 
49 49
         try {
50 50
             $interface = \midcom::get()->componentloader->get_interface_class($this->component);
51
-        } catch (\midcom_error $e) {
51
+        }
52
+        catch (\midcom_error $e) {
52 53
             debug_add("Failed to load the component {$this->component}: " . $e->getMessage(), MIDCOM_LOG_INFO);
53 54
             return;
54 55
         }
Please login to merge, or discard this patch.