From beee8d755bd9db2a8963b622c507b126aaf2484b Mon Sep 17 00:00:00 2001 From: HPWebdeveloper Date: Sat, 13 Jan 2024 10:26:00 +0000 Subject: [PATCH] Fix styling --- src/Interfaces/WalletOperations.php | 20 ++------------------ src/Services/PocketServices.php | 25 +++---------------------- src/Traits/BalanceOperation.php | 18 +++--------------- src/Traits/HandlesDeposit.php | 12 +++--------- src/Traits/HandlesPayment.php | 4 +--- src/Traits/HasWallet.php | 12 ------------ tests/Models/User.php | 2 +- 7 files changed, 13 insertions(+), 80 deletions(-) diff --git a/src/Interfaces/WalletOperations.php b/src/Interfaces/WalletOperations.php index c41dfce..cdffed0 100644 --- a/src/Interfaces/WalletOperations.php +++ b/src/Interfaces/WalletOperations.php @@ -6,35 +6,23 @@ interface WalletOperations { /** * Get User's Wallet Balance - * - * @return int|float */ public function getWalletBalanceAttribute(): int|float; /** * Get the balance of a specific wallet type. - * - * - * @param string $walletType - * - * @return float|int */ public function getWalletBalanceByType(string $walletType): float|int; /** * Check if User's wallet balance is more than given value - * - * @param int|float $value - * - * @return bool */ public function hasSufficientBalance(int|float $value): bool; /** * Pay the order value from the user's wallets. * - * @param int|float $orderValue - * @param ?string $notes + * @param ?string $notes * * @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException */ @@ -43,11 +31,7 @@ public function pay(int|float $orderValue, ?string $notes = null): void; /** * Deposit an amount to the user's wallet of a specific type. * - * @param string $type - * @param int|float $amount - * @param ?string $notes - * - * @return bool + * @param ?string $notes */ public function deposit(string $type, int|float $amount, ?string $notes = null): bool; } diff --git a/src/Services/PocketServices.php b/src/Services/PocketServices.php index e5c836d..1ee674d 100644 --- a/src/Services/PocketServices.php +++ b/src/Services/PocketServices.php @@ -9,12 +9,7 @@ class PocketServices /** * Deposit an amount to the user's wallet of a specific type. * - * @param \Illuminate\Database\Eloquent\Model $user - * @param string $type - * @param int|float $amount - * @param ?string $notes - * - * @return bool + * @param ?string $notes */ public function deposit(Model $user, string $type, int|float $amount, ?string $notes = null): bool { @@ -24,11 +19,8 @@ public function deposit(Model $user, string $type, int|float $amount, ?string $n /** * Pay the order value from the user's wallets. * - * @param \Illuminate\Database\Eloquent\Model $user - * @param int|float $orderValue - * @param ?string $notes + * @param ?string $notes * - * @return void * @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException */ 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): /** * Get the balance of the user. - * - * - * @param \Illuminate\Database\Eloquent\Model $user - * - * @return float|int */ public function checkBalance(Model $user): int|float { @@ -51,15 +38,9 @@ public function checkBalance(Model $user): int|float /** * Get the balance of a specific wallet type. - * - * - * @param \Illuminate\Database\Eloquent\Model $user - * @param string $type - * - * @return float|int */ public function walletBalanceByType(Model $user, string $type): float|int { return $user->getWalletBalanceByType($type); } -} \ No newline at end of file +} diff --git a/src/Traits/BalanceOperation.php b/src/Traits/BalanceOperation.php index 95f8041..a559693 100644 --- a/src/Traits/BalanceOperation.php +++ b/src/Traits/BalanceOperation.php @@ -10,8 +10,6 @@ trait BalanceOperation /** * Check if Balance is more than zero. - * - * @return bool */ public function hasBalance(): bool { @@ -21,10 +19,7 @@ public function hasBalance(): bool /** * Decrement Balance and create a log entry. * - * @param int|float $value - * @param ?string $notes - * - * @return void + * @param ?string $notes */ public function decrementAndCreateLog(int|float $value, ?string $notes = null): void { @@ -35,10 +30,7 @@ public function decrementAndCreateLog(int|float $value, ?string $notes = null): /** * Increment Balance and create a log entry. * - * @param int|float $value - * @param ?string $notes - * - * @return void + * @param ?string $notes */ public function incrementAndCreateLog(int|float $value, ?string $notes = null): void { @@ -49,11 +41,7 @@ public function incrementAndCreateLog(int|float $value, ?string $notes = null): /** * Create a new log record * - * @param string $logType - * @param int|float $value - * @param ?string $notes - * - * @return void + * @param ?string $notes */ protected function createLog(string $logType, int|float $value, ?string $notes = null): void { diff --git a/src/Traits/HandlesDeposit.php b/src/Traits/HandlesDeposit.php index ba5f683..2d8318a 100644 --- a/src/Traits/HandlesDeposit.php +++ b/src/Traits/HandlesDeposit.php @@ -15,11 +15,8 @@ trait HandlesDeposit /** * Deposit an amount to the user's wallet of a specific type. * - * @param string $type - * @param int|float $amount - * @param ?string $notes + * @param ?string $notes * - * @return bool * @throws InvalidDepositException|InvalidValueException|InvalidWalletTypeException */ 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): /** * Get depositable types from WalletEnums. - * - * @return array */ private function getDepositableTypes(): array { @@ -61,10 +56,9 @@ private function getDepositableTypes(): array /** * Check if the given type is valid. * - * @var string $type - * @var array $depositable + * @var string + * @var array * - * @return bool * @throws InvalidWalletTypeException */ private function isRequestValid($type, array $depositable): bool diff --git a/src/Traits/HandlesPayment.php b/src/Traits/HandlesPayment.php index d8d83ca..e40ec19 100644 --- a/src/Traits/HandlesPayment.php +++ b/src/Traits/HandlesPayment.php @@ -10,10 +10,8 @@ trait HandlesPayment /** * Pay the order value from the user's wallets. * - * @param int|float $orderValue - * @param ?string $notes + * @param ?string $notes * - * @return void * @throws \HPWebdeveloper\LaravelPayPocket\Exceptions\InsufficientBalanceException */ public function pay(int|float $orderValue, ?string $notes = null): void diff --git a/src/Traits/HasWallet.php b/src/Traits/HasWallet.php index 8f945e8..6748dfa 100644 --- a/src/Traits/HasWallet.php +++ b/src/Traits/HasWallet.php @@ -23,8 +23,6 @@ public function wallets() /** * Get User's Wallet Balance - * - * @return int|float */ public function getWalletBalanceAttribute(): int|float { @@ -45,24 +43,14 @@ public function getWalletBalanceAttribute(): int|float /** * Check if User's wallet balance is more than given value - * - * @param int|float $value - * - * @return bool */ public function hasSufficientBalance(int|float $value): bool { return (int) $this->walletBalance >= (int) $value; } - /** * Get the balance of a specific wallet type. - * - * - * @param string $walletType - * - * @return float|int */ public function getWalletBalanceByType(string $walletType): float|int { diff --git a/tests/Models/User.php b/tests/Models/User.php index c9a560a..5c07e35 100644 --- a/tests/Models/User.php +++ b/tests/Models/User.php @@ -12,8 +12,8 @@ class User extends Authenticatable implements WalletOperations { use HasFactory; - use Notifiable; use ManagesWallet; + use Notifiable; /** * The attributes that are mass assignable.