| 1 | <?php |
||
| 18 | abstract class AbstractEventHandler implements EventHandler |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | * |
||
| 23 | * @throws InvalidEventException |
||
| 24 | */ |
||
| 25 | final public function handle(Event $event): void |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Is event supported. |
||
| 40 | * |
||
| 41 | * @param Event $event |
||
| 42 | * |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | private function isEventSupported(Event $event): bool |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get supported event type. |
||
| 62 | * |
||
| 63 | * @return string[] |
||
| 64 | */ |
||
| 65 | abstract protected function getSupportedEventTypes(): array; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Handle event. |
||
| 69 | * |
||
| 70 | * @param Event $event |
||
| 71 | */ |
||
| 72 | abstract protected function handleEvent(Event $event): void; |
||
| 73 | } |
||
| 74 |