Passed
Branch master (73261e)
by Andreas
14:55
created
lib/compat/environment.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 {
48 48
     public function __construct()
49 49
     {
50
-        if (   php_sapi_name() != 'cli'
50
+        if (php_sapi_name() != 'cli'
51 51
             || !empty($_SERVER['REMOTE_ADDR'])) {
52 52
             $this->_httpd_setup();
53 53
         }
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
          *
64 64
          * 2008-09-26: Now also rewrites urls ending in .html to end with trailing slash.
65 65
          */
66
-        $redirect_test_uri = (string)$_SERVER['REQUEST_URI'];
67
-        if (   !isset($_SERVER['MIDCOM_COMPAT_REDIR'])
68
-            || (bool)$_SERVER['MIDCOM_COMPAT_REDIR'] !== false) {
66
+        $redirect_test_uri = (string) $_SERVER['REQUEST_URI'];
67
+        if (!isset($_SERVER['MIDCOM_COMPAT_REDIR'])
68
+            || (bool) $_SERVER['MIDCOM_COMPAT_REDIR'] !== false) {
69 69
             $redirect_test_uri = preg_replace('/\.html$/', '', $redirect_test_uri);
70 70
         }
71
-        if (   !preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri)
71
+        if (!preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri)
72 72
             && (empty($_POST))) {
73 73
             $this->header('HTTP/1.0 301 Moved Permanently');
74 74
             $this->header("Location: {$redirect_test_uri}/");
Please login to merge, or discard this patch.
lib/errors.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     private function send($httpcode, $message)
250 250
     {
251 251
         $error_actions = midcom::get()->config->get('error_actions');
252
-        if (   !isset($error_actions[$httpcode])
252
+        if (!isset($error_actions[$httpcode])
253 253
             || !isset($error_actions[$httpcode]['action'])) {
254 254
             // No action specified for this error code, skip
255 255
             return;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             return;
280 280
         }
281 281
 
282
-        if (   !is_writable($config['filename'])
282
+        if (!is_writable($config['filename'])
283 283
             && !is_writable(dirname($config['filename']))) {
284 284
             debug_add("Error logging file {$config['filename']} is not writable", MIDCOM_LOG_WARN);
285 285
             return;
Please login to merge, or discard this patch.
lib/org/openpsa/relatedto/plugin.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public static function create($from_obj, $from_component, $to_obj, $to_component, $status = false, $extra = false)
33 33
     {
34
-        if (   !is_object($from_obj)
34
+        if (!is_object($from_obj)
35 35
             || !is_object($to_obj)) {
36 36
             return false;
37 37
         }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             debug_print_r("processing button '{$mode}' with data:", $data);
259 259
             if ($data === false) {
260 260
                 //In case somebody didn't unset() a button from the defaults, just marked it as false
261
-                debug_add('data marked as false, skipping (the correct way is to unset() the key)',  MIDCOM_LOG_WARN);
261
+                debug_add('data marked as false, skipping (the correct way is to unset() the key)', MIDCOM_LOG_WARN);
262 262
                 continue;
263 263
             }
264 264
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,8 @@
 block discarded – undo
106 106
     {
107 107
         $ret = ['org_openpsa_relatedto' => []];
108 108
         foreach ($array as $rel) {
109
-            if (!midcom::get()->dbfactory->is_a($rel, 'org_openpsa_relatedto_dba')) { //Matches also 'org_openpsa_relatedto'
109
+            if (!midcom::get()->dbfactory->is_a($rel, 'org_openpsa_relatedto_dba')) {
110
+//Matches also 'org_openpsa_relatedto'
110 111
                 //Wrong type of object found in array, cruelly abort the whole procedure
111 112
                 return false;
112 113
             }
Please login to merge, or discard this patch.
lib/org/openpsa/relatedto/exec/delete_dangling_links.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
30 30
     try {
31 31
         midcom::get()->dbfactory->get_object_by_guid($result->fromGuid);
32 32
         midcom::get()->dbfactory->get_object_by_guid($result->toGuid);
33
-    } catch (midcom_error $e) {
33
+    }
34
+    catch (midcom_error $e) {
34 35
         echo $i . "/" . $total . ": Deleting relatedto #" . $result->id . "\n";
35 36
         flush();
36 37
         $result->delete();
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/event/resource.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
         }
43 43
         try {
44 44
             $resource = org_openpsa_calendar_resource_dba::get_cached($this->resource);
45
-        } catch (midcom_error $e) {
45
+        }
46
+        catch (midcom_error $e) {
46 47
             debug_add("Cannot fetch resource #{$this->resource} returning false", MIDCOM_LOG_INFO);
47 48
             return false;
48 49
         }
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/scheduler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         }
84 84
 
85 85
         // TODO: Warehouse management: create new order
86
-        if (   $this->_deliverable->end < $next_cycle_start
86
+        if ($this->_deliverable->end < $next_cycle_start
87 87
             && $this->_deliverable->end != 0) {
88 88
             debug_add('Do not register next cycle, the contract ends before');
89 89
             return $this->_deliverable->end_subscription();
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         if ($this->_deliverable->unit != 'd') {
307 307
             //If previous cycle was run at the end of the month, the new one should be at the end of the month as well
308 308
             $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT'));
309
-            if (   $date->format('t') == $date->format('j')
309
+            if ($date->format('t') == $date->format('j')
310 310
                 && $new_date->format('t') != $new_date->format('j')) {
311 311
                 $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t'));
312 312
             }
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
                 break;
373 373
             case 'q':
374 374
                 // Quarterly recurring subscription
375
-                $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y');
375
+                $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y');
376 376
                 break;
377 377
             case 'hy':
378 378
                 // Half-yearly recurring subscription
379
-                $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y');
379
+                $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y');
380 380
                 break;
381 381
             case 'y':
382 382
                 // Yearly recurring subscription
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,8 @@
 block discarded – undo
126 126
         $salesproject = org_openpsa_sales_salesproject_dba::get_cached($this->_deliverable->salesproject);
127 127
         try {
128 128
             $owner = midcom_db_person::get_cached($salesproject->owner);
129
-        } catch (midcom_error $e) {
129
+        }
130
+        catch (midcom_error $e) {
130 131
             $e->log();
131 132
             return;
132 133
         }
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/invoice/item.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function _on_creating()
20 20
     {
21
-        if (   $this->invoice
21
+        if ($this->invoice
22 22
             && $this->position == 0) {
23 23
             $invoice = org_openpsa_invoices_invoice_dba::get_cached($this->invoice);
24 24
             $this->position = count($invoice->get_invoice_items()) + 1;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             } catch (midcom_error $e) {
70 70
             }
71 71
         }
72
-        if (   $url == ''
72
+        if ($url == ''
73 73
             && $sales_url) {
74 74
             try {
75 75
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 $invoice = new org_openpsa_invoices_invoice_dba($this->invoice);
92 92
                 $old_sum = $invoice->sum;
93 93
                 self::update_invoice($invoice);
94
-                if (   $old_sum != $invoice->sum
94
+                if ($old_sum != $invoice->sum
95 95
                     && !empty($this->deliverable)) {
96 96
                     $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable);
97 97
                     self::update_deliverable($deliverable);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         if ($invoiced != $deliverable->invoiced) {
133 133
             $deliverable->invoiced = $invoiced;
134
-            if (   $deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION
134
+            if ($deliverable->orgOpenpsaObtype !== org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION
135 135
                 && $deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED) {
136 136
                 $deliverable->state = org_openpsa_sales_salesproject_deliverable_dba::STATE_INVOICED;
137 137
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@  discard block
 block discarded – undo
66 66
             try {
67 67
                 $task = org_openpsa_projects_task_dba::get_cached($this->task);
68 68
                 $url = $projects_url . 'task/' . $task->guid . '/';
69
-            } catch (midcom_error $e) {
69
+            }
70
+            catch (midcom_error $e) {
70 71
             }
71 72
         }
72 73
         if (   $url == ''
@@ -74,7 +75,8 @@  discard block
 block discarded – undo
74 75
             try {
75 76
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($this->deliverable);
76 77
                 $url = $sales_url . 'deliverable/' . $deliverable->guid . '/';
77
-            } catch (midcom_error $e) {
78
+            }
79
+            catch (midcom_error $e) {
78 80
             }
79 81
         }
80 82
         if ($url != '') {
@@ -96,7 +98,8 @@  discard block
 block discarded – undo
96 98
                     $deliverable = new org_openpsa_sales_salesproject_deliverable_dba($this->deliverable);
97 99
                     self::update_deliverable($deliverable);
98 100
                 }
99
-            } catch (midcom_error $e) {
101
+            }
102
+            catch (midcom_error $e) {
100 103
                 $e->log();
101 104
             }
102 105
         }
Please login to merge, or discard this patch.
lib/org/openpsa/reports/viewer.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,8 @@
 block discarded – undo
174 174
             try {
175 175
                 midcom_db_topic::get_cached($node_guid);
176 176
                 $this->_available_generators[$component] = $loc;
177
-            } catch (midcom_error $e) {
177
+            }
178
+            catch (midcom_error $e) {
178 179
                 debug_add("topic for component '{$component}' not found or accessible");
179 180
             }
180 181
         }
Please login to merge, or discard this patch.
lib/org/openpsa/reports/handler/invoices/report.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     private function _get_invoices_for_subscription($deliverable, $at_entry)
51 51
     {
52
-        if (   $deliverable->invoiceByActualUnits
52
+        if ($deliverable->invoiceByActualUnits
53 53
             && $at_entry->arguments['cycle'] > 1) {
54 54
             $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1);
55 55
             if ($invoice_sum == 0) {
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
         $time = $at_entry->start;
66 66
         $scheduler = new org_openpsa_invoices_scheduler($deliverable);
67 67
 
68
-        while (   $time < $this->_request_data['end']
69
-               && (   $time < $deliverable->end
68
+        while ($time < $this->_request_data['end']
69
+               && ($time < $deliverable->end
70 70
                    || $deliverable->continuous)) {
71 71
             $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base);
72 72
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         foreach ($at_entries as $at_entry) {
110 110
             try {
111 111
                 $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']);
112
-                if (   $deliverable->continuous
113
-                    || (   $deliverable->start < $this->_request_data['end']
112
+                if ($deliverable->continuous
113
+                    || ($deliverable->start < $this->_request_data['end']
114 114
                         && $deliverable->end > $this->_request_data['start'])) {
115 115
                     $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry));
116 116
                 }
Please login to merge, or discard this patch.
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.