| @@ 11-48 (lines=38) @@ | ||
| 8 | /** |
|
| 9 | * @Handler("ApiClients\Foundation\Transport\CommandBus\Handler\RequestHandler") |
|
| 10 | */ |
|
| 11 | final class RequestCommand implements RequestCommandInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var RequestInterface |
|
| 15 | */ |
|
| 16 | private $request; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var array |
|
| 20 | */ |
|
| 21 | private $options; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @param RequestInterface $request |
|
| 25 | * @param array $options |
|
| 26 | */ |
|
| 27 | public function __construct(RequestInterface $request, array $options = []) |
|
| 28 | { |
|
| 29 | $this->request = $request; |
|
| 30 | $this->options = $options; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return RequestInterface |
|
| 35 | */ |
|
| 36 | public function getRequest(): RequestInterface |
|
| 37 | { |
|
| 38 | return $this->request; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return array |
|
| 43 | */ |
|
| 44 | public function getOptions(): array |
|
| 45 | { |
|
| 46 | return $this->options; |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 12-52 (lines=41) @@ | ||
| 9 | /** |
|
| 10 | * @Handler("ApiClients\Foundation\Transport\CommandBus\Handler\RequestHandler") |
|
| 11 | */ |
|
| 12 | final class SimpleRequestCommand implements RequestCommandInterface |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @var RequestInterface |
|
| 16 | */ |
|
| 17 | private $request; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @var array |
|
| 21 | */ |
|
| 22 | private $options; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @param string $path |
|
| 26 | * @param array $options |
|
| 27 | */ |
|
| 28 | public function __construct(string $path, array $options = []) |
|
| 29 | { |
|
| 30 | $this->request = new Request( |
|
| 31 | 'GET', |
|
| 32 | $path |
|
| 33 | ); |
|
| 34 | $this->options = $options; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return RequestInterface |
|
| 39 | */ |
|
| 40 | public function getRequest(): RequestInterface |
|
| 41 | { |
|
| 42 | return $this->request; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @return array |
|
| 47 | */ |
|
| 48 | public function getOptions(): array |
|
| 49 | { |
|
| 50 | return $this->options; |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 11-48 (lines=38) @@ | ||
| 8 | /** |
|
| 9 | * @Handler("ApiClients\Foundation\Transport\CommandBus\Handler\StreamingRequestHandler") |
|
| 10 | */ |
|
| 11 | final class StreamingRequestCommand implements RequestCommandInterface |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var RequestInterface |
|
| 15 | */ |
|
| 16 | private $request; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var array |
|
| 20 | */ |
|
| 21 | private $options; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @param RequestInterface $request |
|
| 25 | * @param array $options |
|
| 26 | */ |
|
| 27 | public function __construct(RequestInterface $request, array $options = []) |
|
| 28 | { |
|
| 29 | $this->request = $request; |
|
| 30 | $this->options = $options; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return RequestInterface |
|
| 35 | */ |
|
| 36 | public function getRequest(): RequestInterface |
|
| 37 | { |
|
| 38 | return $this->request; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return array |
|
| 43 | */ |
|
| 44 | public function getOptions(): array |
|
| 45 | { |
|
| 46 | return $this->options; |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||