| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class SymfonyJsonRpcServerDispatcher implements JsonRpcServerDispatcherInterface |
||
| 13 | { |
||
| 14 | /** @var EventDispatcherInterface */ |
||
| 15 | private $symfonyEventDispatcher; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param EventDispatcherInterface $symfonyEventDispatcher |
||
| 19 | */ |
||
| 20 | 3 | public function __construct(EventDispatcherInterface $symfonyEventDispatcher) |
|
| 21 | { |
||
| 22 | 3 | $this->symfonyEventDispatcher = $symfonyEventDispatcher; |
|
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string|null $eventName |
||
| 27 | * @param JsonRpcServerEvent $event |
||
| 28 | */ |
||
| 29 | 2 | public function dispatchJsonRpcEvent(string $eventName, JsonRpcServerEvent $event = null) : void |
|
| 30 | { |
||
| 31 | 2 | $this->symfonyEventDispatcher->dispatch( |
|
| 32 | 2 | $event ? new SymfonyJsonRpcServerEvent($event) : new \stdClass(), |
|
| 33 | 2 | $eventName |
|
| 34 | 2 | ); |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param string $eventName |
||
| 39 | * @param callable $listener |
||
| 40 | * @param int $priority Default to 0 |
||
| 41 | */ |
||
| 42 | 1 | public function addJsonRpcListener(string $eventName, $listener, $priority = 0) : void |
|
| 45 | } |
||
| 46 | } |
||
| 47 |