Skip to content

Commit

Permalink
formating
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick in t Veld committed Aug 22, 2024
1 parent 2c48f2b commit e379425
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 77 deletions.
11 changes: 5 additions & 6 deletions src/Action/Account/FetchAccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ public function __construct(
private AccountRepository $accountRepository,
private EventDispatcherInterface $eventBus,
private MyFxBookRepositoryInterface $myFxBookRepository
) {
}
) {}

public function __invoke(AggregateInterface $aggregator): void
{
$myFxBookAccounts = $this->myFxBookRepository->accounts($aggregator->getSession());

if (count($myFxBookAccounts) > 0) {
array_map(fn ($account) => $this->eventBus->dispatch(new CreateAccountEvent($account)), $myFxBookAccounts);
}

if (empty($myFxBookAccounts)) {
throw new AccountNotFoundException();
}

if (count($myFxBookAccounts) > 0) {

Check failure on line 32 in src/Action/Account/FetchAccounts.php

View workflow job for this annotation

GitHub Actions / lint

Comparison operation ">" between int<1, max> and 0 is always true.
array_map(fn($account) => $this->eventBus->dispatch(new CreateAccountEvent($account)), $myFxBookAccounts);
}

$accounts = $this->accountRepository->findAll();

foreach ($accounts as $account) {
Expand Down
4 changes: 2 additions & 2 deletions src/Action/Account/FetchTradingAccounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
public function __construct(
private EventDispatcherInterface $eventBus,
private MyFxBookRepositoryInterface $myFxBookRepository
) {
}
) {}

public function __invoke(AggregateInterface $aggregator): void
{
Expand All @@ -27,6 +26,7 @@ public function __invoke(AggregateInterface $aggregator): void
throw new AccountNotFoundException();
}


foreach ($accounts as $account) {
$this->eventBus->dispatch(new CreateAccountEvent($account));
}
Expand Down
5 changes: 2 additions & 3 deletions src/Action/Account/FetchUserSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@

final readonly class FetchUserSession implements ActionInterface
{
public function __construct(private UserRepository $userRepository)
{
}
public function __construct(private UserRepository $userRepository) {}

public function __invoke(AggregateInterface $aggregator): void
{
$user = $this->userRepository->findLatest();


if (null === $user || null === $user->getSession()) {
throw new SessionNotFoundException();
}
Expand Down
4 changes: 1 addition & 3 deletions src/Action/Download/FileDownloadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

final readonly class FileDownloadAction implements ActionInterface
{
public function __construct(private FileDownloadManager $fileDownloadManager)
{
}
public function __construct(private FileDownloadManager $fileDownloadManager) {}

public function __invoke(AggregateInterface $aggregator): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/Action/FileSystem/CreateCsvFileAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

final readonly class CreateCsvFileAction implements ActionInterface
{
public function __construct(private Serializer $serializer)
{
}
public function __construct(private Serializer $serializer) {}

public function __invoke(AggregateInterface $aggregator): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/ActionHandler/AccountActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\ActionHandler;

final class AccountActionHandler extends ActionHandler
{
}
final class AccountActionHandler extends ActionHandler {}
5 changes: 2 additions & 3 deletions src/ActionHandler/ActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public function __construct(
private array $actions,
private readonly CircuitBreakerInterface $circuitBreaker,
private readonly LoggerInterface $logger
) {
}
) {}

public function preHook(ActionInterface $action): void
{
Expand All @@ -36,7 +35,7 @@ public function __invoke(AggregateInterface $aggregate): void
foreach ($this->actions as $action) {
$this->logger->info(sprintf('Executing: %s', get_class($action)));

$this->circuitBreaker->execute(fn () => $action($aggregate));
$this->circuitBreaker->execute(fn() => $action($aggregate));
}
}
}
4 changes: 1 addition & 3 deletions src/ActionHandler/DailyDataActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\ActionHandler;

final class DailyDataActionHandler extends ActionHandler
{
}
final class DailyDataActionHandler extends ActionHandler {}
4 changes: 1 addition & 3 deletions src/ActionHandler/DailyGainsActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\ActionHandler;

final class DailyGainsActionHandler extends ActionHandler
{
}
final class DailyGainsActionHandler extends ActionHandler {}
4 changes: 1 addition & 3 deletions src/ActionHandler/HistoryActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\ActionHandler;

final class HistoryActionHandler extends ActionHandler
{
}
final class HistoryActionHandler extends ActionHandler {}
4 changes: 1 addition & 3 deletions src/ActionHandler/WidgetActionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\ActionHandler;

final class WidgetActionHandler extends ActionHandler
{
}
final class WidgetActionHandler extends ActionHandler {}
4 changes: 1 addition & 3 deletions src/Dto/Aggregator/DailyDataAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Dto\Aggregator;

class DailyDataAggregator extends AggregateRoot
{
}
class DailyDataAggregator extends AggregateRoot {}
4 changes: 1 addition & 3 deletions src/Dto/Aggregator/DailyGainsAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Dto\Aggregator;

class DailyGainsAggregator extends AggregateRoot
{
}
class DailyGainsAggregator extends AggregateRoot {}
4 changes: 1 addition & 3 deletions src/Dto/Aggregator/HistoryAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Dto\Aggregator;

class HistoryAggregator extends AggregateRoot
{
}
class HistoryAggregator extends AggregateRoot {}
4 changes: 1 addition & 3 deletions src/Dto/Aggregator/WidgetAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace App\Dto\Aggregator;

class WidgetAggregator extends AggregateRoot
{
}
class WidgetAggregator extends AggregateRoot {}
4 changes: 1 addition & 3 deletions src/Event/CreateAccountEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ final class CreateAccountEvent extends Event
/**
* @param array<mixed> $account
*/
public function __construct(public readonly array $account)
{
}
public function __construct(public readonly array $account) {}
}
4 changes: 1 addition & 3 deletions src/Event/LoginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@

final class LoginEvent extends Event
{
public function __construct(public readonly LoginCredentials $loginCredentials)
{
}
public function __construct(public readonly LoginCredentials $loginCredentials) {}
}
4 changes: 1 addition & 3 deletions src/Event/LogoutEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@

class LogoutEvent extends Event
{
public function __construct(public readonly User $user)
{
}
public function __construct(public readonly User $user) {}
}
4 changes: 1 addition & 3 deletions src/Event/UpdateAccountEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ class UpdateAccountEvent extends Event
/**
* @param array<mixed> $accountData
*/
public function __construct(public readonly Account $account, public readonly array $accountData)
{
}
public function __construct(public readonly Account $account, public readonly array $accountData) {}
}
3 changes: 1 addition & 2 deletions src/Manager/ActionHandlerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
private readonly ActionHandlerInterface $dailyDataActionHandler,
private readonly ActionHandlerInterface $dailyGainActionHandler,
private readonly ActionHandlerInterface $historyActionHandler
) {
}
) {}

