@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Cart; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Cart\ServiceProviders; |
| 5 | 5 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function register() |
| 17 | 17 | { |
| 18 | - $this->app->bind('cart', function () { |
|
| 18 | + $this->app->bind('cart', function() { |
|
| 19 | 19 | $kernel = new Kernel(); |
| 20 | 20 | $kernel->bootstrapping(); |
| 21 | 21 | $kernel->loadServiceProvider(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Cart\Contracts; |
| 5 | 5 | |
@@ -13,14 +13,14 @@ discard block |
||
| 13 | 13 | * @param array $item |
| 14 | 14 | * @return mixed |
| 15 | 15 | */ |
| 16 | - public function add(array $item) : bool ; |
|
| 16 | + public function add(array $item) : bool; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Remove item from cart |
| 20 | 20 | * @param array $itemId |
| 21 | 21 | * @return mixed |
| 22 | 22 | */ |
| 23 | - public function remove(array $itemId):bool ; |
|
| 23 | + public function remove(array $itemId):bool; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Clear cart for concrete relation entity |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | * @param CounterItemContract $itemContract |
| 37 | 37 | * @return mixed |
| 38 | 38 | */ |
| 39 | - public function change(array $item, CounterItemContract $itemContract) : bool ; |
|
| 39 | + public function change(array $item, CounterItemContract $itemContract) : bool; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Get items to user id |
| 43 | 43 | * @param int $userId |
| 44 | 44 | * @return array |
| 45 | 45 | */ |
| 46 | - public function get(int $userId) : array ; |
|
| 46 | + public function get(int $userId) : array; |
|
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Cart\Drivers; |
| 5 | 5 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $collection = $this->getItems($item['user_id']); |
| 78 | 78 | |
| 79 | 79 | if ($collection->isNotEmpty()) { |
| 80 | - $itemFilter = array_filter(fromJson($collection->first()->data, true), function ($value) use ($item) { |
|
| 80 | + $itemFilter = array_filter(fromJson($collection->first()->data, true), function($value) use ($item) { |
|
| 81 | 81 | return $value['id'] != $item['id']; |
| 82 | 82 | }); |
| 83 | 83 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $row = $this->getItems($items['user_id']); |
| 154 | 154 | |
| 155 | 155 | if ($row->isNotEmpty()) { |
| 156 | - $transformItems = array_map(function ($value) use ($items, $newPrice) { |
|
| 156 | + $transformItems = array_map(function($value) use ($items, $newPrice) { |
|
| 157 | 157 | if ($value['id'] == $items['id']) { |
| 158 | 158 | $value['discount'] = $newPrice; |
| 159 | 159 | return $value; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | $items = fromJson($collection->first()->data, true); |
| 238 | 238 | |
| 239 | - $targetItem = array_filter($items, function ($value) use ($itemId) { |
|
| 239 | + $targetItem = array_filter($items, function($value) use ($itemId) { |
|
| 240 | 240 | return $value['id'] == $itemId; |
| 241 | 241 | }); |
| 242 | 242 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Cart\Drivers; |
| 5 | 5 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | public function get(int $userId) : array |
| 149 | 149 | { |
| 150 | 150 | $items = $this->redis->hgetall($this->normalizeKey((int)$userId)); |
| 151 | - $items = array_map(function (string $value) { |
|
| 151 | + $items = array_map(function(string $value) { |
|
| 152 | 152 | return unserialize($value); |
| 153 | 153 | }, $items); |
| 154 | 154 | |