1 | <?php |
||
20 | abstract class Base |
||
21 | { |
||
22 | private $context; |
||
23 | private $aimeos; |
||
24 | private $view; |
||
25 | private $path; |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Initializes the client |
||
30 | * |
||
31 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
||
32 | * @param string $path Name of the client separated by slashes, e.g "product/property" |
||
33 | */ |
||
34 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, string $path ) |
||
39 | |||
40 | |||
41 | /** |
||
42 | * Catch unknown methods |
||
43 | * |
||
44 | * @param string $name Name of the method |
||
45 | * @param array $param List of method parameter |
||
46 | * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed |
||
47 | */ |
||
48 | public function __call( string $name, array $param ) |
||
52 | |||
53 | |||
54 | /** |
||
55 | * Returns the Aimeos bootstrap object |
||
56 | * |
||
57 | * @return \Aimeos\Bootstrap The Aimeos bootstrap object |
||
58 | */ |
||
59 | public function getAimeos() : \Aimeos\Bootstrap |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Sets the Aimeos bootstrap object |
||
71 | * |
||
72 | * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object |
||
73 | * @return \Aimeos\Admin\JsonAdm\Iface Reference to this object for fluent calls |
||
|
|||
74 | */ |
||
75 | public function setAimeos( \Aimeos\Bootstrap $aimeos ) : \Aimeos\Admin\JsonAdm\Iface |
||
80 | |||
81 | |||
82 | /** |
||
83 | * Returns the view object that will generate the admin output. |
||
84 | * |
||
85 | * @return \Aimeos\MW\View\Iface The view object which generates the admin output |
||
86 | */ |
||
87 | public function getView() : \Aimeos\MW\View\Iface |
||
95 | |||
96 | |||
97 | /** |
||
98 | * Sets the view object that will generate the admin output. |
||
99 | * |
||
100 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
||
101 | * @return \Aimeos\Admin\JsonAdm\Iface Reference to this object for fluent calls |
||
102 | */ |
||
103 | public function setView( \Aimeos\MW\View\Iface $view ) : \Aimeos\Admin\JsonAdm\Iface |
||
108 | |||
109 | |||
110 | /** |
||
111 | * Returns the items with parent/child relationships |
||
112 | * |
||
113 | * @param \Aimeos\Map $items List of items implementing \Aimeos\MShop\Common\Item\Iface |
||
114 | * @param array $include List of resource types that should be fetched |
||
115 | * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface |
||
116 | */ |
||
117 | protected function getChildItems( \Aimeos\Map $items, array $include ) : \Aimeos\Map |
||
121 | |||
122 | |||
123 | /** |
||
124 | * Returns the context item object |
||
125 | * |
||
126 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
||
127 | */ |
||
128 | protected function getContext() : \Aimeos\MShop\Context\Item\Iface |
||
132 | |||
133 | |||
134 | /** |
||
135 | * Returns the list of domains that are available as resources |
||
136 | * |
||
137 | * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter |
||
138 | * @return array List of domain names |
||
139 | */ |
||
140 | protected function getDomains( \Aimeos\MW\View\Iface $view ) : array |
||
166 | |||
167 | |||
168 | /** |
||
169 | * Returns the list items for association relationships |
||
170 | * |
||
171 | * @param \Aimeos\Map $items List of items implementing \Aimeos\MShop\Common\Item\Iface |
||
172 | * @param array $include List of resource types that should be fetched |
||
173 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
||
174 | */ |
||
175 | protected function getListItems( \Aimeos\Map $items, array $include ) : \Aimeos\Map |
||
181 | |||
182 | |||
183 | /** |
||
184 | * Returns the path to the client |
||
185 | * |
||
186 | * @return string Client path, e.g. "product/property" |
||
187 | */ |
||
188 | protected function getPath() : string |
||
192 | |||
193 | |||
194 | /** |
||
195 | * Returns the items associated via a lists table |
||
196 | * |
||
197 | * @param \Aimeos\Map $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
||
198 | * @return \Aimeos\Map List of items implementing \Aimeos\MShop\Common\Item\Iface |
||
199 | */ |
||
200 | protected function getRefItems( \Aimeos\Map $listItems ) : \Aimeos\Map |
||
213 | |||
214 | |||
215 | /** |
||
216 | * Returns the list of allowed resources |
||
217 | * |
||
218 | * @param \Aimeos\MW\View\Iface $view View object with "access" helper |
||
219 | * @param array List of all available resources |
||
220 | * @return array List of allowed resources |
||
221 | */ |
||
222 | protected function getAllowedResources( \Aimeos\MW\View\Iface $view, array $resources ) : array |
||
236 | |||
237 | |||
238 | /** |
||
239 | * Returns the list of additional resources |
||
240 | * |
||
241 | * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter |
||
242 | * @return array List of domain names |
||
243 | */ |
||
244 | protected function getResources( \Aimeos\MW\View\Iface $view ) : array |
||
264 | |||
265 | |||
266 | /** |
||
267 | * Initializes the criteria object based on the given parameter |
||
268 | * |
||
269 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
||
270 | * @param array $params List of criteria data with condition, sorting and paging |
||
271 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
||
272 | */ |
||
273 | protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) : \Aimeos\MW\Criteria\Iface |
||
279 | |||
280 | |||
281 | /** |
||
282 | * Creates of updates several items at once |
||
283 | * |
||
284 | * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items |
||
285 | * @param \stdClass $request Object with request body data |
||
286 | * @return \Aimeos\Map List of items |
||
287 | */ |
||
288 | protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) : \Aimeos\Map |
||
301 | |||
302 | |||
303 | /** |
||
304 | * Saves and returns the new or updated item |
||
305 | * |
||
306 | * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items |
||
307 | * @param \stdClass $entry Object including "id" and "attributes" elements |
||
308 | * @return \Aimeos\MShop\Common\Item\Iface New or updated item |
||
309 | */ |
||
310 | protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry ) : \Aimeos\MShop\Common\Item\Iface |
||
337 | |||
338 | |||
339 | /** |
||
340 | * Saves the item references associated via the list |
||
341 | * |
||
342 | * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items |
||
343 | * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set |
||
344 | * @param \stdClass $relationships Object including the <domain>/data/attributes structure |
||
345 | */ |
||
346 | protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager, |
||
376 | } |
||
377 |
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.