1 | <?php |
||
7 | class Action implements ActionInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $method; |
||
13 | |||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $validMethods = [ |
||
18 | 'GET', |
||
19 | 'POST', |
||
20 | 'PUT', |
||
21 | 'DELETE', |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $endpoint; |
||
28 | |||
29 | /** |
||
30 | * @var string|null |
||
31 | */ |
||
32 | private $resourceKey; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | */ |
||
37 | private $responseKey; |
||
38 | |||
39 | /** |
||
40 | * Action constructor. |
||
41 | * @param string $method |
||
42 | * @param string $endpoint |
||
43 | * @param string|null $responseKey |
||
44 | * @param string|null $resourceKey |
||
45 | */ |
||
46 | 6 | public function __construct( |
|
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | 130 | public function getMethod() |
|
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | 130 | public function getEndpoint() |
|
73 | |||
74 | /** |
||
75 | * @return string|null |
||
76 | */ |
||
77 | 130 | public function getResourceKey() |
|
81 | |||
82 | /** |
||
83 | * @return string|null |
||
84 | */ |
||
85 | 130 | public function getResponseKey() |
|
89 | |||
90 | /** |
||
91 | * @param string $method |
||
92 | * @throws ClientException |
||
93 | */ |
||
94 | 6 | private function setMethod(string $method) |
|
110 | |||
111 | /** |
||
112 | * @param string $endpoint |
||
113 | */ |
||
114 | 5 | private function setEndpoint(string $endpoint) |
|
118 | |||
119 | /** |
||
120 | * @param string|null $resourceKey |
||
121 | */ |
||
122 | 5 | private function setResourceKey(string $resourceKey = null) |
|
126 | |||
127 | /** |
||
128 | * @param string|null $responseKey |
||
129 | */ |
||
130 | 5 | private function setResponseKey(string $responseKey = null) |
|
134 | } |
||
135 |