Passed
Push — develop ( a88cb3...66d0e3 )
by Mykola
05:02
created
engine/core/Loader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function model($route)
34 34
     {
35 35
         // Sanitize the call
36
-        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string) $route);
36
+        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
37 37
 
38 38
         if (!$this->registry->has('model_' . str_replace(array('/', '-', '.'), array('_', '', ''), $route))) {
39 39
             $file  = SR_APPLICATION . 'model/' . $route . '.php';
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 }
50 50
 
51 51
                 $this->registry->set(
52
-                    'model_' . str_replace(array('/', '-', '.'), array('_', '', ''), (string) $route),
52
+                    'model_' . str_replace(array('/', '-', '.'), array('_', '', ''), (string)$route),
53 53
                     $proxy
54 54
                 );
55 55
             } else {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function controller($route, $data = array())
62 62
     {
63 63
         // Sanitize the call
64
-        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string) $route);
64
+        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
65 65
 
66 66
         $output = null;
67 67
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $output = null;
79 79
 
80 80
         // Sanitize the call
81
-        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string) $route);
81
+        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
82 82
 
83 83
         if (!$output) {
84 84
             $template = new \Sunrise\Engine\Library\Template();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function library($route)
112 112
     {
113 113
         // Sanitize the call
114
-        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string) $route);
114
+        $route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);
115 115
 
116 116
         $file = $_SERVER['DOCUMENT_ROOT'] . '/engine/library/' . $route . '.php';
117 117
         $class = str_replace('/', '\\', $route);
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 
145 145
     protected function callback($registry, $route)
