1 | <?php |
||
12 | abstract class AbstractRequest implements RequestInterface, \ArrayAccess, \IteratorAggregate, \Serializable |
||
13 | { |
||
14 | const GET = 'get'; |
||
15 | const POST = 'post'; |
||
16 | const PUT = 'put'; |
||
17 | const PATCH = 'patch'; |
||
18 | const DELETE = 'delete'; |
||
19 | const HEAD = 'head'; |
||
20 | const OPTIONS = 'options'; |
||
21 | |||
22 | /** |
||
23 | * URI |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | public $uri; |
||
28 | |||
29 | /** |
||
30 | * Resource object |
||
31 | * |
||
32 | * @var \BEAR\Resource\ResourceObject |
||
33 | */ |
||
34 | public $resourceObject; |
||
35 | |||
36 | /** |
||
37 | * Method |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | public $method = ''; |
||
42 | |||
43 | /** |
||
44 | * Query |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | public $query = []; |
||
49 | |||
50 | /** |
||
51 | * Options |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | public $options = []; |
||
56 | |||
57 | /** |
||
58 | * Request option (eager or lazy) |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | public $in; |
||
63 | |||
64 | /** |
||
65 | * Links |
||
66 | * |
||
67 | * @var \BEAR\Resource\LinkType[] |
||
68 | */ |
||
69 | public $links = []; |
||
70 | |||
71 | /** |
||
72 | * Request Result |
||
73 | * |
||
74 | * @var ResourceObject |
||
75 | */ |
||
76 | protected $result; |
||
77 | |||
78 | /** |
||
79 | * @var InvokerInterface |
||
80 | */ |
||
81 | protected $invoker; |
||
82 | |||
83 | /** |
||
84 | * @var LinkerInterface |
||
85 | */ |
||
86 | private $linker; |
||
87 | |||
88 | /** |
||
89 | * @param InvokerInterface $invoker |
||
90 | * @param ResourceObject|null $ro |
||
91 | * @param string $method |
||
92 | * @param array $query |
||
93 | * @param array $links |
||
94 | * @param LinkerInterface|null $linker |
||
95 | * |
||
96 | * @throws MethodException |
||
97 | */ |
||
98 | 66 | public function __construct( |
|
116 | |||
117 | /** |
||
118 | * @return string |
||
119 | */ |
||
120 | 6 | public function __toString() |
|
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | 36 | public function __invoke(array $query = null) |
|
145 | |||
146 | /** |
||
147 | *{@inheritdoc} |
||
148 | * |
||
149 | * @throws OutOfBoundsException |
||
150 | */ |
||
151 | 1 | public function offsetSet($offset, $value) |
|
155 | |||
156 | /** |
||
157 | * {@inheritdoc} |
||
158 | * |
||
159 | * @throws OutOfBoundsException |
||
160 | */ |
||
161 | 1 | public function offsetUnset($offset) |
|
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | 20 | public function request() |
|
179 | |||
180 | /** |
||
181 | * {@inheritdoc} |
||
182 | * |
||
183 | * @throws OutOfBoundsException |
||
184 | */ |
||
185 | 2 | public function offsetGet($offset) |
|
194 | |||
195 | /** |
||
196 | * {@inheritdoc} |
||
197 | */ |
||
198 | 2 | public function offsetExists($offset) |
|
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | 1 | public function getIterator() |
|
216 | |||
217 | /** |
||
218 | * {@inheritdoc} |
||
219 | */ |
||
220 | 2 | public function hash() |
|
224 | |||
225 | /** |
||
226 | * @return ResourceObject |
||
227 | */ |
||
228 | 24 | private function invoke() |
|
237 | |||
238 | /** |
||
239 | * @inheritDoc |
||
240 | */ |
||
241 | public function serialize() |
||
245 | |||
246 | /** |
||
247 | * @inheritDoc |
||
248 | */ |
||
249 | public function unserialize($serialized) |
||
253 | |||
254 | } |
||
255 |