@@ 55-70 (lines=16) @@ | ||
52 | /** |
|
53 | * {@inheritdoc} |
|
54 | */ |
|
55 | public function dispatch(MessageInterface $query) |
|
56 | { |
|
57 | if (!$query instanceof QueryInterface) { |
|
58 | throw new \InvalidArgumentException( |
|
59 | sprintf( |
|
60 | 'The object must be an instance of %s. Instance of %s given', |
|
61 | QueryInterface::class, |
|
62 | get_class($query) |
|
63 | ) |
|
64 | ); |
|
65 | } |
|
66 | ||
67 | $this->ensureQueryHandlerMiddleware(); |
|
68 | ||
69 | return parent::dispatch($query); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * Ensure that exists an query handler middleware. |
@@ 58-73 (lines=16) @@ | ||
55 | /** |
|
56 | * {@inheritdoc} |
|
57 | */ |
|
58 | public function dispatch(MessageInterface $command) |
|
59 | { |
|
60 | if (!$command instanceof CommandInterface) { |
|
61 | throw new \InvalidArgumentException( |
|
62 | sprintf( |
|
63 | 'The object must be an instance of %s. Instance of %s given', |
|
64 | CommandInterface::class, |
|
65 | get_class($command) |
|
66 | ) |
|
67 | ); |
|
68 | } |
|
69 | ||
70 | $this->ensureCommandHandlerMiddleware(); |
|
71 | ||
72 | parent::dispatch($command); |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Ensure that exists an command handler middleware. |