Showing 23 of 26 total issues
File WalletServiceProvider.php
has 413 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 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 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 3 locations. Consider refactoring. Open
public function withdrawFloat(float|int|string $amount, ?array $meta = null, bool $confirmed = true): Transaction
{
$math = app(MathServiceInterface::class);
$decimalPlacesValue = app(CastServiceInterface::class)->getWallet($this)->decimal_places;
$decimalPlaces = $math->powTen($decimalPlacesValue);
- 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
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
{
$math = app(MathServiceInterface::class);
$decimalPlacesValue = app(CastServiceInterface::class)->getWallet($this)->decimal_places;
$decimalPlaces = $math->powTen($decimalPlacesValue);
- 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 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 forceExchange
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
public function forceExchange(Wallet $to, int|string $amount, ExtraDtoInterface|array|null $meta = null): Transfer
{
return app(AtomicServiceInterface::class)->block($this, function () use ($to, $amount, $meta): Transfer {
$extraAssembler = app(ExtraDtoAssemblerInterface::class);
$prepareService = app(PrepareServiceInterface::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
{
return app(AtomicServiceInterface::class)->block($this, function () use ($to, $amount, $meta): Transfer {
app(ConsistencyServiceInterface::class)->checkPotential($this, $amount);
- 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
{
return app(AtomicServiceInterface::class)->block($this, function () use ($wallet, $amount, $meta): Transfer {
/** @var Wallet $this */
app(ConsistencyServiceInterface::class)->checkPotential($this, $amount);
- 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 payFreeCart
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function payFreeCart(CartInterface $cart): array
{
return app(AtomicServiceInterface::class)->block($this, function () use ($cart) {
$basketDto = $cart->getBasketDto();
$basketService = app(BasketServiceInterface::class);
Method create
has 9 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
int $depositId,
int $withdrawId,
string $status,
Model $fromModel,
Model $toModel,
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 7 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Model $payable,
int $walletId,
string $type,
float|int|string $amount,
bool $confirmed,
Method transferExtraLazy
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Wallet $from,
WalletModel $fromWallet,
Wallet $to,
WalletModel $toWallet,
string $status,
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 transferLazy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Wallet $from,
Wallet $to,
string $status,
float|int|string $amount,
ExtraDtoInterface|array|null $meta = null
Method deposit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Confirmed
Wallet $wallet,
float|int|string $amount,
?array $meta,
bool $confirmed = true,
?string $uuid = null