Skip to content

Commit

Permalink
Change the name of the action handler strategy class
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick in t Veld committed Aug 22, 2024
1 parent e379425 commit 111242a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 46 deletions.
84 changes: 45 additions & 39 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,69 @@ parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
resource: "../src/"
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- "../src/DependencyInjection/"
- "../src/Entity/"
- "../src/Kernel.php"

App\ActionHandler\DailyDataActionHandler:
arguments:
$actions: [
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Gain\FetchDailyData',
]
arguments:
$actions:
[
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Gain\FetchDailyData',
]

App\ActionHandler\DailyGainsActionHandler:
arguments:
$actions: [
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Gain\FetchDailyGain',
]
arguments:
$actions:
[
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Gain\FetchDailyGain',
]

App\ActionHandler\AccountActionHandler:
arguments:
$actions: [
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchAccounts',
]

$actions:
[
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchAccounts',
]

App\ActionHandler\WidgetActionHandler:
arguments:
$actions: [
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Presentation\ChartWidget',
]

$actions:
[
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Presentation\ChartWidget',
]

App\ActionHandler\HistoryActionHandler:
arguments:
$actions: [
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Order\History',
]
$actions:
[
'@App\Action\Account\FetchUserSession',
'@App\Action\Account\FetchTradingAccounts',
'@App\Action\Order\History',
]

App\Command\ExportCommand:
arguments:
$exportActions: [
'@App\Action\FileSystem\CreateCsvFileAction',
'@App\Action\Download\FileDownloadAction'
]
$postHooks:
[
'@App\Action\FileSystem\CreateCsvFileAction',
'@App\Action\Download\FileDownloadAction',
]

App\ActionHandler\ActionHandlerInterface $accountActionHandler: '@App\ActionHandler\AccountActionHandler'
App\ActionHandler\ActionHandlerInterface $dailyDataActionHandler: '@App\ActionHandler\DailyDataActionHandler'
Expand All @@ -76,4 +82,4 @@ services:
App\Presentation\Output\TableInterface $dailyDataTable: '@App\Presentation\Output\DailyDataTable'
App\Presentation\Output\TableInterface $dailyGainTable: '@App\Presentation\Output\DailyGainsTable'
App\Presentation\Output\TableInterface $historyTable: '@App\Presentation\Output\HistoryTable'
App\Presentation\Output\TableInterface $widgetTable: '@App\Presentation\Output\WidgetTable'
App\Presentation\Output\TableInterface $widgetTable: '@App\Presentation\Output\WidgetTable'
10 changes: 5 additions & 5 deletions src/Command/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Action\ActionInterface;
use App\ActionHandler\ActionHandler;
use App\Dto\Aggregator\AggregateRoot;
use App\Manager\ActionHandlerManager;
use App\Strategy\ActionHandlerStrategy;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
Expand All @@ -28,8 +28,8 @@ class ExportCommand extends Command
* @param array<ActionInterface> $exportActions
*/
public function __construct(

Check failure on line 30 in src/Command/ExportCommand.php

View workflow job for this annotation

GitHub Actions / lint

Method App\Command\ExportCommand::__construct() has parameter $postHooks with no value type specified in iterable type array.

Check failure on line 30 in src/Command/ExportCommand.php

View workflow job for this annotation

GitHub Actions / lint

PHPDoc tag @param references unknown parameter: $exportActions
private readonly ActionHandlerManager $actionHandlerManager,
private readonly array $exportActions
private readonly ActionHandlerStrategy $actionHandlerStrategy,
private readonly array $postHooks
) {
parent::__construct();
}
Expand All @@ -47,9 +47,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$aggregator = new AggregateRoot();

/** @var ActionHandler $actionHandler */
$actionHandler = ($this->actionHandlerManager)($handler);
$actionHandler = ($this->actionHandlerStrategy)($handler);

foreach ($this->exportActions as $action) {
foreach ($this->postHooks as $action) {
$actionHandler->postHook($action);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace App\Manager;
namespace App\Strategy;

use App\ActionHandler\ActionHandlerInterface;
use App\Exception\ClassNotFoundException;

class ActionHandlerManager
class ActionHandlerStrategy
{
public function __construct(
private readonly ActionHandlerInterface $dailyDataActionHandler,
Expand Down

0 comments on commit 111242a

Please sign in to comment.