Completed
Push — master ( 5d88b0...c6fa36 )
by Scott
02:16
created
repositories/CategoryRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function get(array $params = [])
15 15
     {
16
-        if (! array_key_exists('select', $params) || ! is_array($params['select']) || empty($params['select'])) {
16
+        if (!array_key_exists('select', $params) || !is_array($params['select']) || empty($params['select'])) {
17 17
             throw new Exception('Categories get() must select at least one column.');
18 18
         }
19 19
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function show($slug, array $params = [])
44 44
     {
45
-        if (! array_key_exists('select', $params) || ! is_array($params['select']) || empty($params['select'])) {
45
+        if (!array_key_exists('select', $params) || !is_array($params['select']) || empty($params['select'])) {
46 46
             throw new Exception('Category show() must select at least one column.');
47 47
         }
48 48
 
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
             ->firstOrFail();
53 53
 
54 54
         if ($params['load_products']) {
55
-            $category->load(['products' => function ($products) use ($category, $params) {
56
-                if (! array_key_exists('products_select', $params) ||
57
-                    ! is_array($params['products_select']) ||
55
+            $category->load(['products' => function($products) use ($category, $params) {
56
+                if (!array_key_exists('products_select', $params) ||
57
+                    !is_array($params['products_select']) ||
58 58
                     empty($params['products_select'])) {
59 59
                     throw new Exception('Category show() products must select at least one column.');
60 60
                 }
61 61
 
62 62
                 $products->select($params['products_select']);
63 63
 
64
-                if (! is_null($category->product_sort_column) &&
65
-                    ! is_null($category->product_sort_direction)) {
64
+                if (!is_null($category->product_sort_column) &&
65
+                    !is_null($category->product_sort_direction)) {
66 66
                     $products->orderBy($category->product_sort_column, $category->product_sort_direction);
67 67
                 }
68 68
             }]);
Please login to merge, or discard this patch.
controllers/Options.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function create()
21 21
     {
22 22
         $data = input('option');
23
-        if (! $data || ! is_array($data)) {
23
+        if (!$data || !is_array($data)) {
24 24
             return Response::make('Error', 422);
25 25
         }
26 26
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     public function createValue()
45 45
     {
46 46
         $data = input('value');
47
-        if (! $data || ! is_array($data)) {
47
+        if (!$data || !is_array($data)) {
48 48
             return Response::make('Error', 422);
49 49
         }
50 50
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function validate()
69 69
     {
70 70
         $data = input('option');
71
-        if (! $data || ! is_array($data)) {
71
+        if (!$data || !is_array($data)) {
72 72
             return Response::make('Error', 422);
73 73
         }
74 74
 
Please login to merge, or discard this patch.
models/Inventory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,11 +91,11 @@
 block discarded – undo
91 91
      */
92 92
     public function scopeHasOptionValueIds($query, $ids)
93 93
     {
94
-        if (! is_array($ids)) {
94
+        if (!is_array($ids)) {
95 95
             $ids = [$ids];
96 96
         }
97 97
 
98
-        return $query->whereHas('optionValues', function ($optionValue) use ($ids) {
98
+        return $query->whereHas('optionValues', function($optionValue) use ($ids) {
99 99
             return $optionValue->whereIn('id', $ids);
100 100
         });
101 101
     }
Please login to merge, or discard this patch.
models/Product.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function deleteRelatedInventories($inventories)
164 164
     {
165
-        return array_filter($inventories, function ($inventory) {
165
+        return array_filter($inventories, function($inventory) {
166 166
             if ($inventory['id'] !== null && $inventory['is_deleted']) {
167 167
                 Inventory::find($inventory['id'])->delete();
168 168
             }
169 169
 
170
-            return ! $inventory['is_deleted'];
170
+            return !$inventory['is_deleted'];
171 171
         });
172 172
     }
173 173
 
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
      */
180 180
     protected function deleteRelatedOptions(array $options)
181 181
     {
182
-        return array_filter($options, function ($option) {
182
+        return array_filter($options, function($option) {
183 183
             if ($option['id'] !== null && $option['is_deleted']) {
184 184
                 Option::find($option['id'])->delete();
185 185
             }
186 186
 
187
-            return ! $option['is_deleted'];
187
+            return !$option['is_deleted'];
188 188
         });
189 189
     }
190 190
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
      */
197 197
     protected function deleteRelatedOptionValues(array $optionValues)
198 198
     {
199
-        return array_filter($optionValues, function ($optionValue) {
199
+        return array_filter($optionValues, function($optionValue) {
200 200
             if ($optionValue['id'] !== null && $optionValue['is_deleted']) {
201 201
                 OptionValue::find($optionValue['id'])->delete();
202 202
             }
203 203
 
204
-            return ! $optionValue['is_deleted'];
204
+            return !$optionValue['is_deleted'];
205 205
         });
206 206
     }
207 207
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * @param  string $sessionKey
334 334
      * @return void
335 335
      */
336
-    protected function saveRelatedOptionValues(Option &$option, array $values, $sessionKey)
336
+    protected function saveRelatedOptionValues(Option & $option, array $values, $sessionKey)
337 337
     {
338 338
         foreach ($values as $index => $value) {
339 339
             $model = array_key_exists('id', $value) && $value['id'] !== null
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
         $grammar = $query->getQuery()->getGrammar();
361 361
 
362 362
         $subquery = Inventory::addSelect('bedard_shop_inventories.product_id')
363
-            ->selectRaw('SUM(' . $grammar->wrap('bedard_shop_inventories.quantity') .') as '. $grammar->wrap('inventory'))
363
+            ->selectRaw('SUM('.$grammar->wrap('bedard_shop_inventories.quantity').') as '.$grammar->wrap('inventory'))
364 364
             ->groupBy('bedard_shop_inventories.product_id');
365 365
 
366 366
         return $query
367
-            ->addSelect($alias . '.inventory')
368
-            ->joinSubquery($subquery, $alias, 'bedard_shop_products.id', '=', $alias . '.product_id', 'leftJoin');
367
+            ->addSelect($alias.'.inventory')
368
+            ->joinSubquery($subquery, $alias, 'bedard_shop_products.id', '=', $alias.'.product_id', 'leftJoin');
369 369
     }
370 370
 
371 371
     /**
@@ -409,11 +409,11 @@  discard block
 block discarded – undo
409 409
         $is_enabled = $grammar->wrap('bedard_shop_products.is_enabled');
410 410
         $base_price = $grammar->wrap('bedard_shop_products.base_price');
411 411
 
412
-        $subquery = "CASE " .
413
-            "WHEN {$is_enabled} = 0 THEN -2 " .
414
-            "WHEN ({$inventory} IS NULL or {$inventory} = 0) THEN -1 " .
415
-            "WHEN {$price} < {$base_price} THEN 1 " .
416
-            "ELSE 0 " .
412
+        $subquery = "CASE ".
413
+            "WHEN {$is_enabled} = 0 THEN -2 ".
414
+            "WHEN ({$inventory} IS NULL or {$inventory} = 0) THEN -1 ".
415
+            "WHEN {$price} < {$base_price} THEN 1 ".
416
+            "ELSE 0 ".
417 417
         "END";
418 418
 
419 419
         return $query->selectSubquery($subquery, 'status');
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
      */
437 437
     public static function syncAllInheritedCategories()
438 438
     {
439
-        Queue::push(function ($job) {
439
+        Queue::push(function($job) {
440 440
             $data = [];
441 441
             $products = Product::with('categories')->get();
442 442
             $categoryTree = Category::getParentCategoryIds();
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
      */
500 500
     protected function validateInventories()
501 501
     {
502
-        if (! is_array($this->optionsInventories) ||
503
-            ! is_array($this->optionsInventories['options'])) {
502
+        if (!is_array($this->optionsInventories) ||
503
+            !is_array($this->optionsInventories['options'])) {
504 504
             return;
505 505
         }
506 506
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
             sort($inventory['valueIds']);
515 515
             $valueCombination = json_encode($inventory['valueIds']);
516 516
 
517
-            if (in_array($valueCombination, $takenValueCombinations) && ! $inventory['is_deleted']) {
517
+            if (in_array($valueCombination, $takenValueCombinations) && !$inventory['is_deleted']) {
518 518
                 Flash::error(Lang::get('bedard.shop::lang.products.form.duplicate_inventories_error'));
519 519
                 throw new ModelException($this);
520 520
             }
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
      */
532 532
     protected function validateOptions()
533 533
     {
534
-        if (! is_array($this->optionsInventories) ||
535
-            ! is_array($this->optionsInventories['options'])) {
534
+        if (!is_array($this->optionsInventories) ||
535
+            !is_array($this->optionsInventories['options'])) {
536 536
             return;
537 537
         }
538 538
 
Please login to merge, or discard this patch.