Skip to content

Commit 1d6609a

Browse files
committed
update ecs
1 parent a9dc3e2 commit 1d6609a

25 files changed

+44
-37
lines changed

Diff for: ecs.php

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
$containerConfigurator->import(SetList::SYMPLIFY);
4545
$containerConfigurator->import(SetList::COMMON);
4646
$containerConfigurator->import(SetList::PSR_12);
47-
$containerConfigurator->import(SetList::PHP_CS_FIXER);
4847
$containerConfigurator->import(SetList::CONTROL_STRUCTURES);
4948
$containerConfigurator->import(SetList::NAMESPACES);
5049
$containerConfigurator->import(SetList::STRICT);

Diff for: src/Commands/TransferFixCommand.php

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
final class TransferFixCommand extends Command
1313
{
1414
protected $signature = 'bx:transfer:fix';
15+
1516
protected $description = 'Brings transfers to the correct form/to.';
1617

1718
public function handle(Wallet $wallet, Transfer $transfer, CastServiceInterface $castService): void

Diff for: src/External/Dto/Extra.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
final class Extra implements ExtraDtoInterface
1111
{
1212
private OptionDtoInterface $deposit;
13+
1314
private OptionDtoInterface $withdraw;
1415

1516
public function __construct(OptionDtoInterface|array|null $deposit, OptionDtoInterface|array|null $withdraw)

Diff for: src/Internal/Dto/TransactionDto.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
final class TransactionDto implements TransactionDtoInterface
1111
{
1212
private DateTimeImmutable $createdAt;
13+
1314
private DateTimeImmutable $updatedAt;
1415

1516
public function __construct(

Diff for: src/Internal/Dto/TransferDto.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
final class TransferDto implements TransferDtoInterface
1111
{
1212
private DateTimeImmutable $createdAt;
13+
1314
private DateTimeImmutable $updatedAt;
1415

1516
public function __construct(

Diff for: src/Internal/Exceptions/ExceptionInterface.php

+12
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,28 @@
99
interface ExceptionInterface extends Throwable
1010
{
1111
public const AMOUNT_INVALID = 1 << 0;
12+
1213
public const BALANCE_IS_EMPTY = 1 << 1;
14+
1315
public const CONFIRMED_INVALID = 1 << 2;
16+
1417
public const UNCONFIRMED_INVALID = 1 << 3;
18+
1519
public const INSUFFICIENT_FUNDS = 1 << 4;
20+
1621
public const PRODUCT_ENDED = 1 << 5;
22+
1723
public const WALLET_OWNER_INVALID = 1 << 6;
24+
1825
public const CART_EMPTY = 1 << 7;
26+
1927
public const LOCK_PROVIDER_NOT_FOUND = 1 << 8;
28+
2029
public const RECORD_NOT_FOUND = 1 << 9;
30+
2131
public const TRANSACTION_FAILED = 1 << 10;
32+
2233
public const MODEL_NOT_FOUND = 1 << 11;
34+
2335
public const TRANSACTION_START = 1 << 12;
2436
}

Diff for: src/Internal/Service/DatabaseService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function transaction(callable $callback): mixed
7474
$this->init = false;
7575

7676
throw new TransactionFailedException(
77-
'Transaction failed. Message: '.$throwable->getMessage(),
77+
'Transaction failed. Message: ' . $throwable->getMessage(),
7878
ExceptionInterface::TRANSACTION_FAILED,
7979
$throwable
8080
);

Diff for: src/Internal/Service/StorageService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function sync(string $key, float|int|string $value): bool
5656
public function increase(string $key, float|int|string $value): string
5757
{
5858
return $this->lockService->block(
59-
$key.'::increase',
59+
$key . '::increase',
6060
function () use ($key, $value): string {
6161
$result = $this->mathService->add($this->get($key), $value);
6262
$this->sync($key, $result);

Diff for: src/Models/Transaction.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
class Transaction extends Model
3333
{
3434
public const TYPE_DEPOSIT = 'deposit';
35+
3536
public const TYPE_WITHDRAW = 'withdraw';
3637

3738
/**

Diff for: src/Models/Transfer.php

+4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
class Transfer extends Model
3232
{
3333
public const STATUS_EXCHANGE = 'exchange';
34+
3435
public const STATUS_TRANSFER = 'transfer';
36+
3537
public const STATUS_PAID = 'paid';
38+
3639
public const STATUS_REFUND = 'refund';
40+
3741
public const STATUS_GIFT = 'gift';
3842

3943
/**

Diff for: src/Objects/Cart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,6 @@ public function getBasketDto(): BasketDtoInterface
139139

140140
private function productId(ProductInterface $product): string
141141
{
142-
return $product::class.':'.$this->castService->getModel($product)->getKey();
142+
return $product::class . ':' . $this->castService->getModel($product)->getKey();
143143
}
144144
}

Diff for: src/Services/AtomicService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ private function key(Wallet $object): string
4141
{
4242
$wallet = $this->castService->getWallet($object);
4343

44-
return self::PREFIX.'::'.$wallet::class.'::'.$wallet->uuid;
44+
return self::PREFIX . '::' . $wallet::class . '::' . $wallet->uuid;
4545
}
4646
}

Diff for: src/Services/BookkeeperService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ public function increase(Wallet $wallet, float|int|string $value): string
6363

6464
private function getKey(Wallet $wallet): string
6565
{
66-
return __CLASS__.'::'.$wallet->uuid;
66+
return __CLASS__ . '::' . $wallet->uuid;
6767
}
6868
}

Diff for: src/Services/RegulatorService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ private function persist(Wallet $wallet): void
129129

130130
private function getKey(string $uuid): string
131131
{
132-
return $this->idempotentKey.'::'.$uuid;
132+
return $this->idempotentKey . '::' . $uuid;
133133
}
134134
}

Diff for: src/Traits/CartPay.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function payCart(CartInterface $cart, bool $force = false): array
128128
$assistantService = app(AssistantServiceInterface::class);
129129
foreach ($cart->getBasketDto()->items() as $item) {
130130
foreach ($item->getItems() as $product) {
131-
$productId = $product::class.':'.$castService->getModel($product)->getKey();
131+
$productId = $product::class . ':' . $castService->getModel($product)->getKey();
132132
$pricePerItem = $item->getPricePerItem();
133133
if ($pricePerItem === null) {
134134
$prices[$productId] ??= $product->getAmountProduct($this);

Diff for: src/WalletServiceProvider.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,24 @@ final class WalletServiceProvider extends ServiceProvider
109109
*/
110110
public function boot(): void
111111
{
112-
$this->loadTranslationsFrom(dirname(__DIR__).'/resources/lang', 'wallet');
112+
$this->loadTranslationsFrom(dirname(__DIR__) . '/resources/lang', 'wallet');
113113

114114
if (!$this->app->runningInConsole()) {
115115
return;
116116
}
117117

118118
if ($this->shouldMigrate()) {
119-
$this->loadMigrationsFrom([dirname(__DIR__).'/database']);
119+
$this->loadMigrationsFrom([dirname(__DIR__) . '/database']);
120120
}
121121

122122
if (function_exists('config_path')) {
123123
$this->publishes([
124-
dirname(__DIR__).'/config/config.php' => config_path('wallet.php'),
124+
dirname(__DIR__) . '/config/config.php' => config_path('wallet.php'),
125125
], 'laravel-wallet-config');
126126
}
127127

128128
$this->publishes([
129-
dirname(__DIR__).'/database/' => database_path('migrations'),
129+
dirname(__DIR__) . '/database/' => database_path('migrations'),
130130
], 'laravel-wallet-migrations');
131131
}
132132

@@ -135,7 +135,7 @@ public function boot(): void
135135
*/
136136
public function register(): void
137137
{
138-
$this->mergeConfigFrom(dirname(__DIR__).'/config/config.php', 'wallet');
138+
$this->mergeConfigFrom(dirname(__DIR__) . '/config/config.php', 'wallet');
139139
$this->commands([TransferFixCommand::class]);
140140

141141
$configure = config('wallet', []);

Diff for: tests/Infra/Listeners/WalletCreatedThrowListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function handle(WalletCreatedEventInterface $walletCreatedEvent): void
1818
->format(DateTimeInterface::ATOM)
1919
;
2020

21-
$message = hash('sha256', $holderType.$uuid.$createdAt);
21+
$message = hash('sha256', $holderType . $uuid . $createdAt);
2222
$code = $walletCreatedEvent->getWalletId() + $walletCreatedEvent->getHolderId();
2323
assert($code > 1);
2424

Diff for: tests/Infra/Models/ItemMaxTax.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88

99
class ItemMaxTax extends Item implements MaximalTaxable
1010
{
11-
/**
12-
* {@inheritdoc}
13-
*/
1411
public function getTable(): string
1512
{
1613
return 'items';
1714
}
1815

19-
/**
20-
* {@inheritdoc}
21-
*/
16+
2217
public function getFeePercent(): float
2318
{
2419
return 3;

Diff for: tests/Infra/Models/ItemMinTax.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88

99
class ItemMinTax extends Item implements MinimalTaxable
1010
{
11-
/**
12-
* {@inheritdoc}
13-
*/
1411
public function getTable(): string
1512
{
1613
return 'items';
1714
}
1815

19-
/**
20-
* {@inheritdoc}
21-
*/
16+
2217
public function getFeePercent(): float
2318
{
2419
return 3;

Diff for: tests/Infra/PackageModels/Transaction.php

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
*/
1212
class Transaction extends \Bavix\Wallet\Models\Transaction
1313
{
14-
/**
15-
* {@inheritdoc}
16-
*/
1714
public function getFillable(): array
1815
{
1916
return array_merge($this->fillable, ['bank_method']);

Diff for: tests/Infra/TestServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ final class TestServiceProvider extends ServiceProvider
1010
{
1111
public function boot(): void
1212
{
13-
$this->loadMigrationsFrom([dirname(__DIR__).'/migrations']);
13+
$this->loadMigrationsFrom([dirname(__DIR__) . '/migrations']);
1414
}
1515
}

Diff for: tests/Units/Domain/EventTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testWalletCreatedThrowListener(): void
9393
$uuid = $buyer->wallet->uuid;
9494
$createdAt = app(ClockServiceInterface::class)->now()->format(DateTimeInterface::ATOM);
9595

96-
$message = hash('sha256', $holderType.$uuid.$createdAt);
96+
$message = hash('sha256', $holderType . $uuid . $createdAt);
9797

9898
// unit
9999
$this->expectException(UnknownEventException::class);

Diff for: tests/Units/Domain/MultiWalletTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ public function testMultiWalletTransactionState(): void
587587
$wallets = [];
588588
foreach (range(1, 10) as $item) {
589589
$wallets[] = $user->createWallet([
590-
'name' => 'index'.$item,
590+
'name' => 'index' . $item,
591591
]);
592592
}
593593

Diff for: tests/Units/Domain/TransactionsFilterTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ public function testPagination2(): void
155155
$query = Transaction::query()
156156
->where(function ($query) use ($buyer, $walletTableName, $transactionTableName) {
157157
$query->where('payable_id', '=', $buyer->getKey())
158-
->join($walletTableName, $transactionTableName.'.wallet_id', '=', $walletTableName.'.id')
159-
->select($transactionTableName.'.*', $walletTableName.'.name')
158+
->join($walletTableName, $transactionTableName . '.wallet_id', '=', $walletTableName . '.id')
159+
->select($transactionTableName . '.*', $walletTableName . '.name')
160160
->get()
161161
;
162162
})

Diff for: tests/Units/Domain/WalletFloatTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ public function testBitcoin(): void
297297
}
298298
});
299299

300-
self::assertSame($user->balance, '256'.str_repeat('0', 32 - 8));
300+
self::assertSame($user->balance, '256' . str_repeat('0', 32 - 8));
301301
self::assertSame(0, $math->compare($user->balanceFloat, '0.00000256'));
302302

303-
$user->deposit(256 .str_repeat('0', 32));
304-
$user->depositFloat('0.'.str_repeat('0', 31).'1');
303+
$user->deposit(256 . str_repeat('0', 32));
304+
$user->depositFloat('0.' . str_repeat('0', 31) . '1');
305305

306306
[$q, $r] = explode('.', $user->balanceFloat, 2);
307307
self::assertSame(strlen($r), $user->wallet->decimal_places);

0 commit comments

Comments
 (0)