@@ 7-59 (lines=53) @@ | ||
4 | ||
5 | use Psr\Http\Message\RequestInterface; |
|
6 | ||
7 | final class RequestCommand implements RequestCommandInterface |
|
8 | { |
|
9 | /** |
|
10 | * @var RequestInterface |
|
11 | */ |
|
12 | private $request; |
|
13 | ||
14 | /** |
|
15 | * @var array |
|
16 | */ |
|
17 | private $options; |
|
18 | ||
19 | /** |
|
20 | * @var bool |
|
21 | */ |
|
22 | private $refresh; |
|
23 | ||
24 | /** |
|
25 | * @param RequestInterface $request |
|
26 | * @param bool $refresh |
|
27 | * @param array $options |
|
28 | */ |
|
29 | public function __construct(RequestInterface $request, array $options = [], bool $refresh = false) |
|
30 | { |
|
31 | $this->request = $request; |
|
32 | $this->options = $options; |
|
33 | $this->refresh = $refresh; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * @return RequestInterface |
|
38 | */ |
|
39 | public function getRequest(): RequestInterface |
|
40 | { |
|
41 | return $this->request; |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * @return array |
|
46 | */ |
|
47 | public function getOptions(): array |
|
48 | { |
|
49 | return $this->options; |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * @return bool |
|
54 | */ |
|
55 | public function getRefresh(): bool |
|
56 | { |
|
57 | return $this->refresh; |
|
58 | } |
|
59 | } |
|
60 |
@@ 8-63 (lines=56) @@ | ||
5 | use GuzzleHttp\Psr7\Request; |
|
6 | use Psr\Http\Message\RequestInterface; |
|
7 | ||
8 | final class SimpleRequestCommand implements RequestCommandInterface |
|
9 | { |
|
10 | /** |
|
11 | * @var RequestInterface |
|
12 | */ |
|
13 | private $request; |
|
14 | ||
15 | /** |
|
16 | * @var array |
|
17 | */ |
|
18 | private $options; |
|
19 | ||
20 | /** |
|
21 | * @var bool |
|
22 | */ |
|
23 | private $refresh; |
|
24 | ||
25 | /** |
|
26 | * @param string $path |
|
27 | * @param bool $refresh |
|
28 | * @param array $options |
|
29 | */ |
|
30 | public function __construct(string $path, array $options = [], bool $refresh = false) |
|
31 | { |
|
32 | $this->request = new Request( |
|
33 | 'GET', |
|
34 | $path |
|
35 | ); |
|
36 | $this->options = $options; |
|
37 | $this->refresh = $refresh; |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * @return RequestInterface |
|
42 | */ |
|
43 | public function getRequest(): RequestInterface |
|
44 | { |
|
45 | return $this->request; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * @return array |
|
50 | */ |
|
51 | public function getOptions(): array |
|
52 | { |
|
53 | return $this->options; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @return bool |
|
58 | */ |
|
59 | public function getRefresh(): bool |
|
60 | { |
|
61 | return $this->refresh; |
|
62 | } |
|
63 | } |
|
64 |