Completed
Push — master ( ebb499...f17270 )
by Alexey
03:58
created
system/modules/Migrations/objects/Walker.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
         //walk know pathes
28 28
         foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
29 29
             if (isset($this->data[$path->item])) {
30
-                if ($path->type == 'container') { //create walker for container
30
+                if ($path->type == 'container') {
31
+//create walker for container
31 32
                     $walker = new Walker();
32 33
                     $walker->migration = $this->migration;
33 34
                     $walker->map = $this->map;
@@ -37,7 +38,8 @@  discard block
 block discarded – undo
37 38
                     $walker->mapPathParent = $this->mapPath;
38 39
                     $walker->migtarionLog = $this->migtarionLog;
39 40
                     $walker->walk();
40
-                } elseif ($path->type == 'object') { //start parse path data
41
+                } elseif ($path->type == 'object') {
42
+//start parse path data
41 43
                     $this->startObjectParse($path->object_id, $this->data[$path->item]);
42 44
                 }
43 45
             }
@@ -54,9 +56,11 @@  discard block
 block discarded – undo
54 56
                         ['code', $key],
55 57
                         ['migration_id', $this->migration->id]
56 58
             ]);
57
-            if ($object) { //parse as object
59
+            if ($object) {
60
+//parse as object
58 61
                 $this->startObjectParse($object, $data);
59
-            } else { //create new map path for configure unknown path
62
+            } else {
63
+//create new map path for configure unknown path
60 64
                 $this->mapPath = new Migration\Map\Path();
61 65
                 $this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
62 66
                 $this->mapPath->path = $this->curPath;
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/content/Cart/index.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
         <div class="cart-order_page">
4 4
             <h2>Быстрое оформление заказа</h2>
5 5
             <?php
6
-            if (!$cart || !$cart->cartItems)
7
-                echo "<h1>Ваша корзина пуста</h1>";
8
-            else {
6
+            if (!$cart || !$cart->cartItems) {
7
+                            echo "<h1>Ваша корзина пуста</h1>";
8
+            } else {
9 9
                 $form = new Ui\Form;
10 10
                 $form->action = "/ecommerce/cart";
11 11
                 $form->begin();
Please login to merge, or discard this patch.
system/modules/Ecommerce/appControllers/content/view.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,11 +18,13 @@
 block discarded – undo
18 18
                         <ul class="item-options">
19 19
                           <?php
20 20
                           foreach ($item->options as $param) {
21
-                              if (!$param->item_option_view || !$param->value)
22
-                                  continue;
21
+                              if (!$param->item_option_view || !$param->value) {
22
+                                                                continue;
23
+                              }
23 24
                               if ($param->item_option_type == 'select') {
24
-                                  if (empty($param->option->items[$param->value]))
25
-                                      continue;
25
+                                  if (empty($param->option->items[$param->value])) {
26
+                                                                        continue;
27
+                                  }
26 28
                                   $value = $param->option->items[$param->value]->value;
27 29
                               } else {
28 30
                                   $value = $param->value;
Please login to merge, or discard this patch.
system/modules/Money/snippets/rewardType/currency.php 1 patch
Braces   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
             'type' => 'decimal'
17 17
         ]
18 18
     ],
19
-    'viewer' => function($level) {
19
+    'viewer' => function($level) {
20 20
 $levelTypes = [
21 21
     'procent' => 'Процент',
22 22
     'amount' => 'Сумма',
23 23
 ];
24 24
 return $levelTypes[$level->params['type']->value] . ': ' . $level->params['amount']->value . ' ' . ($level->params['type']->value == 'procent' ? '%' : ($level->params['currency_id']->value ? \Money\Currency::get($level->params['currency_id']->value)->acronym() : ''));
25 25
 },
26
-    'rewarder' => function($reward, $sums, $user, $rootUser, $level, $rewardGet) {
26
+    'rewarder' => function($reward, $sums, $user, $rootUser, $level, $rewardGet) {
27 27
 $wallets = \App::$cur->money->getUserWallets($user->id);
28 28
 $amount = 0;
29
-if (!empty($wallets[$level->params['currency_id']->value])) {
30
-    switch ($level->params['type']->value) {
29
+if (!empty($wallets[$level->params['currency_id']->value])) {
30
+    switch ($level->params['type']->value) {
31 31
         case 'procent':
32 32
             $finalSum = 0;
33
-            foreach ($sums as $currency_id => $sum) {
34
-                if ($currency_id != $level->params['currency_id']->value) {
33
+            foreach ($sums as $currency_id => $sum) {
34
+                if ($currency_id != $level->params['currency_id']->value) {
35 35
                     $rate = \Money\Currency\ExchangeRate::get([
36 36
                                 ['currency_id', $currency_id],
37 37
                                 ['target_currency_id', $level->params['currency_id']->value],
38 38
                     ]);
39
-                    if ($rate) {
39
+                    if ($rate) {
40 40
                         $finalSum += $sum * $rate->rate;
41 41
                     }
42
-                } else {
42
+                } else {
43 43
                     $finalSum += $sum;
44 44
                 }
45 45
             }
46
-            switch ($reward->round_type) {
46
+            switch ($reward->round_type) {
47 47
                 case 'round':
48 48
                     $finalSum = round($finalSum, $reward->round_precision);
49 49
                     $amount = $finalSum / 100 * (float) $level->params['amount']->value;
@@ -59,33 +59,33 @@  discard block
 block discarded – undo
59 59
         case 'amount':
60 60
             $amount = (float) $level->params['amount']->value;
61 61
     }
62
-    if (!$amount) {
62
+    if (!$amount) {
63 63
         return 0;
64 64
     }
65 65
 
66 66
     $text = 'Вознаграждение по программе "' . $reward->name . '"';
67
-    if ($rootUser->id != $user->id) {
67
+    if ($rootUser->id != $user->id) {
68 68
         $text .= ' от ' . $rootUser->name();
69 69
     }
70 70
 
71
-    if (!$rewardGet && $reward->block) {
71
+    if (!$rewardGet && $reward->block) {
72 72
         $block = new \Money\Wallet\Block();
73 73
         $block->wallet_id = $wallets[$level->params['currency_id']->value]->id;
74 74
         $block->amount = $amount;
75 75
         $block->comment = $text;
76 76
         $block->data = 'reward:' . $reward->id;
77 77
         $dateGenerators = \App::$cur->money->getSnippets('expiredDateGenerator');
78
-        if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) {
78
+        if ($reward->block_date_expired && !empty($dateGenerators[$reward->block_date_expired])) {
79 79
             $date = $dateGenerators[$reward->block_date_expired]($reward, $user);
80
-            if (!empty($date['date'])) {
80
+            if (!empty($date['date'])) {
81 81
                 $block->date_expired = $date['date'];
82 82
             }
83
-            if (!empty($date['type'])) {
83
+            if (!empty($date['type'])) {
84 84
                 $block->expired_type = $date['type'];
85 85
             }
86 86
         }
87 87
         $block->save();
88
-    } else {
88
+    } else {
89 89
         $wallets[$level->params['currency_id']->value]->diff($amount, $text);
90 90
     }
91 91
     \App::$cur->users->AddUserActivity($user->id, 4, $text . '<br />' . $amount . ' ' . $wallets[$level->params['currency_id']->value]->currency->acronym());
Please login to merge, or discard this patch.
system/modules/Money/widgets/cabinet/walletBlocked.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@  discard block
 block discarded – undo
2 2
 <?php
3 3
 $currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0;
4 4
 $wallets = App::$cur->money->getUserWallets();
5
-if ($currency_id && empty($wallets[$currency_id])) {
5
+if ($currency_id && empty($wallets[$currency_id])) {
6 6
     Msg::add('У вас нет такого кошелька');
7 7
     Msg::show();
8 8
     return;
9 9
 }
10 10
 
11
-if ($currency_id) {
11
+if ($currency_id) {
12 12
     $ids = $wallets[$currency_id]->id;
13
-} else {
13
+} else {
14 14
     $ids = [];
15
-    foreach ($wallets as $wallet) {
15
+    foreach ($wallets as $wallet) {
16 16
         $ids[] = $wallet->id;
17 17
     }
18 18
     $ids = implode(',', $ids);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             'start' => $pages->params['start'],
34 34
             'limit' => $pages->params['limit'],
35 35
         ]);
36
-foreach ($histories as $history) {
36
+foreach ($histories as $history) {
37 37
     $amount = $history->amount;
38 38
     $table->addRow([
39 39
         $history->id,
Please login to merge, or discard this patch.
system/modules/Money/widgets/cabinet/walletHistory.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@  discard block
 block discarded – undo
2 2
 <?php
3 3
 $currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0;
4 4
 $wallets = App::$cur->money->getUserWallets();
5
-if ($currency_id && empty($wallets[$currency_id])) {
5
+if ($currency_id && empty($wallets[$currency_id])) {
6 6
     Msg::add('У вас нет такого кошелька');
7 7
     Msg::show();
8 8
     return;
9 9
 }
10 10
 
11
-if ($currency_id) {
11
+if ($currency_id) {
12 12
     $ids = $wallets[$currency_id]->id;
13
-} else {
13
+} else {
14 14
     $ids = [];
15
-    foreach ($wallets as $wallet) {
15
+    foreach ($wallets as $wallet) {
16 16
         $ids[] = $wallet->id;
17 17
     }
18 18
     $ids = implode(',', $ids);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             'start' => $pages->params['start'],
34 34
             'limit' => $pages->params['limit'],
35 35
         ]);
36
-foreach ($histories as $history) {
36
+foreach ($histories as $history) {
37 37
     $amount = $history->amount ? $history->amount : $history->new - $history->old;
38 38
     $table->addRow([
39 39
         $history->id,
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 1 patch
Braces   +53 added lines, -42 removed lines patch added patch discarded remove patch
@@ -125,12 +125,14 @@  discard block
 block discarded – undo
125 125
         if (!is_array($order)) {
126 126
             $this->order[] = "{$order} {$type}";
127 127
         } else {
128
-            foreach ($order as $item)
129
-                if (!is_array($item)) {
128
+            foreach ($order as $item) {
129
+                            if (!is_array($item)) {
130 130
                     call_user_func_array(array($this, 'order'), $order);
131
+            }
131 132
                     break;
132
-                } else
133
-                    $this->order($item);
133
+                } else {
134
+                                    $this->order($item);
135
+                }
134 136
         }
135 137
     }
136 138
 
@@ -138,8 +140,9 @@  discard block
 block discarded – undo
138 140
         $start = intval($start);
139 141
         $len = intval($len);
140 142
         $this->limit = "LIMIT {$start}";
141
-        if ($len !== 0)
142
-            $this->limit .= ",{$len}";
143
+        if ($len !== 0) {
144
+                    $this->limit .= ",{$len}";
145
+        }
143 146
     }
144 147
 
145 148
     public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') {
@@ -151,10 +154,12 @@  discard block
 block discarded – undo
151 154
             }
152 155
         } else {
153 156
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
154
-            if ($alias)
155
-                $join .= " AS `{$alias}`";
156
-            if ($where)
157
-                $join .= " ON {$where}";
157
+            if ($alias) {
158
+                            $join .= " AS `{$alias}`";
159
+            }
160
+            if ($where) {
161
+                            $join .= " ON {$where}";
162
+            }
158 163
         }
159 164
         return $join;
160 165
     }
@@ -173,13 +178,15 @@  discard block
 block discarded – undo
173 178
                 $operation = '=';
174 179
             }
175 180
 
176
-            if ($concatenation === false)
177
-                $concatenation = 'AND';
178
-            elseif ($concatenation === true)
179
-                $concatenation = '';
181
+            if ($concatenation === false) {
182
+                            $concatenation = 'AND';
183
+            } elseif ($concatenation === true) {
184
+                            $concatenation = '';
185
+            }
180 186
 
181
-            if ($this->whereString == NULL)
182
-                $this->whereString = ' WHERE ';
187
+            if ($this->whereString == NULL) {
188
+                            $this->whereString = ' WHERE ';
189
+            }
183 190
 
184 191
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
185 192
                 if (is_array($value)) {
@@ -205,12 +212,12 @@  discard block
 block discarded – undo
205 212
                 $value = "?";
206 213
             }
207 214
 
208
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
209
-                $this->whereString .= " {$where} {$operation} {$value} ";
210
-            else
211
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
212
-        }
213
-        else {
215
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
216
+                            $this->whereString .= " {$where} {$operation} {$value} ";
217
+            } else {
218
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
219
+            }
220
+        } else {
214 221
             $i = -1;
215 222
             while (isset($where[++$i])) {
216 223
                 $item = $where[$i];
@@ -225,10 +232,11 @@  discard block
 block discarded – undo
225 232
                         $this->whereString .= "{$concatenation} ";
226 233
                     }
227 234
 
228
-                    if ($this->whereString != NULL)
229
-                        $this->whereString .= '(';
230
-                    else
231
-                        $this->whereString = 'WHERE (';
235
+                    if ($this->whereString != NULL) {
236
+                                            $this->whereString .= '(';
237
+                    } else {
238
+                                            $this->whereString = 'WHERE (';
239
+                    }
232 240
                 }
233 241
 
234 242
                 if (!is_array($item)) {
@@ -257,13 +265,15 @@  discard block
 block discarded – undo
257 265
             if (empty($operation)) {
258 266
                 $operation = '=';
259 267
             }
260
-            if ($concatenation === false)
261
-                $concatenation = 'AND';
262
-            elseif ($concatenation === true)
263
-                $concatenation = '';
268
+            if ($concatenation === false) {
269
+                            $concatenation = 'AND';
270
+            } elseif ($concatenation === true) {
271
+                            $concatenation = '';
272
+            }
264 273
 
265
-            if ($this->havingString == NULL)
266
-                $this->havingString = ' HAVING ';
274
+            if ($this->havingString == NULL) {
275
+                            $this->havingString = ' HAVING ';
276
+            }
267 277
 
268 278
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
269 279
                 if (is_array($value)) {
@@ -289,12 +299,12 @@  discard block
 block discarded – undo
289 299
                 $value = "?";
290 300
             }
291 301
 
292
-            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ')
293
-                $this->havingString .= " {$where} {$operation} {$value} ";
294
-            else
295
-                $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
296
-        }
297
-        else {
302
+            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ') {
303
+                            $this->havingString .= " {$where} {$operation} {$value} ";
304
+            } else {
305
+                            $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
306
+            }
307
+        } else {
298 308
             $i = -1;
299 309
             while (isset($where[++$i])) {
300 310
                 $item = $where[$i];
@@ -309,10 +319,11 @@  discard block
 block discarded – undo
309 319
                         $this->havingString .= "{$concatenation} ";
310 320
                     }
311 321
 
312
-                    if ($this->havingString != NULL)
313
-                        $this->havingString .= '(';
314
-                    else
315
-                        $this->havingString = 'HAVING (';
322
+                    if ($this->havingString != NULL) {
323
+                                            $this->havingString .= '(';
324
+                    } else {
325
+                                            $this->havingString = 'HAVING (';
326
+                    }
316 327
                 }
317 328
 
318 329
                 if (!is_array($item)) {
Please login to merge, or discard this patch.