| @@ 21-63 (lines=43) @@ | ||
| 18 | * @internal |
|
| 19 | */ |
|
| 20 | // private |
|
| 21 | final class RpcRequestMock implements RequestInterface |
|
| 22 | { |
|
| 23 | /** @var string */ |
|
| 24 | private $method; |
|
| 25 | /** @var \stdClass|\stdClass[]|null */ |
|
| 26 | private $parameters; |
|
| 27 | /** @var ParameterBag */ |
|
| 28 | private $attributes; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * RpcRequestMock constructor. |
|
| 32 | * |
|
| 33 | * @param string $method |
|
| 34 | * @param null|\stdClass|\stdClass[] $parameters |
|
| 35 | * @param ParameterBag $attributes |
|
| 36 | */ |
|
| 37 | public function __construct($method, $parameters, ParameterBag $attributes) |
|
| 38 | { |
|
| 39 | $this->method = $method; |
|
| 40 | $this->parameters = $parameters; |
|
| 41 | $this->attributes = $attributes; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @return ParameterBag |
|
| 46 | */ |
|
| 47 | public function getAttributes() |
|
| 48 | { |
|
| 49 | return $this->attributes; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** @return string */ |
|
| 53 | public function getMethod() |
|
| 54 | { |
|
| 55 | return $this->parameters; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** @return \stdClass|\stdClass[]|null */ |
|
| 59 | public function getParameters() |
|
| 60 | { |
|
| 61 | return $this->method; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 14-54 (lines=41) @@ | ||
| 11 | use Bankiru\Api\Rpc\Http\RequestInterface; |
|
| 12 | use Symfony\Component\HttpFoundation\ParameterBag; |
|
| 13 | ||
| 14 | class RequestImpl implements RequestInterface |
|
| 15 | { |
|
| 16 | /** @var ParameterBag */ |
|
| 17 | private $attributes; |
|
| 18 | /** @var string */ |
|
| 19 | private $method; |
|
| 20 | /** @var array|\stdClass */ |
|
| 21 | private $parameters; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * RequestImpl constructor. |
|
| 25 | * |
|
| 26 | * @param ParameterBag $attributes |
|
| 27 | * @param string $method |
|
| 28 | * @param array|\stdClass $parameters |
|
| 29 | */ |
|
| 30 | public function __construct($method, $parameters, ParameterBag $attributes = null) |
|
| 31 | { |
|
| 32 | $this->attributes = $attributes ?: new ParameterBag(); |
|
| 33 | $this->method = $method; |
|
| 34 | $this->parameters = $parameters; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** {@inheritdoc} */ |
|
| 38 | public function getAttributes() |
|
| 39 | { |
|
| 40 | return $this->attributes; |
|
| 41 | } |
|
| 42 | ||
| 43 | /** {@inheritdoc} */ |
|
| 44 | public function getMethod() |
|
| 45 | { |
|
| 46 | return $this->method; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** {@inheritdoc} */ |
|
| 50 | public function getParameters() |
|
| 51 | { |
|
| 52 | return $this->parameters; |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||