Test Failed
Push — master ( 766657...e3cf3e )
by Alexey
04:30
created
system/modules/Ecommerce/models/Cart.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -336,6 +336,9 @@
 block discarded – undo
336 336
         return false;
337 337
     }
338 338
 
339
+    /**
340
+     * @return \Money\Sums
341
+     */
339 342
     public function deliverySum() {
340 343
         $sum = new \Money\Sums([]);
341 344
         if ($this->delivery && $this->needDelivery()) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 
368 368
     public function hasDiscount() {
369
-        return (bool)$this->card || $this->discounts;
369
+        return (bool) $this->card || $this->discounts;
370 370
     }
371 371
 
372 372
     public function discountSum() {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     }
398 398
 
399 399
     public function addItem($offer_price_id, $count = 1, $final_price = 0) {
400
-        $price = Item\Offer\Price::get((int)$offer_price_id);
400
+        $price = Item\Offer\Price::get((int) $offer_price_id);
401 401
 
402 402
         if (!$price) {
403 403
             return false;
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Delivery.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
     public static $forms = [
84 84
         'manager' => [
85 85
             'map' => [
86
-                ['name','delivery_provider_id', 'disabled'],
86
+                ['name', 'delivery_provider_id', 'disabled'],
87 87
                 ['price', 'currency_id'],
88 88
                 ['max_cart_price', 'icon_file_id'],
89 89
                 ['price_text'],
Please login to merge, or discard this patch.
system/modules/Ecommerce/objects/Vendor/CalculatePriceDeliveryCdek.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param int $id города
84 84
      */
85 85
     public function setSenderCityId($id) {
86
-        $id = (int)$id;
86
+        $id = (int) $id;
87 87
         if ($id == 0) {
88 88
             throw new \Exception("Неправильно задан город-отправитель.");
89 89
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param int $id города
97 97
      */
98 98
     public function setReceiverCityId($id) {
99
-        $id = (int)$id;
99
+        $id = (int) $id;
100 100
         if ($id == 0) {
101 101
             throw new \Exception("Неправильно задан город-получатель.");
102 102
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param int $id тарифа
110 110
      */
111 111
     public function setTariffId($id) {
112
-        $id = (int)$id;
112
+        $id = (int) $id;
113 113
         if ($id == 0) {
114 114
             throw new \Exception("Неправильно задан тариф.");
115 115
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param int $id режим доставки
123 123
      */
124 124
     public function setModeDeliveryId($id) {
125
-        $id = (int)$id;
125
+        $id = (int) $id;
126 126
         if (!in_array($id, array(1, 2, 3, 4))) {
127 127
             throw new \Exception("Неправильно задан режим доставки.");
128 128
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function addGoodsItemBySize($weight, $length, $width, $height) {
141 141
         //проверка веса
142
-        $weight = (float)$weight;
142
+        $weight = (float) $weight;
143 143
         if ($weight == 0.00) {
144 144
             throw new \Exception("Неправильно задан вес места № " . (count($this->getGoodslist()) + 1) . ".");
145 145
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             "ширина" => $width,
149 149
             "высота" => $height);
150 150
         foreach ($paramsItem as $k => $param) {
151
-            $param = (int)$param;
151
+            $param = (int) $param;
152 152
             if ($param == 0) {
153 153
                 throw new \Exception("Неправильно задан параметр '" . $k . "' места № " . (count($this->getGoodslist()) + 1) . ".");
154 154
             }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         $paramsItem = array("вес" => $weight,
170 170
             "объёмный вес" => $volume);
171 171
         foreach ($paramsItem as $k => $param) {
172
-            $param = (float)$param;
172
+            $param = (float) $param;
173 173
             if ($param == 0.00) {
174 174
                 throw new \ption("Неправильно задан параметр '" . $k . "' места № " . (count($this->getGoodslist()) + 1) . ".");
175 175
             }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @param int $priority default false приоритет
198 198
      */
199 199
     public function addTariffPriority($id, $priority = 0) {
200
-        $id = (int)$id;
200
+        $id = (int) $id;
201 201
         if ($id == 0) {
202 202
             throw new \Exception("Неправильно задан id тарифа.");
203 203
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function getGoodslist() {
187 187
         if (!isset($this->goodsList)) {
188
-            return NULL;
188
+            return null;
189 189
         }
190 190
         return $this->goodsList;
191 191
     }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     private function _getTariffList() {
215 215
         if (!isset($this->tariffList)) {
216
-            return NULL;
216
+            return null;
217 217
         }
218 218
         return $this->tariffList;
219 219
     }
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/CartController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
                 $ids = [];
32 32
                 if (!empty($_POST['cartItems'])) {
33 33
                     foreach ($_POST['cartItems'] as $cartItemId => $cartItemCont) {
34
-                        $cartItem = \Ecommerce\Cart\Item::get((int)$cartItemId);
34
+                        $cartItem = \Ecommerce\Cart\Item::get((int) $cartItemId);
35 35
                         if (!$cartItem) {
36 36
                             continue;
37 37
                         }
38 38
                         if ($cartItem->cart_id != $cart->id) {
39 39
                             continue;
40 40
                         }
41
-                        $count = (float)$cartItemCont;
41
+                        $count = (float) $cartItemCont;
42 42
                         if ($count < 0.001) {
43 43
                             $count = 1;
44 44
                         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     }
94 94
                 }
95 95
                 if (!empty($_POST['discounts']['card_item_id'])) {
96
-                    $userCard = \Ecommerce\Card\Item::get((int)$_POST['discounts']['card_item_id']);
96
+                    $userCard = \Ecommerce\Card\Item::get((int) $_POST['discounts']['card_item_id']);
97 97
                     if (!$userCard) {
98 98
                         $error = true;
99 99
                         Msg::add('Такой карты не существует', 'danger');
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     }
165 165
 
166 166
     public function orderDetailAction($id = 0) {
167
-        $cart = Ecommerce\Cart::get((int)$id);
167
+        $cart = Ecommerce\Cart::get((int) $id);
168 168
         if ($cart->user_id != Users\User::$cur->id) {
169 169
             $this->url->redirect('/', 'Это не ваша корзина');
170 170
         }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     }
187 187
 
188 188
     public function continueAction($id = 0) {
189
-        $cart = \Ecommerce\Cart::get((int)$id);
189
+        $cart = \Ecommerce\Cart::get((int) $id);
190 190
         if ($cart->user_id != Users\User::$cur->id) {
191 191
             Tools::redirect('/', 'Это не ваша корзина');
192 192
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     }
199 199
 
200 200
     public function deleteAction($id = 0) {
201
-        $cart = \Ecommerce\Cart::get((int)$id);
201
+        $cart = \Ecommerce\Cart::get((int) $id);
202 202
         if ($cart->user_id != Users\User::$cur->id) {
203 203
             Tools::redirect('/', 'Это не ваша корзина');
204 204
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     }
214 214
 
215 215
     public function refillAction($id = 0) {
216
-        $cart = \Ecommerce\Cart::get((int)$id);
216
+        $cart = \Ecommerce\Cart::get((int) $id);
217 217
         if ($cart->user_id != Users\User::$cur->id) {
218 218
             Tools::redirect('/', 'Это не ваша корзина');
219 219
         }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $result->content = 'Произошла непредвиденная ошибка при добавлении товара';
256 256
             $result->send();
257 257
         }
258
-        $price = \Ecommerce\Item\Offer\Price::get((int)$_GET['itemOfferPriceId']);
258
+        $price = \Ecommerce\Item\Offer\Price::get((int) $_GET['itemOfferPriceId']);
259 259
         if (!$price) {
260 260
             $result->success = false;
261 261
             $result->content = 'Такой цены не найдено';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         if (empty($_GET['count'])) {
276 276
             $count = 1;
277 277
         } else {
278
-            $count = (float)$_GET['count'];
278
+            $count = (float) $_GET['count'];
279 279
         }
280 280
 
281 281
         $cart = $this->ecommerce->getCurCart();
Please login to merge, or discard this patch.
system/modules/Ecommerce/migrations/cdekCities.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         $handle = fopen(__DIR__ . '/../vendor/CdekCity_RUS_20170729.csv', 'r');
24 24
         $row = 1;
25 25
         $cols = [];
26
-        while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
26
+        while (($data = fgetcsv($handle, 10000, ";")) !== false) {
27 27
             if ($row === 1) {
28 28
                 $cols = $data;
29 29
             } else {
Please login to merge, or discard this patch.
Ecommerce/extensions/Ui/snippets/autocomplete/deliveryFieldItems.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     },
21 21
     'getValueText' => function ($value, $params) {
22 22
         $value = \Ecommerce\Delivery\Field\Item::get($value);
23
-        if($value){
23
+        if ($value) {
24 24
             return $value->value;
25 25
         }
26 26
         return '';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     },
21 21
     'getValueText' => function ($value, $params) {
22 22
         $value = \Ecommerce\Delivery\Field\Item::get($value);
23
-        if($value){
23
+        if($value) {
24 24
             return $value->value;
25 25
         }
26 26
         return '';
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/EcommerceController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     public function submitReviewAction() {
14 14
         $result = new \Server\Result();
15 15
         if (!empty($_POST['review']['item_id']) && !empty($_POST['review']['name']) && !empty($_POST['review']['text'])) {
16
-            $item = Ecommerce\Item::get((int)$_POST['review']['item_id']);
16
+            $item = Ecommerce\Item::get((int) $_POST['review']['item_id']);
17 17
             if (!$item) {
18 18
                 $result->success = false;
19 19
                 $result->content = ['errorText' => 'Товар не найден'];
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                 'item_id' => $item->id,
24 24
                 'user_id' => \Users\User::$cur->id,
25 25
                 'name' => htmlspecialchars($_POST['review']['name']),
26
-                'rating' => (int)$_POST['review']['rating'],
26
+                'rating' => (int) $_POST['review']['rating'],
27 27
                 'text' => htmlspecialchars($_POST['review']['text']),
28 28
                 'mail' => !empty($_POST['review']['email']) ? htmlspecialchars($_POST['review']['email']) : '',
29 29
                 'file_id' => !empty($_FILES['review']['tmp_name']['file']) ? App::$cur->files->upload([
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $user = Users\User::$cur;
48 48
         if (!empty($_POST) && !empty($_POST['card_id'])) {
49 49
             $error = false;
50
-            $card = \Ecommerce\Card::get((int)$_POST['card_id']);
50
+            $card = \Ecommerce\Card::get((int) $_POST['card_id']);
51 51
             if (!$card) {
52 52
                 $error = true;
53 53
                 Msg::add('Такой карты не существует', 'danger');
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         //search
134 134
         if (!empty($_GET['search'])) {
135 135
             if (!empty($_GET['inCatalog'])) {
136
-                $category_id = (int)$_GET['inCatalog'];
136
+                $category_id = (int) $_GET['inCatalog'];
137 137
             }
138 138
             $search = $_GET['search'];
139 139
         } else {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         } else {
167 167
             $category_id = 0;
168 168
         }
169
-        if($category){
169
+        if ($category) {
170 170
             $category->views++;
171 171
             $category->save();
172 172
         }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     }
280 280
 
281 281
     public function viewAction($id = '', $quick = 0) {
282
-        $item = \Ecommerce\Item::get((int)$id);
282
+        $item = \Ecommerce\Item::get((int) $id);
283 283
         if (!$item) {
284 284
             Tools::redirect('/ecommerce/', 'Такой товар не найден');
285 285
         }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
     public function toggleFavAction($itemId) {
329 329
         $result = new Server\Result();
330
-        $item = \Ecommerce\Item::get((int)$itemId);
330
+        $item = \Ecommerce\Item::get((int) $itemId);
331 331
         if (!$item) {
332 332
             $result->success = false;
333 333
             $result->content = 'Товар не найден';
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
         } else {
167 167
             $category_id = 0;
168 168
         }
169
-        if($category){
169
+        if($category) {
170 170
             $category->views++;
171 171
             $category->save();
172 172
         }
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Offer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
     public function changeWarehouse($count) {
103 103
         $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]);
104 104
         if ($warehouse) {
105
-            $warehouse->count += (float)$count;
105
+            $warehouse->count += (float) $count;
106 106
             $warehouse->save();
107 107
         } else {
108 108
             $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]);
109 109
             if ($warehouse) {
110
-                $warehouse->count += (float)$count;
110
+                $warehouse->count += (float) $count;
111 111
                 $warehouse->save();
112 112
             }
113 113
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) as `sum` ';
134 134
         \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id);
135 135
         if ($cart_id) {
136
-            \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index(), (int)$cart_id, '!=');
136
+            \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index(), (int) $cart_id, '!=');
137 137
         }
138 138
         $on = '
139 139
             ' . \Ecommerce\Cart::index() . ' = ' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND (
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         \App::$cur->db->join(\Ecommerce\Cart::table(), $on, 'inner');
145 145
 
146 146
         $blocked = \App::$cur->db->select(\Ecommerce\Warehouse\Block::table())->fetch();
147
-        return (float)$warehouse['sum'] - (float)$blocked['sum'];
147
+        return (float) $warehouse['sum'] - (float) $blocked['sum'];
148 148
     }
149 149
 
150 150
     public function beforeDelete() {
Please login to merge, or discard this patch.
system/modules/Sliders/widgets/slider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!empty($alias)) {
9 9
     $slider = Sliders\Slider::get($alias, 'alias');
10 10
 }
11
-if(empty($slider)){
11
+if (empty($slider)) {
12 12
     echo 'Slider not found';
13 13
     return;
14 14
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 if (!empty($alias)) {
9 9
     $slider = Sliders\Slider::get($alias, 'alias');
10 10
 }
11
-if(empty($slider)){
11
+if(empty($slider)) {
12 12
     echo 'Slider not found';
13 13
     return;
14 14
 }
Please login to merge, or discard this patch.