Skip to content

Commit beee8d7

Browse files
Fix styling
1 parent db2a16f commit beee8d7

File tree

7 files changed

+13
-80
lines changed

7 files changed

+13
-80
lines changed

src/Interfaces/WalletOperations.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,23 @@ interface WalletOperations
66
{
77
/**
88
* Get User's Wallet Balance
9-
*
10-
* @return int|float
119
*/
1210
public function getWalletBalanceAttribute(): int|float;
1311

1412
/**
1513
* Get the balance of a specific wallet type.
16-
*
17-
*
18-
* @param string $walletType
19-
*
20-
* @return float|int
2114
*/
2215
public function getWalletBalanceByType(string $walletType): float|int;
2316

2417
/**
2518
* Check if User's wallet balance is more than given value
26-
*
27-
* @param int|float $value
28-
*
29-
* @return bool
3019
*/
3120
public function hasSufficientBalance(int|float $value): bool;
3221

3322
/**
3423
* Pay the order value from the user's wallets.
3524
*
36-
* @param int|float $orderValue
37-
* @param ?string $notes
25+
* @param ?string $notes
3826
*
3927
* @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException
4028
*/
@@ -43,11 +31,7 @@ public function pay(int|float $orderValue, ?string $notes = null): void;
4331
/**
4432
* Deposit an amount to the user's wallet of a specific type.
4533
*
46-
* @param string $type
47-
* @param int|float $amount
48-
* @param ?string $notes
49-
*
50-
* @return bool
34+
* @param ?string $notes
5135
*/
5236
public function deposit(string $type, int|float $amount, ?string $notes = null): bool;
5337
}