public function __invoke(string $handler): ActionHandlerInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Presentation/Output/HistoryTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function setRows(array $rows): self
$numberOfRows = count($rows);

foreach ($rows as $accountHistory) {
$positions = array_filter($accountHistory, fn ($history) => 'Deposit' !== $history['action']);
$positions = array_filter($accountHistory, fn($history) => 'Deposit' !== $history['action']);

$positions = array_map(fn ($position) => [
$positions = array_map(fn($position) => [
'symbol' => $position['symbol'],
'lots' => $position['sizing']['value'],
'open' => $position['openPrice'],
Expand Down
2 changes: 1 addition & 1 deletion src/Presentation/Output/WidgetTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getRows(): array
*/
public function setRows(array $rows): self
{
$this->rows = array_map(fn ($row) => is_string($row) ? [$row] : $row, $rows);
$this->rows = array_map(fn($row) => is_string($row) ? [$row] : $row, $rows);

return $this;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Repository/Api/MyFxBookRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class MyFxBookRepository implements MyFxBookRepositoryInterface
public function __construct(
private readonly MyFxBookClient $client,
private readonly UriBuilder $uriBuilder
) {
}
) {}

public function accounts(string $session): array
{
Expand Down
3 changes: 1 addition & 2 deletions src/Subscriber/CreateAccountEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly EventDispatcherInterface $eventBus,
private readonly Serializer $serializer
) {
}
) {}

public function __invoke(CreateAccountEvent $event): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Subscriber/LoginEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ final class LoginEventListener
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly MyFxBookRepositoryInterface $myFxBookRepository
) {
}
) {}

public function __invoke(LoginEvent $event): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Subscriber/LogoutEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ final class LogoutEventListener
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly MyFxBookRepositoryInterface $myFxBookRepository,
) {
}
) {}

public function __invoke(LogoutEvent $event): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Subscriber/UpdateAccountEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class UpdateAccountEventListener
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly Serializer $serializer
) {
}
) {}

public function __invoke(UpdateAccountEvent $event): void
{
Expand Down
4 changes: 1 addition & 3 deletions src/ValueObject/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@

readonly class Session
{
public function __construct(public string $token)
{
}
public function __construct(public string $token) {}
}

0 comments on commit e379425

Please sign in to comment.