@@ -111,7 +111,7 @@ |
||
111 | 111 | public function canBuy(Customer $customer, bool $force = null): bool |
112 | 112 | { |
113 | 113 | foreach ($this->items as $item) { |
114 | - if (! $item->canBuy($customer, $this->getQuantity($item), $force)) { |
|
114 | + if (!$item->canBuy($customer, $this->getQuantity($item), $force)) { |
|
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function owner(): string |
59 | 59 | { |
60 | - if (! $this->ownerId) { |
|
60 | + if (!$this->ownerId) { |
|
61 | 61 | $this->ownerId = Str::random(); |
62 | 62 | } |
63 | 63 |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | public function boot(): void |
38 | 38 | { |
39 | 39 | $this->loadTranslationsFrom( |
40 | - dirname(__DIR__).'/resources/lang', |
|
40 | + dirname(__DIR__) . '/resources/lang', |
|
41 | 41 | 'wallet' |
42 | 42 | ); |
43 | 43 | |
44 | - if (! $this->app->runningInConsole()) { |
|
44 | + if (!$this->app->runningInConsole()) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
@@ -49,28 +49,28 @@ discard block |
||
49 | 49 | |
50 | 50 | if ($this->shouldMigrate()) { |
51 | 51 | $this->loadMigrationsFrom([ |
52 | - __DIR__.'/../database/migrations_v1', |
|
53 | - __DIR__.'/../database/migrations_v2', |
|
52 | + __DIR__ . '/../database/migrations_v1', |
|
53 | + __DIR__ . '/../database/migrations_v2', |
|
54 | 54 | ]); |
55 | 55 | } |
56 | 56 | |
57 | 57 | if (function_exists('config_path')) { |
58 | 58 | $this->publishes([ |
59 | - dirname(__DIR__).'/config/config.php' => config_path('wallet.php'), |
|
59 | + dirname(__DIR__) . '/config/config.php' => config_path('wallet.php'), |
|
60 | 60 | ], 'laravel-wallet-config'); |
61 | 61 | } |
62 | 62 | |
63 | 63 | $this->publishes([ |
64 | - dirname(__DIR__).'/database/migrations_v1/' => database_path('migrations'), |
|
65 | - dirname(__DIR__).'/database/migrations_v2/' => database_path('migrations'), |
|
64 | + dirname(__DIR__) . '/database/migrations_v1/' => database_path('migrations'), |
|
65 | + dirname(__DIR__) . '/database/migrations_v2/' => database_path('migrations'), |
|
66 | 66 | ], 'laravel-wallet-migrations'); |
67 | 67 | |
68 | 68 | $this->publishes([ |
69 | - dirname(__DIR__).'/database/migrations_v1/' => database_path('migrations'), |
|
69 | + dirname(__DIR__) . '/database/migrations_v1/' => database_path('migrations'), |
|
70 | 70 | ], 'laravel-wallet-migrations-v1'); |
71 | 71 | |
72 | 72 | $this->publishes([ |
73 | - dirname(__DIR__).'/database/migrations_v2/' => database_path('migrations'), |
|
73 | + dirname(__DIR__) . '/database/migrations_v2/' => database_path('migrations'), |
|
74 | 74 | ], 'laravel-wallet-migrations-v2'); |
75 | 75 | } |
76 | 76 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function register(): void |
83 | 83 | { |
84 | 84 | $this->mergeConfigFrom( |
85 | - dirname(__DIR__).'/config/config.php', |
|
85 | + dirname(__DIR__) . '/config/config.php', |
|
86 | 86 | 'wallet' |
87 | 87 | ); |
88 | 88 |
@@ -127,7 +127,7 @@ |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($this->scale === null) { |
130 | - $this->scale = (int) config('wallet.math.scale', 64); |
|
130 | + $this->scale = (int)config('wallet.math.scale', 64); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $this->scale; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function getBalance($object) |
20 | 20 | { |
21 | 21 | $wallet = app(WalletService::class)->getWallet($object); |
22 | - if (! \array_key_exists($wallet->getKey(), $this->balanceSheets)) { |
|
22 | + if (!\array_key_exists($wallet->getKey(), $this->balanceSheets)) { |
|
23 | 23 | $balance = method_exists($wallet, 'getRawOriginal') ? |
24 | 24 | $wallet->getRawOriginal('balance', 0) : $wallet->getOriginal('balance', 0); |
25 | 25 |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($this->isNegative($number)) { |
100 | - return bcsub($number, '0.'.str_repeat('0', $precision).'5', $precision); |
|
100 | + return bcsub($number, '0.' . str_repeat('0', $precision) . '5', $precision); |
|
101 | 101 | } |
102 | 102 | |
103 | - return bcadd($number, '0.'.str_repeat('0', $precision).'5', $precision); |
|
103 | + return bcadd($number, '0.' . str_repeat('0', $precision) . '5', $precision); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function abs($number): string |
111 | 111 | { |
112 | - if (! preg_match('~^-?\d*(\.\d*)?$~', $number, $matches)) { |
|
112 | + if (!preg_match('~^-?\d*(\.\d*)?$~', $number, $matches)) { |
|
113 | 113 | return 0; |
114 | 114 | } |
115 | 115 |
@@ -151,7 +151,7 @@ |
||
151 | 151 | /** |
152 | 152 | * Allow to buy for free with a negative balance. |
153 | 153 | */ |
154 | - if ($allowZero && ! $math->compare($amount, 0)) { |
|
154 | + if ($allowZero && !$math->compare($amount, 0)) { |
|
155 | 155 | return true; |
156 | 156 | } |
157 | 157 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | return app(DbService::class)->transaction(static function () use ($self, $transaction) { |
26 | 26 | $wallet = app(WalletService::class)->getWallet($self); |
27 | - if (! $wallet->refreshBalance()) { |
|
27 | + if (!$wallet->refreshBalance()) { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | |
67 | 67 | return app(DbService::class)->transaction(static function () use ($self, $transaction) { |
68 | 68 | $wallet = app(WalletService::class)->getWallet($self); |
69 | - if (! $wallet->refreshBalance()) { |
|
69 | + if (!$wallet->refreshBalance()) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
73 | - if (! $transaction->confirmed) { |
|
73 | + if (!$transaction->confirmed) { |
|
74 | 74 | throw new ConfirmedInvalid(trans('wallet::errors.unconfirmed_invalid')); |
75 | 75 | } |
76 | 76 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getWallet(string $slug): ?WalletModel |
50 | 50 | { |
51 | - if (! $this->_loadedWallets && $this->relationLoaded('wallets')) { |
|
51 | + if (!$this->_loadedWallets && $this->relationLoaded('wallets')) { |
|
52 | 52 | $this->_loadedWallets = true; |
53 | 53 | $wallets = $this->getRelation('wallets'); |
54 | 54 | foreach ($wallets as $wallet) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - if (! array_key_exists($slug, $this->_wallets)) { |
|
59 | + if (!array_key_exists($slug, $this->_wallets)) { |
|
60 | 60 | $this->_wallets[$slug] = $this->wallets() |
61 | 61 | ->where('slug', $slug) |
62 | 62 | ->first(); |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function hasWallet(string $slug): bool |
107 | 107 | { |
108 | - return (bool) $this->getWallet($slug); |
|
108 | + return (bool)$this->getWallet($slug); |
|
109 | 109 | } |
110 | 110 | } |