Showing 24 of 27 total issues
File WalletServiceProvider.php
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
<?php
declare(strict_types=1);
namespace Bavix\Wallet;
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function transferFloat(
Wallet $wallet,
float|int|string $amount,
ExtraDtoInterface|array|null $meta = null
): Transfer {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 135.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function forceTransferFloat(
Wallet $wallet,
float|int|string $amount,
ExtraDtoInterface|array|null $meta = null
): Transfer {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 135.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function withdrawFloat(float|int|string $amount, ?array $meta = null, bool $confirmed = true): Transaction
{
// Get the math service.
$math = app(MathServiceInterface::class);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function depositFloat(float|int|string $amount, ?array $meta = null, bool $confirmed = true): Transaction
{
// Get the math service.
$math = app(MathServiceInterface::class);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function forceWithdrawFloat(
float|int|string $amount,
?array $meta = null,
bool $confirmed = true
): Transaction {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 132.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method forceExchange
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
public function forceExchange(Wallet $to, int|string $amount, ExtraDtoInterface|array|null $meta = null): Transfer
{
// Get the atomic service to execute the exchange operation as a single, indivisible action.
$atomicService = app(AtomicServiceInterface::class);
File CartPay.php
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
<?php
declare(strict_types=1);
namespace Bavix\Wallet\Traits;
Method services
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private function services(array $configure, array $cache): void
{
$this->app->singleton(AssistantServiceInterface::class, $configure['assistant'] ?? AssistantService::class);
$this->app->singleton(AtmServiceInterface::class, $configure['atm'] ?? AtmService::class);
$this->app->singleton(AtomicServiceInterface::class, $configure['atomic'] ?? AtomicService::class);
Method payFreeCart
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function payFreeCart(CartInterface $cart): array
{
$atomicService = app(AtomicServiceInterface::class);
$eagerLoaderService = app(EagerLoaderServiceInterface::class);
$basketService = app(BasketServiceInterface::class);
Similar blocks of code found in 2 locations. Consider refactoring. Confirmed
public function exchange(Wallet $to, int|string $amount, ExtraDtoInterface|array|null $meta = null): Transfer
{
// Execute the exchange operation atomically
// AtomicServiceInterface ensures that the exchange operation is performed as a single, indivisible action
// to prevent race conditions and ensure consistency.
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Confirmed
public function transfer(Wallet $wallet, int|string $amount, ExtraDtoInterface|array|null $meta = null): Transfer
{
// Wrap the transfer in an atomic block to ensure consistency and prevent race conditions.
return app(AtomicServiceInterface::class)->block($this, function () use ($wallet, $amount, $meta): Transfer {
/** @var Wallet $this */
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method assemblers
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private function assemblers(array $configure): void
{
$this->app->singleton(
AvailabilityDtoAssemblerInterface::class,
$configure['availability'] ?? AvailabilityDtoAssembler::class
Method create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Wallet $fromWallet,
Wallet $toWallet,
int $discount,
string $fee,
TransactionDtoInterface $withdrawDto,
Method create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Wallet $fromWallet,
Wallet $toWallet,
int $discount,
string $fee,
TransactionDtoInterface $withdrawDto,
Method create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
int $depositId,
int $withdrawId,
string $status,
Model $fromModel,
Model $toModel,
Method transferExtraLazy
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Wallet $from,
WalletModel $fromWallet,
Wallet $to,
WalletModel $toWallet,
string $status,
Method create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Model $payable,
int $walletId,
string $type,
float|int|string $amount,
bool $confirmed,
Method withdraw
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Wallet $wallet,
float|int|string $amount,
?array $meta,
bool $confirmed = true,
?string $uuid = null
Method makeOne
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Wallet $wallet,
string $type,
float|int|string $amount,
?array $meta,
bool $confirmed = true