146 146
     {
147
-        return function ($args) use ($registry, &$route) {
147
+        return function($args) use ($registry, &$route) {
148 148
             static $model = array();
149 149
 
150 150
             $output = null;
151 151
 
152 152
             // Store the model object
153 153
             if (!isset($model[$route])) {
154
-                $file = SR_APPLICATION . 'model/' .  substr($route, 0, strrpos($route, '/')) . '.php';
154
+                $file = SR_APPLICATION . 'model/' . substr($route, 0, strrpos($route, '/')) . '.php';
155 155
                 $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', substr($route, 0, strrpos($route, '/')));
156 156
 
157 157
                 if (is_file($file)) {
Please login to merge, or discard this patch.
engine/library/Pagination.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             $page = $this->page;
42 42
         }
43 43
 
44
-        if (!(int) $this->limit) {
44
+        if (!(int)$this->limit) {
45 45
             $limit = 10;
46 46
         } else {
47 47
             $limit = $this->limit;
Please login to merge, or discard this patch.
engine/library/Cart.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $this->db->query("
45 45
                 UPDATE cart 
46 46
                 SET session_id = '" . $this->db->escape($this->session->getSessionId()) . "' 
47
-                WHERE customer_id = '" . (int) $this->customer->getId() . "'
47
+                WHERE customer_id = '" . (int)$this->customer->getId() . "'
48 48
             ");
49 49
 
50 50
             // Once the customer is logged in we want to update the customers cart
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             foreach ($cart_query->rows as $cart) {
59 59
                 $this->db->query("
60 60
                     DELETE FROM cart 
61
-                    WHERE cart_id = '" . (int) $cart['cart_id'] . "'
61
+                    WHERE cart_id = '" . (int)$cart['cart_id'] . "'
62 62
                 ");
63 63
 
64 64
                 // The advantage of using $this->add is that it will check if the products already exist and increaser the quantity if necessary.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $cart_query = $this->db->query("
75 75
             SELECT * 
76 76
             FROM cart 
77
-            WHERE customer_id = '" . (int) $this->customer->getId() . "' 
77
+            WHERE customer_id = '" . (int)$this->customer->getId() . "' 
78 78
                 AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "'
79 79
         ");
80 80
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
                 SELECT * 
86 86
                 FROM product p 
87 87
                 LEFT JOIN product_description pd ON (p.product_id = pd.product_id) 
88
-                WHERE p.product_id = '" . (int) $cart['product_id'] . "' 
89
-                    AND pd.language_id = '" . (int) $this->config->get('config_language_id') . "' 
88
+                WHERE p.product_id = '" . (int)$cart['product_id'] . "' 
89
+                    AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' 
90 90
                     AND p.status = '1'
91 91
             ");
92 92
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
                         FROM product_option po 
103 103
                         LEFT JOIN `option` o ON (po.option_id = o.option_id) 
104 104
                         LEFT JOIN option_description od ON (o.option_id = od.option_id) 
105
-                        WHERE po.product_option_id = '" . (int) $product_option_id . "' 
106
-                            AND po.product_id = '" . (int) $cart['product_id'] . "' 
107
-                            AND od.language_id = '" . (int) $this->config->get('config_language_id') . "'
105
+                        WHERE po.product_option_id = '" . (int)$product_option_id . "' 
106
+                            AND po.product_id = '" . (int)$cart['product_id'] . "' 
107
+                            AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'
108 108
                     ");
109 109
 
110 110
                     if ($option_query->num_rows) {
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
                                 FROM product_option_value pov 
115 115
                                 LEFT JOIN option_value ov ON (pov.option_value_id = ov.option_value_id) 
116 116
                                 LEFT JOIN option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) 
117
-                                WHERE pov.product_option_value_id = '" . (int) $value . "' 
118
-                                    AND pov.product_option_id = '" . (int) $product_option_id . "' 
119
-                                    AND ovd.language_id = '" . (int) $this->config->get('config_language_id') . "'
117
+                                WHERE pov.product_option_value_id = '" . (int)$value . "' 
118
+                                    AND pov.product_option_id = '" . (int)$product_option_id . "' 
119
+                                    AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'
120 120
                             ");
121 121
 
122 122
                             if ($option_value_query->num_rows) {
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
                                     SELECT pov.option_value_id, pov.quantity, pov.subtract, pov.price, pov.price_prefix, pov.points, pov.points_prefix, ovd.name 
159 159
                                     FROM product_option_value pov 
160 160
                                     LEFT JOIN option_value_description ovd ON (pov.option_value_id = ovd.option_value_id) 
161
-                                    WHERE pov.product_option_value_id = '" . (int) $product_option_value_id . "' 
162
-                                        AND pov.product_option_id = '" . (int) $product_option_id . "' 
163
-                                        AND ovd.language_id = '" . (int) $this->config->get('config_language_id') . "'
161
+                                    WHERE pov.product_option_value_id = '" . (int)$product_option_value_id . "' 
162
+                                        AND pov.product_option_id = '" . (int)$product_option_id . "' 
163
+                                        AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "'
164 164
                                 ");
165 165
 
166 166
                                 if ($option_value_query->num_rows) {
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
                 $product_discount_query = $this->db->query("
232 232
                     SELECT price 
233 233
                     FROM product_discount 
234
-                    WHERE product_id = '" . (int) $cart['product_id'] . "' 
235
-                        AND customer_group_id = '" . (int) $this->config->get('config_customer_group_id') . "' 
236
-                        AND quantity <= '" . (int) $discount_quantity . "' 
234
+                    WHERE product_id = '" . (int)$cart['product_id'] . "' 
235
+                        AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' 
236
+                        AND quantity <= '" . (int)$discount_quantity . "' 
237 237
                         AND ((date_start = '2000-01-01' OR date_start < NOW()) 
238 238
                         AND (date_end = '2000-01-01' OR date_end > NOW())) 
239 239
                     ORDER BY quantity DESC, priority ASC, price ASC 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
                 $product_special_query = $this->db->query("
249 249
                     SELECT price 
250 250
                     FROM product_special 
251
-                    WHERE product_id = '" . (int) $cart['product_id'] . "' 
252
-                        AND customer_group_id = '" . (int) $this->config->get('config_customer_group_id') . "' 
251
+                    WHERE product_id = '" . (int)$cart['product_id'] . "' 
252
+                        AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' 
253 253
                         AND ((date_start = '2000-01-01' OR date_start < NOW()) 
254 254
                         AND (date_end = '2000-01-01' OR date_end > NOW())) 
255 255
                     ORDER BY priority ASC, price ASC 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                 $product_reward_query = $this->db->query("
265 265
                     SELECT points 
266 266
                     FROM product_reward 
267
-                    WHERE product_id = '" . (int) $cart['product_id'] . "' 
268
-                        AND customer_group_id = '" . (int) $this->config->get('config_customer_group_id') . "'
267
+                    WHERE product_id = '" . (int)$cart['product_id'] . "' 
268
+                        AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "'
269 269
                 ");
270 270
 
271 271
                 if ($product_reward_query->num_rows) {
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
                     FROM product_to_download p2d 
283 283
                     LEFT JOIN download d ON (p2d.download_id = d.download_id) 
284 284
                     LEFT JOIN download_description dd ON (d.download_id = dd.download_id) 
285
-                    WHERE p2d.product_id = '" . (int) $cart['product_id'] . "' 
286
-                        AND dd.language_id = '" . (int) $this->config->get('config_language_id') . "'
285
+                    WHERE p2d.product_id = '" . (int)$cart['product_id'] . "' 
286
+                        AND dd.language_id = '" . (int)$this->config->get('config_language_id') . "'
287 287
                 ");
288 288
 
289 289
                 foreach ($download_query->rows as $download) {
@@ -333,29 +333,29 @@  discard block
 block discarded – undo
333 333
         $query = $this->db->query("
334 334
             SELECT COUNT(*) AS total 
335 335
             FROM cart 
336
-            WHERE customer_id = '" . (int) $this->customer->getId() . "' 
336
+            WHERE customer_id = '" . (int)$this->customer->getId() . "' 
337 337
                 AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "' 
338
-                AND product_id = '" . (int) $product_id . "' 
338
+                AND product_id = '" . (int)$product_id . "' 
339 339
                 AND `option` = '" . $this->db->escape(json_encode($option)) . "'
340 340
         ");
341 341
 
342 342
         if (!$query->row['total']) {
343 343
             $this->db->query("
344 344
                 INSERT cart 
345
-                SET customer_id = '" . (int) $this->customer->getId() . "', 
345
+                SET customer_id = '" . (int)$this->customer->getId() . "', 
346 346
                     session_id = '" . $this->db->escape($this->session->getSessionId()) . "', 
347
-                    product_id = '" . (int) $product_id . "', 
347
+                    product_id = '" . (int)$product_id . "', 
348 348
                     `option` = '" . $this->db->escape(json_encode($option)) . "', 
349
-                    quantity = '" . (int) $quantity . "', 
349
+                    quantity = '" . (int)$quantity . "', 
350 350
                     date_added = NOW()
351 351
             ");
352 352
         } else {
353 353
             $this->db->query("
354 354
                 UPDATE cart 
355
-                SET quantity = (quantity + " . (int) $quantity . ") 
356
-                WHERE customer_id = '" . (int) $this->customer->getId() . "' 
355
+                SET quantity = (quantity + " . (int)$quantity . ") 
356
+                WHERE customer_id = '" . (int)$this->customer->getId() . "' 
357 357
                     AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "' 
358
-                    AND product_id = '" . (int) $product_id . "' 
358
+                    AND product_id = '" . (int)$product_id . "' 
359 359
                     AND `option` = '" . $this->db->escape(json_encode($option)) . "'
360 360
             ");
361 361
         }
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $this->db->query("
367 367
             UPDATE cart 
368
-            SET quantity = '" . (int) $quantity . "' 
369
-            WHERE cart_id = '" . (int) $cart_id . "' 
370
-                AND customer_id = '" . (int) $this->customer->getId() . "' 
368
+            SET quantity = '" . (int)$quantity . "' 
369
+            WHERE cart_id = '" . (int)$cart_id . "' 
370
+                AND customer_id = '" . (int)$this->customer->getId() . "' 
371 371
                 AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "'
372 372
         ");
373 373
     }
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
     {
377 377
         $this->db->query("
378 378
             DELETE FROM cart 
379
-            WHERE cart_id = '" . (int) $cart_id . "' 
380
-                AND customer_id = '" . (int) $this->customer->getId() . "' 
379
+            WHERE cart_id = '" . (int)$cart_id . "' 
380
+                AND customer_id = '" . (int)$this->customer->getId() . "' 
381 381
                 AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "'
382 382
         ");
383 383
     }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $this->db->query("
388 388
             DELETE FROM cart 
389
-            WHERE customer_id = '" . (int) $this->customer->getId() . "' 
389
+            WHERE customer_id = '" . (int)$this->customer->getId() . "' 
390 390
                 AND session_id = '" . $this->db->escape($this->session->getSessionId()) . "'
391 391
         ");
392 392
     }
Please login to merge, or discard this patch.
engine/library/User.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $user_query = $this->db->query("
38 38
                 SELECT * 
39 39
                 FROM user 
40
-                WHERE user_id = '" . (int) $this->session->data['user_id'] . "' 
40
+                WHERE user_id = '" . (int)$this->session->data['user_id'] . "' 
41 41
                     AND status = '1'
42 42
             ");
43 43
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
                 $this->db->query("
50 50
                     UPDATE user 
51 51
                     SET ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "' 
52
-                    WHERE user_id = '" . (int) $this->session->data['user_id'] . "'
52
+                    WHERE user_id = '" . (int)$this->session->data['user_id'] . "'
53 53
                 ");
54 54
 
55 55
                 $user_group_query = $this->db->query("
56 56
                     SELECT permission 
57 57
                     FROM user_group 
58
-                    WHERE user_group_id = '" . (int) $user_query->row['user_group_id'] . "'
58
+                    WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'
59 59
                 ");
60 60
 
61 61
                 $permissions = json_decode($user_group_query->row['permission'], true);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $user_group_query = $this->db->query("
92 92
                 SELECT permission 
93 93
                 FROM user_group 
94
-                WHERE user_group_id = '" . (int) $user_query->row['user_group_id'] . "'
94
+                WHERE user_group_id = '" . (int)$user_query->row['user_group_id'] . "'
95 95
             ");
96 96
 
97 97
             $permissions = json_decode($user_group_query->row['permission'], true);
Please login to merge, or discard this patch.