src/Services/PocketServices.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ class PocketServices
99
/**
1010
* Deposit an amount to the user's wallet of a specific type.
1111
*
12-
* @param \Illuminate\Database\Eloquent\Model $user
13-
* @param string $type
14-
* @param int|float $amount
15-
* @param ?string $notes
16-
*
17-
* @return bool
12+
* @param ?string $notes
1813
*/
1914
public function deposit(Model $user, string $type, int|float $amount, ?string $notes = null): bool
2015
{
@@ -24,11 +19,8 @@ public function deposit(Model $user, string $type, int|float $amount, ?string $n
2419
/**
2520
* Pay the order value from the user's wallets.
2621
*
27-
* @param \Illuminate\Database\Eloquent\Model $user
28-
* @param int|float $orderValue
29-
* @param ?string $notes
22+
* @param ?string $notes
3023
*
31-
* @return void
3224
* @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException
3325
*/
3426
public function pay(Model $user, int|float $orderValue, ?string $notes = null): void
@@ -38,11 +30,6 @@ public function pay(Model $user, int|float $orderValue, ?string $notes = null):
3830

3931
/**
4032
* Get the balance of the user.
41-
*
42-
*
43-
* @param \Illuminate\Database\Eloquent\Model $user
44-
*
45-
* @return float|int
4633
*/
4734
public function checkBalance(Model $user): int|float
4835
{
@@ -51,15 +38,9 @@ public function checkBalance(Model $user): int|float
5138

5239
/**
5340
* Get the balance of a specific wallet type.
54-
*
55-
*
56-
* @param \Illuminate\Database\Eloquent\Model $user
57-
* @param string $type
58-
*
59-
* @return float|int
6041
*/
6142
public function walletBalanceByType(Model $user, string $type): float|int
6243
{
6344
return $user->getWalletBalanceByType($type);
6445
}
65-
}
46+
}

src/Traits/BalanceOperation.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ trait BalanceOperation
1010

1111
/**
1212
* Check if Balance is more than zero.
13-
*
14-
* @return bool
1513
*/
1614
public function hasBalance(): bool
1715
{
@@ -21,10 +19,7 @@ public function hasBalance(): bool
2119
/**
2220
* Decrement Balance and create a log entry.
2321
*
24-
* @param int|float $value
25-
* @param ?string $notes
26-
*
27-
* @return void
22+
* @param ?string $notes
2823
*/
2924
public function decrementAndCreateLog(int|float $value, ?string $notes = null): void
3025
{
@@ -35,10 +30,7 @@ public function decrementAndCreateLog(int|float $value, ?string $notes = null):
3530
/**
3631
* Increment Balance and create a log entry.
3732
*
38-
* @param int|float $value
39-
* @param ?string $notes
40-
*
41-
* @return void
33+
* @param ?string $notes
4234
*/
4335
public function incrementAndCreateLog(int|float $value, ?string $notes = null): void
4436
{
@@ -49,11 +41,7 @@ public function incrementAndCreateLog(int|float $value, ?string $notes = null):
4941
/**
5042
* Create a new log record
5143
*
52-
* @param string $logType
53-
* @param int|float $value
54-
* @param ?string $notes
55-
*
56-
* @return void
44+
* @param ?string $notes
5745
*/
5846
protected function createLog(string $logType, int|float $value, ?string $notes = null): void
5947
{

src/Traits/HandlesDeposit.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ trait HandlesDeposit
1515
/**
1616
* Deposit an amount to the user's wallet of a specific type.
1717
*
18-
* @param string $type
19-
* @param int|float $amount
20-
* @param ?string $notes
18+
* @param ?string $notes
2119
*
22-
* @return bool
2320
* @throws InvalidDepositException|InvalidValueException|InvalidWalletTypeException
2421
*/
2522
public function deposit(string $type, int|float $amount, ?string $notes = null): bool
@@ -45,8 +42,6 @@ public function deposit(string $type, int|float $amount, ?string $notes = null):
4542

4643
/**
4744
* Get depositable types from WalletEnums.
48-
*
49-
* @return array
5045
*/
5146
private function getDepositableTypes(): array
5247
{
@@ -61,10 +56,9 @@ private function getDepositableTypes(): array
6156
/**
6257
* Check if the given type is valid.
6358
*
64-
* @var string $type
65-
* @var array $depositable
59+
* @var string
60+
* @var array
6661
*
67-
* @return bool
6862
* @throws InvalidWalletTypeException
6963
*/
7064
private function isRequestValid($type, array $depositable): bool

src/Traits/HandlesPayment.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ trait HandlesPayment
1010
/**
1111
* Pay the order value from the user's wallets.
1212
*
13-
* @param int|float $orderValue
14-
* @param ?string $notes
13+
* @param ?string $notes
1514
*
16-
* @return void
1715
* @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException
1816
*/
1917
public function pay(int|float $orderValue, ?string $notes = null): void

src/Traits/HasWallet.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public function wallets()
2323

2424
/**
2525
* Get User's Wallet Balance
26-
*
27-
* @return int|float
2826
*/
2927
public function getWalletBalanceAttribute(): int|float
3028
{
@@ -45,24 +43,14 @@ public function getWalletBalanceAttribute(): int|float
4543

4644
/**
4745
* Check if User's wallet balance is more than given value
48-
*
49-
* @param int|float $value
50-
*
51-
* @return bool
5246
*/
5347
public function hasSufficientBalance(int|float $value): bool
5448
{
5549
return (int) $this->walletBalance >= (int) $value;
5650
}
5751

58-
5952
/**
6053
* Get the balance of a specific wallet type.
61-
*
62-
*
63-
* @param string $walletType
64-
*
65-
* @return float|int
6654
*/
6755
public function getWalletBalanceByType(string $walletType): float|int
6856
{

tests/Models/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
class User extends Authenticatable implements WalletOperations
1313
{
1414
use HasFactory;
15-
use Notifiable;
1615
use ManagesWallet;
16+
use Notifiable;
1717

1818
/**
1919
* The attributes that are mass assignable.

0 commit comments

Comments
 (0)