1 | <?php |
||
23 | abstract class Base |
||
24 | { |
||
25 | private $view; |
||
26 | private $context; |
||
27 | private $path; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * Initializes the client |
||
32 | * |
||
33 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
||
34 | * @param string $path Name of the client separated by slashes, e.g "catalog/lists" |
||
35 | */ |
||
36 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, $path ) |
||
41 | |||
42 | |||
43 | /** |
||
44 | * Catch unknown methods |
||
45 | * |
||
46 | * @param string $name Name of the method |
||
47 | * @param array $param List of method parameter |
||
48 | * @throws \Aimeos\Client\JsonApi\Exception If method call failed |
||
49 | */ |
||
50 | public function __call( $name, array $param ) |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Deletes the resource or the resource list |
||
58 | * |
||
59 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
60 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
61 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
62 | */ |
||
63 | public function delete( ServerRequestInterface $request, ResponseInterface $response ) |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Retrieves the resource or the resource list |
||
71 | * |
||
72 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
73 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
74 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
75 | */ |
||
76 | public function get( ServerRequestInterface $request, ResponseInterface $response ) |
||
80 | |||
81 | |||
82 | /** |
||
83 | * Updates the resource or the resource list partitially |
||
84 | * |
||
85 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
86 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
87 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
88 | */ |
||
89 | public function patch( ServerRequestInterface $request, ResponseInterface $response ) |
||
93 | |||
94 | |||
95 | /** |
||
96 | * Creates or updates the resource or the resource list |
||
97 | * |
||
98 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
99 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
100 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
101 | */ |
||
102 | public function post( ServerRequestInterface $request, ResponseInterface $response ) |
||
106 | |||
107 | |||
108 | /** |
||
109 | * Creates or updates the resource or the resource list |
||
110 | * |
||
111 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
112 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
113 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
114 | */ |
||
115 | public function put( ServerRequestInterface $request, ResponseInterface $response ) |
||
119 | |||
120 | |||
121 | /** |
||
122 | * Creates or updates the resource or the resource list |
||
123 | * |
||
124 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
125 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
126 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
127 | */ |
||
128 | public function options( ServerRequestInterface $request, ResponseInterface $response ) |
||
132 | |||
133 | |||
134 | /** |
||
135 | * Returns the view object that will generate the admin output. |
||
136 | * |
||
137 | * @return \Aimeos\MW\View\Iface The view object which generates the admin output |
||
138 | */ |
||
139 | public function getView() |
||
147 | |||
148 | |||
149 | /** |
||
150 | * Sets the view object that will generate the admin output. |
||
151 | * |
||
152 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
||
153 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
||
|
|||
154 | */ |
||
155 | public function setView( \Aimeos\MW\View\Iface $view ) |
||
160 | |||
161 | |||
162 | /** |
||
163 | * Returns the default response for the resource |
||
164 | * |
||
165 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
166 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
167 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
168 | */ |
||
169 | protected function defaultAction( ServerRequestInterface $request, ResponseInterface $response ) |
||
211 | |||
212 | |||
213 | /** |
||
214 | * Returns the context item object |
||
215 | * |
||
216 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
||
217 | */ |
||
218 | protected function getContext() |
||
222 | |||
223 | |||
224 | /** |
||
225 | * Returns the translated title and the details of the error |
||
226 | * |
||
227 | * @param \Exception $e Thrown exception |
||
228 | * @param string|null $domain Translation domain |
||
229 | * @return array Associative list with "title" and "detail" key (if debug config is enabled) |
||
230 | */ |
||
231 | protected function getErrorDetails( \Exception $e, $domain = null ) |
||
260 | |||
261 | |||
262 | /** |
||
263 | * Returns the path to the client |
||
264 | * |
||
265 | * @return string Client path, e.g. "product/property" |
||
266 | */ |
||
267 | protected function getPath() |
||
271 | |||
272 | |||
273 | /** |
||
274 | * Initializes the criteria object based on the given parameter |
||
275 | * |
||
276 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
277 | * @param array $params List of criteria data with condition, sorting and paging |
||
278 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
279 | */ |
||
280 | protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
288 | |||
289 | |||
290 | /** |
||
291 | * Initializes the criteria object with conditions based on the given parameter |
||
292 | * |
||
293 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
294 | * @param array $params List of criteria data with condition, sorting and paging |
||
295 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
296 | */ |
||
297 | protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
309 | |||
310 | |||
311 | /** |
||
312 | * Initializes the criteria object with the slice based on the given parameter. |
||
313 | * |
||
314 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
315 | * @param array $params List of criteria data with condition, sorting and paging |
||
316 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
317 | */ |
||
318 | protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
325 | |||
326 | |||
327 | /** |
||
328 | * Initializes the criteria object with sortations based on the given parameter |
||
329 | * |
||
330 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
331 | * @param array $params List of criteria data with condition, sorting and paging |
||
332 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
333 | */ |
||
334 | protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
353 | |||
354 | |||
355 | /** |
||
356 | * Returns the available REST verbs and the available parameters |
||
357 | * |
||
358 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
359 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
360 | * @param string $allow Allowed HTTP methods |
||
361 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
362 | */ |
||
363 | public function getOptionsResponse( ServerRequestInterface $request, ResponseInterface $response, $allow ) |
||
378 | } |
||
379 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.