Skip to content

Commit

Permalink
#5 A draft for the event handling mechanism.
Browse files Browse the repository at this point in the history
  • Loading branch information
automatix committed Apr 22, 2018
1 parent afa21ec commit db0e122
Show file tree
Hide file tree
Showing 24 changed files with 480 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Base/Enums/AbstractProcessEventType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace App\Base\Enums;

/**
*/
abstract class AbstractProcessEventType extends AbstractEnum
{

}
9 changes: 9 additions & 0 deletions src/Base/Enums/AbstractProcessState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace App\Base\Enums;

/**
*/
abstract class AbstractProcessState extends AbstractEnum
{

}
12 changes: 12 additions & 0 deletions src/Base/Enums/PoiState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace App\Base\Enums;

/**
* @method static QuestState STARTED()
*/
class PoiState extends AbstractProcessState
{

const STARTED = 'started';

}
20 changes: 20 additions & 0 deletions src/Base/Enums/QuestState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
namespace App\Base\Enums;

/**
* @method static QuestState STARTED()
* @method static QuestState PLAYING()
* @method static QuestState PAUSED()
* @method static QuestState FINISHED()
* @method static QuestState ENDED()
*/
class QuestState extends AbstractProcessState
{

const STARTED = 'started';
const PLAYING = 'playing';
const PAUSED = 'paused';
const FINISHED = 'finished';
const ENDED = 'ended';

}
12 changes: 12 additions & 0 deletions src/Base/Enums/StepState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace App\Base\Enums;

/**
* @method static QuestState STARTED()
*/
class StepState extends AbstractProcessState
{

const STARTED = 'started';

}
9 changes: 9 additions & 0 deletions src/Process/EventInStateHandlerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
namespace App\Process;

interface EventInStateHandlerInterface extends ResponsibleForEventInerface, StateHandlerInterface
{



}
12 changes: 12 additions & 0 deletions src/Process/EventListenerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace App\Process;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

interface EventListenerInterface
{

function handle(Event $event, string $eventName, EventDispatcherInterface $eventDispatcher);

}
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/AccessFailedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/AccessProcessingHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/CompletedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
Empty file.
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/FinishedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/PlayingHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/Poi/StartedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventName,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/Poi/Step/StartedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventName,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
33 changes: 33 additions & 0 deletions src/Process/Handlers/Quest/StartedHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Process\Internal\Handlers\Quest;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\EventInStateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

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

function isResponsibleFor(AbstractProcessEventType $processEvent)
{
// TODO: Implement isResponsibleFor() method.
}

function handle(
AbstractProcessState $processState,
Event $event,
string $eventType,
EventDispatcherInterface $eventDispatcher
) {
// TODO: Implement handle() method.
}

}
18 changes: 18 additions & 0 deletions src/Process/Listeners/PoiHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace App\Process\Listeners;

use App\Base\Enums\AbstractProcessEventType;
use App\Base\Enums\AbstractProcessState;
use App\Process\StateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class PoiHandler implements StateHandlerInterface
{

public function handle(AbstractProcessState $processState, Event $event, AbstractProcessEventType $eventType, EventDispatcherInterface $eventDispatcher)
{
// TODO: Implement handle() method.
}

}
17 changes: 17 additions & 0 deletions src/Process/Listeners/QuestHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
namespace App\Process\Listeners;

use App\Base\Enums\AbstractProcessState;
use App\Process\StateHandlerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class QuestHandler implements StateHandlerInterface
{

public function handle(AbstractProcessState $processState, Event $event, string $eventType, EventDispatcherInterface $eventDispatcher)
{
// TODO: Implement handle() method.
}

}
Loading

0 comments on commit db0e122

Please sign in to comment.