Skip to content

Commit

Permalink
#5 Everything renamed again. Now the event handling system seems to b…
Browse files Browse the repository at this point in the history
…e coherent.
  • Loading branch information
automatix committed Apr 29, 2018
1 parent 3dc6253 commit 04fa534
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 49 deletions.
17 changes: 8 additions & 9 deletions config/dependencies/common.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

use App\Base\Utils\CamelCaseToSnakeCaseNameConverter;
use App\Base\Utils\NameConverterInterface;
use App\Process\EventHandlerInterface;
use App\Process\Listeners\PoiListener;
use App\Process\Listeners\QuestListener;
use App\Process\Listeners\StepListener;
use App\Process\EventHandler;
use App\Process\ProcessEventHandlers\PoiHandler;
use App\Process\ProcessEventHandlers\QuestHandler;
use App\Process\ProcessEventHandlers\StepHandler;
use App\Process\SystemEventHandler;
use App\Services\Dummy\External\FooBService;
use App\Services\Dummy\External\FooServiceInterface;
use App\Services\Dummy\Internal\BarService;
Expand Down Expand Up @@ -36,16 +35,16 @@
return EntityManager::create($connection, $config);
},
StateManagingServiceInterface::class => DI\autowire(StateManagingServiceInterface::class),
'process_listener.step' => DI\autowire(StepListener::class),
'process_listener.poi' => DI\autowire(PoiListener::class),
'process_listener.quest' => DI\autowire(QuestListener::class),
'process_listener.step' => DI\autowire(StepHandler::class),
'process_listener.poi' => DI\autowire(PoiHandler::class),
'process_listener.quest' => DI\autowire(QuestHandler::class),
EventHandlerInterface::class => DI\factory(function(ContainerInterface $container) {
$listeners = [
'process_listener.step',
'process_listener.poi',
'process_listener.quest',
];
return new EventHandler($container->get(StateManagingServiceInterface::class), $listeners);
return new SystemEventHandler($container->get(StateManagingServiceInterface::class), $listeners);
}),

];
Expand Down
8 changes: 4 additions & 4 deletions src/Interop/Website/Controller/QuestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class QuestController extends Controller

/** @var StateManagingServiceInterface $stateManagingService */
private $stateManagingService;
/** @var EventHandlerInterface $eventHandler */
private $eventHandler;
/** @var EventHandlerInterface $systemEventHandler */
private $systemEventHandler;
/** @var EventDispatcherInterface */
private $eventDispatcher;

Expand All @@ -32,14 +32,14 @@ public function __construct(
EventDispatcherInterface $eventDispatcher
) {
$this->stateManagingService = $stateManagingService;
$this->eventHandler = $processHandlingService;
$this->systemEventHandler = $processHandlingService;
$this->eventDispatcher = $eventDispatcher;
}

public function processUserMessageAction(Request $request)
{
$message = $request->get('message');
$this->eventHandler->handle(new GenericEvent($message), GeneralEventName::USER_MESSAGE_RECEIVED(), $this->eventDispatcher);
$this->systemEventHandler->handle(new GenericEvent($message), GeneralEventName::USER_MESSAGE_RECEIVED(), $this->eventDispatcher);

return new Response();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
namespace App\Process\Listeners;
namespace App\Process\ProcessEventHandlers;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Base\Enums\Processes\States\AbstractProcessState;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\StateHandlerInterface;
use App\Services\Process\StateManagingServiceInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use App\Base\Utils\NameConverterInterface;

abstract class AbstractProcessListener implements StateHandlerInterface
abstract class AbstractProcessEventHandler implements StateHandlerInterface
{

const RELEVANT_STATE_HANDLER_NAMESPACE = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace App\Process\Listeners;
namespace App\Process\ProcessEventHandlers;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Base\Enums\Processes\States\AbstractProcessState;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class PoiListener extends AbstractProcessListener
class PoiHandler extends AbstractProcessEventHandler
{

const RELEVANT_STATE_HANDLER_NAMESPACE = '\App\Services\Process\Internal\StateHandlers\Poi';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace App\Process\Listeners;
namespace App\Process\ProcessEventHandlers;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Base\Enums\Processes\States\AbstractProcessState;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class QuestListener extends AbstractProcessListener
class QuestHandler extends AbstractProcessEventHandler
{

const RELEVANT_STATE_HANDLER_NAMESPACE = '\App\Services\Process\Internal\StateHandlers\Quest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
namespace App\Process\Listeners;
namespace App\Process\ProcessEventHandlers;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Base\Enums\Processes\States\AbstractProcessState;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class StepListener extends AbstractProcessListener
class StepHandler extends AbstractProcessEventHandler
{

const RELEVANT_STATE_HANDLER_NAMESPACE = '\App\Services\Process\Internal\StateHandlers\Step';
Expand Down
7 changes: 7 additions & 0 deletions src/Process/StateEventHandlers/AbstractStateEventHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
namespace App\Process\StateEventHandlers;

abstract class AbstractStateEventHandler implements StateHandlerInterface
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class AccessFailedHandler implements StateHandlerInterface
* Class AccessFailedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class AccessFailedHandler implements StateHandlerInterface
class AccessFailedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class AccessProcessingHandler implements StateHandlerInterface
* Class AccessProcessingHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class AccessProcessingHandler implements StateHandlerInterface
class AccessProcessingHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class CompletedHandler implements StateHandlerInterface
* Class CompletedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class CompletedHandler implements StateHandlerInterface
class CompletedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class FinishedHandler implements StateHandlerInterface
* Class FinishedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class FinishedHandler implements StateHandlerInterface
class FinishedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class PlayingHandler implements StateHandlerInterface
* Class PlayingHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class PlayingHandler implements StateHandlerInterface
class PlayingHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Poi;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class StartedHandler implements StateHandlerInterface
* Class StartedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class StartedHandler implements StateHandlerInterface
class StartedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class StartedHandler implements StateHandlerInterface
* Class StartedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class StartedHandler implements StateHandlerInterface
class StartedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
namespace App\Services\Process\Internal\StateHandlers\Quest;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\AbstractStateEventHandler;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* Class StartedHandler implements StateHandlerInterface
* Class StartedHandler extends AbstractStateEventHandler
*
* @package App\Services\Process\Internal\StateHandlers\Quest
* @author Ilya Khanataev <[email protected]>
*/
class StartedHandler implements StateHandlerInterface
class StartedHandler extends AbstractStateEventHandler
{

public function handle(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace App\Process\StateHandlers;
namespace App\Process\StateEventHandlers;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use Symfony\Component\EventDispatcher\Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
namespace App\Process;

use App\Base\Enums\Processes\EventNames\AbstractEventName;
use App\Process\StateHandlers\StateHandlerInterface;
use App\Process\StateEventHandlers\StateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class EventHandler implements EventHandlerInterface
class SystemEventHandler implements EventHandlerInterface
{

/** @var StateHandlerInterface[] */
Expand Down

0 comments on commit 04fa534

Please sign in to comment.