| Total Complexity | 4 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 12 | final class Core implements CoreInterface, HandlerInterface |
|
|
|
|||
| 26 | { |
||
| 27 | public function __construct( |
||
| 28 | private readonly HandlerRegistryInterface $registry, |
||
| 29 | 12 | private readonly ?EventDispatcherInterface $dispatcher = null |
|
| 30 | ) { |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | 10 | * @param-assert TParameters $parameters |
|
| 35 | * @deprecated |
||
| 36 | 10 | */ |
|
| 37 | 10 | public function callAction(string $controller, string $action, array $parameters = []): mixed |
|
| 38 | 10 | { |
|
| 39 | \assert(\is_string($parameters['driver'])); |
||
| 40 | 10 | \assert(\is_string($parameters['queue'])); |
|
| 41 | \assert(\is_string($parameters['id'])); |
||
| 42 | |||
| 43 | 10 | $this->dispatchEvent(JobProcessing::class, $controller, $parameters); |
|
| 44 | 10 | ||
| 45 | 10 | /** @psalm-suppress TooManyArguments */ |
|
| 46 | $this->registry |
||
| 47 | 10 | ->getHandler($controller) |
|
| 48 | ->handle($controller, $parameters['id'], $parameters['payload'], $parameters['headers'] ?? []); |
||
| 49 | 10 | ||
| 50 | $this->dispatchEvent(JobProcessed::class, $controller, $parameters); |
||
| 51 | |||
| 52 | return null; |
||
| 53 | } |
||
| 54 | |||
| 55 | public function handle(CallContext $context): mixed |
||
| 56 | 10 | { |
|
| 57 | $args = $context->getArguments(); |
||
| 58 | 10 | $controller = $context->getTarget()->getPath()[0]; |
|
| 59 | 10 | $action = $context->getTarget()->getPath()[1]; |
|
| 60 | 10 | ||
| 61 | 10 | return $this->callAction($controller, $action, $args); |
|
| 62 | 10 | } |
|
| 63 | 10 | ||
| 64 | 10 | /** |
|
| 65 | 10 | * @param class-string $event |
|
| 66 | * @param-assert TParameters $parameters |
||
| 67 | */ |
||
| 68 | private function dispatchEvent(string $event, string $name, array $parameters): void |
||
| 77 | )); |
||
| 78 | } |
||
| 79 | } |
||
| 80 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.