1 | <?php |
||
23 | abstract class Base |
||
24 | { |
||
25 | private $view; |
||
26 | private $context; |
||
27 | private $templatePaths; |
||
28 | private $path; |
||
29 | |||
30 | |||
31 | /** |
||
32 | * Initializes the client |
||
33 | * |
||
34 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
||
35 | * @param \Aimeos\MW\View\Iface $view View object |
||
36 | * @param array $templatePaths List of file system paths where the templates are stored |
||
37 | * @param string $path Name of the client separated by slashes, e.g "catalog/lists" |
||
38 | */ |
||
39 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Catch unknown methods |
||
50 | * |
||
51 | * @param string $name Name of the method |
||
52 | * @param array $param List of method parameter |
||
53 | * @throws \Aimeos\Client\JsonApi\Exception If method call failed |
||
54 | */ |
||
55 | public function __call( $name, array $param ) |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Deletes the resource or the resource list |
||
63 | * |
||
64 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
65 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
66 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
67 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
68 | */ |
||
69 | public function delete( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Retrieves the resource or the resource list |
||
77 | * |
||
78 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
79 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
80 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
81 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
82 | */ |
||
83 | public function get( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
87 | |||
88 | |||
89 | /** |
||
90 | * Updates the resource or the resource list partitially |
||
91 | * |
||
92 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
93 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
94 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
95 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
96 | */ |
||
97 | public function patch( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
101 | |||
102 | |||
103 | /** |
||
104 | * Creates or updates the resource or the resource list |
||
105 | * |
||
106 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
107 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
108 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
109 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
110 | */ |
||
111 | public function post( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Creates or updates the resource or the resource list |
||
119 | * |
||
120 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
121 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
122 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
123 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
124 | */ |
||
125 | public function put( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
129 | |||
130 | |||
131 | /** |
||
132 | * Creates or updates the resource or the resource list |
||
133 | * |
||
134 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
135 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
136 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
137 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
138 | */ |
||
139 | public function options( ServerRequestInterface $request, ResponseInterface $response, $prefix = null ) |
||
143 | |||
144 | |||
145 | /** |
||
146 | * Returns the default response for the resource |
||
147 | * |
||
148 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
149 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
150 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
151 | */ |
||
152 | protected function defaultAction( ServerRequestInterface $request, ResponseInterface $response ) |
||
194 | |||
195 | |||
196 | /** |
||
197 | * Returns the context item object |
||
198 | * |
||
199 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
||
200 | */ |
||
201 | protected function getContext() |
||
205 | |||
206 | |||
207 | /** |
||
208 | * Returns the translated title and the details of the error |
||
209 | * |
||
210 | * @param \Exception $e Thrown exception |
||
211 | * @param string|null $domain Translation domain |
||
212 | * @return array Associative list with "title" and "detail" key (if debug config is enabled) |
||
213 | */ |
||
214 | protected function getErrorDetails( \Exception $e, $domain = null ) |
||
243 | |||
244 | |||
245 | /** |
||
246 | * Returns the path to the client |
||
247 | * |
||
248 | * @return string Client path, e.g. "product/property" |
||
249 | */ |
||
250 | protected function getPath() |
||
254 | |||
255 | |||
256 | /** |
||
257 | * Returns the paths to the template files |
||
258 | * |
||
259 | * @return array List of file system paths |
||
260 | */ |
||
261 | protected function getTemplatePaths() |
||
265 | |||
266 | |||
267 | /** |
||
268 | * Returns the view object |
||
269 | * |
||
270 | * @return \Aimeos\MW\View\Iface View object |
||
271 | */ |
||
272 | protected function getView() |
||
276 | |||
277 | |||
278 | /** |
||
279 | * Initializes the criteria object based on the given parameter |
||
280 | * |
||
281 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
282 | * @param array $params List of criteria data with condition, sorting and paging |
||
283 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
284 | */ |
||
285 | protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
293 | |||
294 | |||
295 | /** |
||
296 | * Initializes the criteria object with conditions based on the given parameter |
||
297 | * |
||
298 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
299 | * @param array $params List of criteria data with condition, sorting and paging |
||
300 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
301 | */ |
||
302 | protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
314 | |||
315 | |||
316 | /** |
||
317 | * Initializes the criteria object with the slice based on the given parameter. |
||
318 | * |
||
319 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
320 | * @param array $params List of criteria data with condition, sorting and paging |
||
321 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
322 | */ |
||
323 | protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
330 | |||
331 | |||
332 | /** |
||
333 | * Initializes the criteria object with sortations based on the given parameter |
||
334 | * |
||
335 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
336 | * @param array $params List of criteria data with condition, sorting and paging |
||
337 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
338 | */ |
||
339 | protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
||
358 | |||
359 | |||
360 | /** |
||
361 | * Returns the available REST verbs and the available parameters |
||
362 | * |
||
363 | * @param \Psr\Http\Message\ServerRequestInterface $request Request object |
||
364 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
||
365 | * @param string|null $prefix Form parameter prefix when nesting parameters is required |
||
366 | * @param string $allow Allowed HTTP methods |
||
367 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
||
368 | */ |
||
369 | public function getOptionsResponse( ServerRequestInterface $request, ResponseInterface $response, $prefix, $allow ) |
||
385 | } |
||
386 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.