@@ -28,33 +28,33 @@ discard block |
||
28 | 28 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
29 | 29 | * @since 2017.04 |
30 | 30 | */ |
31 | - public function addItem( array $values ) |
|
31 | + public function addItem(array $values) |
|
32 | 32 | { |
33 | 33 | $list = []; |
34 | 34 | $context = $this->getContext(); |
35 | 35 | $config = $context->getConfig(); |
36 | 36 | |
37 | 37 | // Show only generated passwords in account creation e-mails |
38 | - $pass = ( isset( $values['customer.password'] ) ? false : true ); |
|
38 | + $pass = (isset($values['customer.password']) ? false : true); |
|
39 | 39 | |
40 | - foreach( $values as $key => $val ) { |
|
41 | - $list[str_replace( 'order.base.address', 'customer', $key )] = $val; |
|
40 | + foreach ($values as $key => $val) { |
|
41 | + $list[str_replace('order.base.address', 'customer', $key)] = $val; |
|
42 | 42 | } |
43 | 43 | |
44 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
45 | - $list = $this->addItemDefaults( $list ); |
|
44 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
45 | + $list = $this->addItemDefaults($list); |
|
46 | 46 | |
47 | 47 | try |
48 | 48 | { |
49 | - $item = $manager->findItem( $list['customer.code'] ); |
|
49 | + $item = $manager->findItem($list['customer.code']); |
|
50 | 50 | } |
51 | - catch( \Aimeos\MShop\Exception $e ) |
|
51 | + catch (\Aimeos\MShop\Exception $e) |
|
52 | 52 | { |
53 | - $this->checkLimit( $list ); |
|
53 | + $this->checkLimit($list); |
|
54 | 54 | |
55 | 55 | $item = $manager->createItem(); |
56 | - $item->fromArray( $list ); |
|
57 | - $item->setId( null ); |
|
56 | + $item->fromArray($list); |
|
57 | + $item->setId(null); |
|
58 | 58 | |
59 | 59 | /** controller/frontend/customer/groupids |
60 | 60 | * List of groups new customers should be assigned to |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * @category User |
69 | 69 | * @category Developer |
70 | 70 | */ |
71 | - $item->setGroups( (array) $config->get( 'controller/frontend/customer/groupids', [] ) ); |
|
71 | + $item->setGroups((array) $config->get('controller/frontend/customer/groupids', [])); |
|
72 | 72 | |
73 | - $item = $manager->saveItem( $item ); |
|
73 | + $item = $manager->saveItem($item); |
|
74 | 74 | |
75 | 75 | $msg = $item->toArray(); |
76 | - $msg['customer.password'] = ( $pass ? $list['customer.password'] : null ); |
|
77 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
76 | + $msg['customer.password'] = ($pass ? $list['customer.password'] : null); |
|
77 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | return $item; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
88 | 88 | */ |
89 | - public function createItem( array $values = [] ) |
|
89 | + public function createItem(array $values = []) |
|
90 | 90 | { |
91 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
91 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
92 | 92 | |
93 | 93 | $item = $manager->createItem(); |
94 | - $item->fromArray( $values ); |
|
95 | - $item->setId( null ); |
|
96 | - $item->setStatus( 1 ); |
|
94 | + $item->fromArray($values); |
|
95 | + $item->setId(null); |
|
96 | + $item->setStatus(1); |
|
97 | 97 | |
98 | 98 | return $item; |
99 | 99 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | * @param string $id Unique customer ID |
106 | 106 | * @since 2017.04 |
107 | 107 | */ |
108 | - public function deleteItem( $id ) |
|
108 | + public function deleteItem($id) |
|
109 | 109 | { |
110 | - $this->checkUser( $id ); |
|
110 | + $this->checkUser($id); |
|
111 | 111 | |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
113 | - $manager->deleteItem( $id ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
113 | + $manager->deleteItem($id); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
123 | 123 | * @since 2017.04 |
124 | 124 | */ |
125 | - public function editItem( $id, array $values ) |
|
125 | + public function editItem($id, array $values) |
|
126 | 126 | { |
127 | - $this->checkUser( $id ); |
|
127 | + $this->checkUser($id); |
|
128 | 128 | |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
130 | - $item = $manager->getItem( $id, ['customer/group'], true ); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
130 | + $item = $manager->getItem($id, ['customer/group'], true); |
|
131 | 131 | |
132 | - unset( $values['customer.id'] ); |
|
133 | - $item->fromArray( $values ); |
|
132 | + unset($values['customer.id']); |
|
133 | + $item->fromArray($values); |
|
134 | 134 | |
135 | - return $manager->saveItem( $item ); |
|
135 | + return $manager->saveItem($item); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
145 | 145 | * @since 2017.04 |
146 | 146 | */ |
147 | - public function getItem( $id = null, array $domains = [] ) |
|
147 | + public function getItem($id = null, array $domains = []) |
|
148 | 148 | { |
149 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
149 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
150 | 150 | |
151 | - if( $id == null ) { |
|
152 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
151 | + if ($id == null) { |
|
152 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
153 | 153 | } |
154 | 154 | |
155 | - $this->checkUser( $id ); |
|
155 | + $this->checkUser($id); |
|
156 | 156 | |
157 | - return $manager->getItem( $id, $domains, true ); |
|
157 | + return $manager->getItem($id, $domains, true); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
169 | 169 | * @since 2017.04 |
170 | 170 | */ |
171 | - public function findItem( $code, array $domains = [] ) |
|
171 | + public function findItem($code, array $domains = []) |
|
172 | 172 | { |
173 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
173 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item |
181 | 181 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
182 | 182 | */ |
183 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
183 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
184 | 184 | { |
185 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
185 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
194 | 194 | * @since 2017.04 |
195 | 195 | */ |
196 | - public function addAddressItem( array $values ) |
|
196 | + public function addAddressItem(array $values) |
|
197 | 197 | { |
198 | 198 | $context = $this->getContext(); |
199 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
199 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
200 | 200 | |
201 | 201 | $item = $manager->createItem(); |
202 | - $item->fromArray( $values ); |
|
203 | - $item->setId( null ); |
|
204 | - $item->setParentId( $context->getUserId() ); |
|
202 | + $item->fromArray($values); |
|
203 | + $item->setId(null); |
|
204 | + $item->setParentId($context->getUserId()); |
|
205 | 205 | |
206 | - return $manager->saveItem( $item ); |
|
206 | + return $manager->saveItem($item); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
214 | 214 | */ |
215 | - public function createAddressItem( array $values = [] ) |
|
215 | + public function createAddressItem(array $values = []) |
|
216 | 216 | { |
217 | 217 | $context = $this->getContext(); |
218 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
218 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
219 | 219 | |
220 | 220 | $item = $manager->createItem(); |
221 | - $item->fromArray( $values ); |
|
222 | - $item->setId( null ); |
|
221 | + $item->fromArray($values); |
|
222 | + $item->setId(null); |
|
223 | 223 | |
224 | - $item->setParentId( $context->getUserId() ); |
|
224 | + $item->setParentId($context->getUserId()); |
|
225 | 225 | |
226 | 226 | return $item; |
227 | 227 | } |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | * @param string $id Unique customer address ID |
234 | 234 | * @since 2017.04 |
235 | 235 | */ |
236 | - public function deleteAddressItem( $id ) |
|
236 | + public function deleteAddressItem($id) |
|
237 | 237 | { |
238 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
238 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
239 | 239 | |
240 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
240 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
241 | 241 | |
242 | - $manager->deleteItem( $id ); |
|
242 | + $manager->deleteItem($id); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -251,17 +251,17 @@ discard block |
||
251 | 251 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
252 | 252 | * @since 2017.04 |
253 | 253 | */ |
254 | - public function editAddressItem( $id, array $values ) |
|
254 | + public function editAddressItem($id, array $values) |
|
255 | 255 | { |
256 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
256 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
257 | 257 | |
258 | - $item = $manager->getItem( $id, [], true ); |
|
259 | - $this->checkUser( $item->getParentId() ); |
|
258 | + $item = $manager->getItem($id, [], true); |
|
259 | + $this->checkUser($item->getParentId()); |
|
260 | 260 | |
261 | - unset( $values['customer.address.id'] ); |
|
262 | - $item->fromArray( $values ); |
|
261 | + unset($values['customer.address.id']); |
|
262 | + $item->fromArray($values); |
|
263 | 263 | |
264 | - return $manager->saveItem( $item ); |
|
264 | + return $manager->saveItem($item); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
273 | 273 | * @since 2017.04 |
274 | 274 | */ |
275 | - public function getAddressItem( $id ) |
|
275 | + public function getAddressItem($id) |
|
276 | 276 | { |
277 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
277 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
278 | 278 | |
279 | - $item = $manager->getItem( $id ); |
|
280 | - $this->checkUser( $item->getParentId() ); |
|
279 | + $item = $manager->getItem($id); |
|
280 | + $this->checkUser($item->getParentId()); |
|
281 | 281 | |
282 | 282 | return $item; |
283 | 283 | } |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item |
290 | 290 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID |
291 | 291 | */ |
292 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
292 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
293 | 293 | { |
294 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
294 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
303 | 303 | * @since 2017.06 |
304 | 304 | */ |
305 | - public function addListItem( array $values ) |
|
305 | + public function addListItem(array $values) |
|
306 | 306 | { |
307 | 307 | $context = $this->getContext(); |
308 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
308 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
309 | 309 | |
310 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
310 | + if (!isset($values['customer.lists.typeid'])) |
|
311 | 311 | { |
312 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
313 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
312 | + if (!isset($values['customer.lists.type'])) { |
|
313 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
314 | 314 | } |
315 | 315 | |
316 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
317 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
316 | + if (!isset($values['customer.lists.domain'])) { |
|
317 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
318 | 318 | } |
319 | 319 | |
320 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
321 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
320 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
321 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
322 | 322 | $values['customer.lists.typeid'] = $typeItem->getId(); |
323 | 323 | } |
324 | 324 | |
325 | 325 | $item = $manager->createItem(); |
326 | - $item->fromArray( $values ); |
|
327 | - $item->setId( null ); |
|
328 | - $item->setParentId( $context->getUserId() ); |
|
326 | + $item->fromArray($values); |
|
327 | + $item->setId(null); |
|
328 | + $item->setParentId($context->getUserId()); |
|
329 | 329 | |
330 | - return $manager->saveItem( $item ); |
|
330 | + return $manager->saveItem($item); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | public function createListsFilter() |
341 | 341 | { |
342 | 342 | $context = $this->getContext(); |
343 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
343 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
344 | 344 | |
345 | 345 | $filter = $manager->createSearch(); |
346 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
346 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
347 | 347 | |
348 | 348 | return $filter; |
349 | 349 | } |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | * @param string $id Unique customer address ID |
356 | 356 | * @since 2017.06 |
357 | 357 | */ |
358 | - public function deleteListItem( $id ) |
|
358 | + public function deleteListItem($id) |
|
359 | 359 | { |
360 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
360 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
361 | 361 | |
362 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
362 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
363 | 363 | |
364 | - $manager->deleteItem( $id ); |
|
364 | + $manager->deleteItem($id); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -373,33 +373,33 @@ discard block |
||
373 | 373 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
374 | 374 | * @since 2017.06 |
375 | 375 | */ |
376 | - public function editListItem( $id, array $values ) |
|
376 | + public function editListItem($id, array $values) |
|
377 | 377 | { |
378 | 378 | $context = $this->getContext(); |
379 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
379 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
380 | 380 | |
381 | - $item = $manager->getItem( $id, [], true ); |
|
382 | - $this->checkUser( $item->getParentId() ); |
|
381 | + $item = $manager->getItem($id, [], true); |
|
382 | + $this->checkUser($item->getParentId()); |
|
383 | 383 | |
384 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
384 | + if (!isset($values['customer.lists.typeid'])) |
|
385 | 385 | { |
386 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
387 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
386 | + if (!isset($values['customer.lists.type'])) { |
|
387 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
388 | 388 | } |
389 | 389 | |
390 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
391 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
390 | + if (!isset($values['customer.lists.domain'])) { |
|
391 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
392 | 392 | } |
393 | 393 | |
394 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
395 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
394 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
395 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
396 | 396 | $values['customer.lists.typeid'] = $typeItem->getId(); |
397 | 397 | } |
398 | 398 | |
399 | - unset( $values['customer.lists.id'] ); |
|
400 | - $item->fromArray( $values ); |
|
399 | + unset($values['customer.lists.id']); |
|
400 | + $item->fromArray($values); |
|
401 | 401 | |
402 | - return $manager->saveItem( $item ); |
|
402 | + return $manager->saveItem($item); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
411 | 411 | * @since 2017.06 |
412 | 412 | */ |
413 | - public function getListItem( $id ) |
|
413 | + public function getListItem($id) |
|
414 | 414 | { |
415 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
416 | - $item = $manager->getItem( $id ); |
|
415 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
416 | + $item = $manager->getItem($id); |
|
417 | 417 | |
418 | - $this->checkUser( $item->getParentId() ); |
|
418 | + $this->checkUser($item->getParentId()); |
|
419 | 419 | |
420 | 420 | return $item; |
421 | 421 | } |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
430 | 430 | * @since 2017.06 |
431 | 431 | */ |
432 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
432 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
433 | 433 | { |
434 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
434 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
435 | 435 | |
436 | - return $manager->searchItems( $filter, [], $total ); |
|
436 | + return $manager->searchItems($filter, [], $total); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | |
@@ -443,37 +443,37 @@ discard block |
||
443 | 443 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
444 | 444 | * @return string[] Associative list of customer key/value pairs with default values set |
445 | 445 | */ |
446 | - protected function addItemDefaults( array $values ) |
|
446 | + protected function addItemDefaults(array $values) |
|
447 | 447 | { |
448 | - if( !isset( $values['customer.label'] ) || $values['customer.label'] == '' ) |
|
448 | + if (!isset($values['customer.label']) || $values['customer.label'] == '') |
|
449 | 449 | { |
450 | 450 | $label = ''; |
451 | 451 | |
452 | - if( isset( $values['customer.lastname'] ) ) { |
|
452 | + if (isset($values['customer.lastname'])) { |
|
453 | 453 | $label = $values['customer.lastname']; |
454 | 454 | } |
455 | 455 | |
456 | - if( isset( $values['customer.firstname'] ) && $values['customer.firstname'] != '' ) { |
|
456 | + if (isset($values['customer.firstname']) && $values['customer.firstname'] != '') { |
|
457 | 457 | $label = $values['customer.firstname'] . ' ' . $label; |
458 | 458 | } |
459 | 459 | |
460 | - if( isset( $values['customer.company'] ) && $values['customer.company'] != '' ) { |
|
460 | + if (isset($values['customer.company']) && $values['customer.company'] != '') { |
|
461 | 461 | $label .= ' (' . $values['customer.company'] . ')'; |
462 | 462 | } |
463 | 463 | |
464 | 464 | $values['customer.label'] = $label; |
465 | 465 | } |
466 | 466 | |
467 | - if( !isset( $values['customer.code'] ) && isset( $values['customer.email'] ) ) { |
|
467 | + if (!isset($values['customer.code']) && isset($values['customer.email'])) { |
|
468 | 468 | $values['customer.code'] = $values['customer.email']; |
469 | 469 | } |
470 | 470 | |
471 | - if( !isset( $values['customer.status'] ) ) { |
|
471 | + if (!isset($values['customer.status'])) { |
|
472 | 472 | $values['customer.status'] = 1; |
473 | 473 | } |
474 | 474 | |
475 | - if( !isset( $values['customer.password'] ) ) { |
|
476 | - $values['customer.password'] = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
475 | + if (!isset($values['customer.password'])) { |
|
476 | + $values['customer.password'] = substr(md5(microtime(true) . getmypid() . rand()), -8); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | return $values; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * @param string[] $values Associative list of customer keys (e.g. "customer.label") and their values |
487 | 487 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
488 | 488 | */ |
489 | - protected function checkLimit( array $values ) |
|
489 | + protected function checkLimit(array $values) |
|
490 | 490 | { |
491 | 491 | $total = 0; |
492 | 492 | $context = $this->getContext(); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @category Developer |
508 | 508 | * @see controller/frontend/customer/limit-seconds |
509 | 509 | */ |
510 | - $count = $config->get( 'controller/frontend/customer/limit-count', 5 ); |
|
510 | + $count = $config->get('controller/frontend/customer/limit-count', 5); |
|
511 | 511 | |
512 | 512 | /** controller/frontend/customer/limit-seconds |
513 | 513 | * Customer account limitation time frame in seconds |
@@ -525,22 +525,22 @@ discard block |
||
525 | 525 | * @category Developer |
526 | 526 | * @see controller/frontend/customer/limit-count |
527 | 527 | */ |
528 | - $seconds = $config->get( 'controller/frontend/customer/limit-seconds', 300 ); |
|
528 | + $seconds = $config->get('controller/frontend/customer/limit-seconds', 300); |
|
529 | 529 | |
530 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
530 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
531 | 531 | |
532 | 532 | $search = $manager->createSearch(); |
533 | 533 | $expr = [ |
534 | - $search->compare( '==', 'customer.editor', $context->getEditor() ), |
|
535 | - $search->compare( '>=', 'customer.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
534 | + $search->compare('==', 'customer.editor', $context->getEditor()), |
|
535 | + $search->compare('>=', 'customer.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
536 | 536 | ]; |
537 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
538 | - $search->setSlice( 0, 0 ); |
|
537 | + $search->setConditions($search->combine('&&', $expr)); |
|
538 | + $search->setSlice(0, 0); |
|
539 | 539 | |
540 | - $manager->searchItems( $search, [], $total ); |
|
540 | + $manager->searchItems($search, [], $total); |
|
541 | 541 | |
542 | - if( $total > $count ) { |
|
543 | - throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Temporary limit reached' ) ); |
|
542 | + if ($total > $count) { |
|
543 | + throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Temporary limit reached')); |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | |
@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | * @param string $id Unique customer ID |
552 | 552 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
553 | 553 | */ |
554 | - protected function checkUser( $id ) |
|
554 | + protected function checkUser($id) |
|
555 | 555 | { |
556 | - if( $id != $this->getContext()->getUserId() ) |
|
556 | + if ($id != $this->getContext()->getUserId()) |
|
557 | 557 | { |
558 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
559 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
558 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
559 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | } |
@@ -31,42 +31,42 @@ discard block |
||
31 | 31 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
32 | 32 | * @since 2017.03 |
33 | 33 | */ |
34 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ) |
|
34 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds) |
|
35 | 35 | { |
36 | - if( !empty( $attrIds ) ) |
|
36 | + if (!empty($attrIds)) |
|
37 | 37 | { |
38 | - $attrIds = $this->validateIds( $attrIds ); |
|
38 | + $attrIds = $this->validateIds($attrIds); |
|
39 | 39 | |
40 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $attrIds ) ); |
|
40 | + $func = $filter->createFunction('index.attributeaggregate', array($attrIds)); |
|
41 | 41 | $expr = array( |
42 | - $filter->compare( '==', $func, count( $attrIds ) ), |
|
42 | + $filter->compare('==', $func, count($attrIds)), |
|
43 | 43 | $filter->getConditions(), |
44 | 44 | ); |
45 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
45 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
46 | 46 | } |
47 | 47 | |
48 | - if( !empty( $optIds ) ) |
|
48 | + if (!empty($optIds)) |
|
49 | 49 | { |
50 | - $optIds = $this->validateIds( $optIds ); |
|
50 | + $optIds = $this->validateIds($optIds); |
|
51 | 51 | |
52 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $optIds ) ); |
|
52 | + $func = $filter->createFunction('index.attributeaggregate', array($optIds)); |
|
53 | 53 | $expr = array( |
54 | - $filter->compare( '>', $func, 0 ), |
|
54 | + $filter->compare('>', $func, 0), |
|
55 | 55 | $filter->getConditions(), |
56 | 56 | ); |
57 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
57 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
58 | 58 | } |
59 | 59 | |
60 | - foreach( $oneIds as $type => $list ) |
|
60 | + foreach ($oneIds as $type => $list) |
|
61 | 61 | { |
62 | - if( ( $list = $this->validateIds( (array) $list ) ) !== [] ) |
|
62 | + if (($list = $this->validateIds((array) $list)) !== []) |
|
63 | 63 | { |
64 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $list ) ); |
|
64 | + $func = $filter->createFunction('index.attributeaggregate', array($list)); |
|
65 | 65 | $expr = array( |
66 | - $filter->compare( '>', $func, 0 ), |
|
66 | + $filter->compare('>', $func, 0), |
|
67 | 67 | $filter->getConditions(), |
68 | 68 | ); |
69 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
69 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -86,38 +86,38 @@ discard block |
||
86 | 86 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
87 | 87 | * @since 2017.03 |
88 | 88 | */ |
89 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
90 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ) |
|
89 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
90 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default') |
|
91 | 91 | { |
92 | - $catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId ); |
|
92 | + $catIds = (!is_array($catId) ? explode(',', $catId) : $catId); |
|
93 | 93 | |
94 | - if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
94 | + if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
95 | 95 | { |
96 | 96 | $list = []; |
97 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
97 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog'); |
|
98 | 98 | |
99 | - foreach( $catIds as $catId ) |
|
99 | + foreach ($catIds as $catId) |
|
100 | 100 | { |
101 | - $tree = $cntl->getTree( $catId, [], $level ); |
|
102 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) ); |
|
101 | + $tree = $cntl->getTree($catId, [], $level); |
|
102 | + $list = array_merge($list, $this->getCatalogIdsFromTree($tree)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $catIds = $list; |
106 | 106 | } |
107 | 107 | |
108 | - $expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) ); |
|
108 | + $expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds))); |
|
109 | 109 | $expr[] = $filter->getConditions(); |
110 | 110 | |
111 | - if( $sort === 'relevance' ) |
|
111 | + if ($sort === 'relevance') |
|
112 | 112 | { |
113 | - $cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) ); |
|
114 | - $expr[] = $filter->compare( '>=', $cmpfunc, 0 ); |
|
113 | + $cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds)); |
|
114 | + $expr[] = $filter->compare('>=', $cmpfunc, 0); |
|
115 | 115 | |
116 | - $sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) ); |
|
117 | - $filter->setSortations( array( $filter->sort( $direction, $sortfunc ) ) ); |
|
116 | + $sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds)); |
|
117 | + $filter->setSortations(array($filter->sort($direction, $sortfunc))); |
|
118 | 118 | } |
119 | 119 | |
120 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
120 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
121 | 121 | |
122 | 122 | return $filter; |
123 | 123 | } |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
135 | 135 | * @since 2017.03 |
136 | 136 | */ |
137 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ) |
|
137 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default') |
|
138 | 138 | { |
139 | 139 | $langid = $this->getContext()->getLocale()->getLanguageId(); |
140 | - $cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ); |
|
141 | - $expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() ); |
|
140 | + $cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input)); |
|
141 | + $expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions()); |
|
142 | 142 | |
143 | - return $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
143 | + return $filter->setConditions($filter->combine('&&', $expr)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @return array Associative list of key values as key and the product count for this key as value |
153 | 153 | * @since 2017.03 |
154 | 154 | */ |
155 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
155 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
156 | 156 | { |
157 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key ); |
|
157 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
170 | 170 | * @since 2017.03 |
171 | 171 | */ |
172 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
172 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
173 | 173 | { |
174 | 174 | $sortations = []; |
175 | 175 | $context = $this->getContext(); |
176 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'index' ); |
|
176 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'index'); |
|
177 | 177 | |
178 | 178 | |
179 | 179 | /** controller/frontend/product/ignore-dates |
@@ -188,55 +188,55 @@ discard block |
||
188 | 188 | * @since 2017.10 |
189 | 189 | * @category Developer |
190 | 190 | */ |
191 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
191 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
192 | 192 | { |
193 | 193 | $search = $manager->createSearch(); |
194 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
194 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
195 | 195 | } |
196 | 196 | else |
197 | 197 | { |
198 | - $search = $manager->createSearch( true ); |
|
198 | + $search = $manager->createSearch(true); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - $expr = array( $search->compare( '!=', 'index.catalog.id', null ) ); |
|
202 | + $expr = array($search->compare('!=', 'index.catalog.id', null)); |
|
203 | 203 | |
204 | - switch( $sort ) |
|
204 | + switch ($sort) |
|
205 | 205 | { |
206 | 206 | case 'code': |
207 | - $sortations[] = $search->sort( $direction, 'product.code' ); |
|
207 | + $sortations[] = $search->sort($direction, 'product.code'); |
|
208 | 208 | break; |
209 | 209 | |
210 | 210 | case 'ctime': |
211 | - $sortations[] = $search->sort( $direction, 'product.ctime' ); |
|
211 | + $sortations[] = $search->sort($direction, 'product.ctime'); |
|
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'name': |
215 | 215 | $langid = $context->getLocale()->getLanguageId(); |
216 | 216 | |
217 | - $cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) ); |
|
218 | - $expr[] = $search->compare( '>=', $cmpfunc, '' ); |
|
217 | + $cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product')); |
|
218 | + $expr[] = $search->compare('>=', $cmpfunc, ''); |
|
219 | 219 | |
220 | - $sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) ); |
|
221 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
220 | + $sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name')); |
|
221 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
222 | 222 | break; |
223 | 223 | |
224 | 224 | case 'price': |
225 | 225 | $currencyid = $context->getLocale()->getCurrencyId(); |
226 | 226 | |
227 | - $cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
228 | - $expr[] = $search->compare( '>=', $cmpfunc, '0.00' ); |
|
227 | + $cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default')); |
|
228 | + $expr[] = $search->compare('>=', $cmpfunc, '0.00'); |
|
229 | 229 | |
230 | - $sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
231 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
230 | + $sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default')); |
|
231 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
232 | 232 | break; |
233 | 233 | } |
234 | 234 | |
235 | 235 | $expr[] = $search->getConditions(); |
236 | 236 | |
237 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
238 | - $search->setSortations( $sortations ); |
|
239 | - $search->setSlice( $start, $size ); |
|
237 | + $search->setConditions($search->combine('&&', $expr)); |
|
238 | + $search->setSortations($sortations); |
|
239 | + $search->setSlice($start, $size); |
|
240 | 240 | |
241 | 241 | return $search; |
242 | 242 | } |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
251 | 251 | * @since 2017.03 |
252 | 252 | */ |
253 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ) |
|
253 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')) |
|
254 | 254 | { |
255 | - $items = $this->getItems( [$productId], $domains ); |
|
255 | + $items = $this->getItems([$productId], $domains); |
|
256 | 256 | |
257 | - if( ( $item = reset( $items ) ) !== false ) { |
|
257 | + if (($item = reset($items)) !== false) { |
|
258 | 258 | return $item; |
259 | 259 | } |
260 | 260 | |
261 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) ); |
|
261 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId)); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
271 | 271 | * @since 2017.03 |
272 | 272 | */ |
273 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ) |
|
273 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')) |
|
274 | 274 | { |
275 | 275 | $context = $this->getContext(); |
276 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
276 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
277 | 277 | |
278 | 278 | /** controller/frontend/order/ignore-dates |
279 | 279 | * Ignore start and end dates of products |
@@ -287,24 +287,24 @@ discard block |
||
287 | 287 | * @since 2017.08 |
288 | 288 | * @category Developer |
289 | 289 | */ |
290 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
290 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
291 | 291 | { |
292 | 292 | $search = $manager->createSearch(); |
293 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
293 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
294 | 294 | } |
295 | 295 | else |
296 | 296 | { |
297 | - $search = $manager->createSearch( true ); |
|
297 | + $search = $manager->createSearch(true); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $expr = array( |
301 | - $search->compare( '==', 'product.id', $productIds ), |
|
301 | + $search->compare('==', 'product.id', $productIds), |
|
302 | 302 | $search->getConditions(), |
303 | 303 | ); |
304 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
305 | - $search->setSlice( 0, count( $productIds ) ); |
|
304 | + $search->setConditions($search->combine('&&', $expr)); |
|
305 | + $search->setSlice(0, count($productIds)); |
|
306 | 306 | |
307 | - return $manager->searchItems( $search, $domains ); |
|
307 | + return $manager->searchItems($search, $domains); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
318 | 318 | * @since 2017.03 |
319 | 319 | */ |
320 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
320 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
321 | 321 | { |
322 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total ); |
|
322 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children |
330 | 330 | * @return array List of catalog IDs |
331 | 331 | */ |
332 | - protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item ) |
|
332 | + protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item) |
|
333 | 333 | { |
334 | - $list = array( $item->getId() ); |
|
334 | + $list = array($item->getId()); |
|
335 | 335 | |
336 | - foreach( $item->getChildren() as $child ) { |
|
337 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) ); |
|
336 | + foreach ($item->getChildren() as $child) { |
|
337 | + $list = array_merge($list, $this->getCatalogIdsFromTree($child)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $list; |
@@ -347,13 +347,13 @@ discard block |
||
347 | 347 | * @param array $ids List of IDs to validate |
348 | 348 | * @return array List of validated IDs |
349 | 349 | */ |
350 | - protected function validateIds( array $ids ) |
|
350 | + protected function validateIds(array $ids) |
|
351 | 351 | { |
352 | 352 | $list = []; |
353 | 353 | |
354 | - foreach( $ids as $id ) |
|
354 | + foreach ($ids as $id) |
|
355 | 355 | { |
356 | - if( $id != '' ) { |
|
356 | + if ($id != '') { |
|
357 | 357 | $list[] = (int) $id; |
358 | 358 | } |
359 | 359 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param boolean $default Use default criteria to limit orders |
46 | 46 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
47 | 47 | */ |
48 | - public function getItem( $id, $default = true ); |
|
48 | + public function getItem($id, $default = true); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param integer &$total|null Variable that will contain the total number of available items |
56 | 56 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
57 | 57 | */ |
58 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
58 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
80 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
102 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -117,5 +117,5 @@ discard block |
||
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
120 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
121 | 121 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Order\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @param string $type Arbitrary order type (max. eight chars) |
67 | 67 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
68 | 68 | */ |
69 | - public function addItem( $baseId, $type ) |
|
69 | + public function addItem($baseId, $type) |
|
70 | 70 | { |
71 | - return $this->controller->addItem( $baseId, $type ); |
|
71 | + return $this->controller->addItem($baseId, $type); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param boolean $default Use default criteria to limit orders |
91 | 91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
92 | 92 | */ |
93 | - public function getItem( $id, $default = true ) |
|
93 | + public function getItem($id, $default = true) |
|
94 | 94 | { |
95 | - return $this->controller->getItem( $id ); |
|
95 | + return $this->controller->getItem($id); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param integer &$total|null Variable that will contain the total number of available items |
104 | 104 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
105 | 105 | */ |
106 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
106 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
107 | 107 | { |
108 | - return $this->controller->searchItems( $filter, $total ); |
|
108 | + return $this->controller->searchItems($filter, $total); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
129 | 129 | * @return void |
130 | 130 | */ |
131 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
131 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
132 | 132 | { |
133 | - $this->getController()->block( $orderItem ); |
|
133 | + $this->getController()->block($orderItem); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
154 | 154 | * @return void |
155 | 155 | */ |
156 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
156 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
157 | 157 | { |
158 | - $this->getController()->unblock( $orderItem ); |
|
158 | + $this->getController()->unblock($orderItem); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
175 | 175 | * @return void |
176 | 176 | */ |
177 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
177 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
178 | 178 | { |
179 | - $this->getController()->update( $orderItem ); |
|
179 | + $this->getController()->update($orderItem); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * @param string $type Arbitrary order type (max. eight chars) |
30 | 30 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
31 | 31 | */ |
32 | - public function addItem( $baseId, $type ) |
|
32 | + public function addItem($baseId, $type) |
|
33 | 33 | { |
34 | 34 | $total = 0; |
35 | 35 | $context = $this->getContext(); |
36 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
36 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
37 | 37 | |
38 | 38 | /** controller/frontend/order/limit-seconds |
39 | 39 | * Order limitation time frame in seconds |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | * @see controller/frontend/basket/limit-count |
52 | 52 | * @see controller/frontend/basket/limit-seconds |
53 | 53 | */ |
54 | - $seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 ); |
|
54 | + $seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300); |
|
55 | 55 | |
56 | 56 | $search = $manager->createSearch(); |
57 | 57 | $expr = [ |
58 | - $search->compare( '==', 'order.baseid', $baseId ), |
|
59 | - $search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ), |
|
58 | + $search->compare('==', 'order.baseid', $baseId), |
|
59 | + $search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)), |
|
60 | 60 | ]; |
61 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
62 | - $search->setSlice( 0, 0 ); |
|
61 | + $search->setConditions($search->combine('&&', $expr)); |
|
62 | + $search->setSlice(0, 0); |
|
63 | 63 | |
64 | - $manager->searchItems( $search, [], $total ); |
|
64 | + $manager->searchItems($search, [], $total); |
|
65 | 65 | |
66 | - if( $total > 0 ) { |
|
67 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) ); |
|
66 | + if ($total > 0) { |
|
67 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created')); |
|
68 | 68 | } |
69 | 69 | |
70 | - $item = $manager->createItem()->setBaseId( $baseId )->setType( $type ); |
|
71 | - return $manager->saveItem( $item ); |
|
70 | + $item = $manager->createItem()->setBaseId($baseId)->setType($type); |
|
71 | + return $manager->saveItem($item); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function createFilter() |
81 | 81 | { |
82 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true ); |
|
82 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -90,30 +90,30 @@ discard block |
||
90 | 90 | * @param boolean $default Use default criteria to limit orders |
91 | 91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
92 | 92 | */ |
93 | - public function getItem( $id, $default = true ) |
|
93 | + public function getItem($id, $default = true) |
|
94 | 94 | { |
95 | 95 | $context = $this->getContext(); |
96 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
96 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
97 | 97 | |
98 | - $search = $manager->createSearch( true ); |
|
98 | + $search = $manager->createSearch(true); |
|
99 | 99 | $expr = [ |
100 | - $search->compare( '==', 'order.id', $id ), |
|
100 | + $search->compare('==', 'order.id', $id), |
|
101 | 101 | $search->getConditions(), |
102 | 102 | ]; |
103 | 103 | |
104 | - if( $default !== false ) { |
|
105 | - $expr[] = $search->compare( '==', 'order.editor', $context->getEditor() ); |
|
104 | + if ($default !== false) { |
|
105 | + $expr[] = $search->compare('==', 'order.editor', $context->getEditor()); |
|
106 | 106 | } |
107 | 107 | |
108 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
108 | + $search->setConditions($search->combine('&&', $expr)); |
|
109 | 109 | |
110 | - $items = $manager->searchItems( $search ); |
|
110 | + $items = $manager->searchItems($search); |
|
111 | 111 | |
112 | - if( ( $item = reset( $items ) ) !== false ) { |
|
112 | + if (($item = reset($items)) !== false) { |
|
113 | 113 | return $item; |
114 | 114 | } |
115 | 115 | |
116 | - throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) ); |
|
116 | + throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id)); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * @param \Aimeos\MShop\Order\Item\Iface $item Order object |
124 | 124 | * @return \Aimeos\MShop\Order\Item\Iface Saved order item |
125 | 125 | */ |
126 | - public function saveItem( \Aimeos\MShop\Order\Item\Iface $item ) |
|
126 | + public function saveItem(\Aimeos\MShop\Order\Item\Iface $item) |
|
127 | 127 | { |
128 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' ); |
|
129 | - return $manager->saveItem( $item ); |
|
128 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order'); |
|
129 | + return $manager->saveItem($item); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @param integer|null &$total Variable that will contain the total number of available items |
138 | 138 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
139 | 139 | */ |
140 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
140 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
141 | 141 | { |
142 | 142 | $context = $this->getContext(); |
143 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
143 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
144 | 144 | |
145 | 145 | $expr = [ |
146 | 146 | $filter->getConditions(), |
147 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
147 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
148 | 148 | ]; |
149 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
149 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
150 | 150 | |
151 | - return $manager->searchItems( $filter, [], $total ); |
|
151 | + return $manager->searchItems($filter, [], $total); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
172 | 172 | */ |
173 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
173 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
174 | 174 | { |
175 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem ); |
|
175 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
196 | 196 | */ |
197 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
197 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
198 | 198 | { |
199 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem ); |
|
199 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
216 | 216 | */ |
217 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
|
217 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem) |
|
218 | 218 | { |
219 | - \Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem ); |
|
219 | + \Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem); |
|
220 | 220 | } |
221 | 221 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Catalog\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @param string $name Name of the manager |
66 | 66 | * @return \Aimeos\MShop\Common\Manager\Iface Manager object |
67 | 67 | */ |
68 | - public function createManager( $name ) |
|
68 | + public function createManager($name) |
|
69 | 69 | { |
70 | - return $this->controller->createManager( $name ); |
|
70 | + return $this->controller->createManager($name); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
94 | 94 | * @since 2017.03 |
95 | 95 | */ |
96 | - public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
|
96 | + public function getPath($id, array $domains = array('text', 'media')) |
|
97 | 97 | { |
98 | - return $this->controller->getPath( $id, $domains ); |
|
98 | + return $this->controller->getPath($id, $domains); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
111 | 111 | * @since 2017.03 |
112 | 112 | */ |
113 | - public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
114 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
113 | + public function getTree($id = null, array $domains = array('text', 'media'), |
|
114 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
115 | 115 | { |
116 | - return $this->controller->getTree( $id, $domains, $level, $search ); |
|
116 | + return $this->controller->getTree($id, $domains, $level, $search); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @return \Aimeos\MShop\Common\Manager\Iface Manager object |
30 | 30 | * @since 2015.08 |
31 | 31 | */ |
32 | - public function createManager( $name ) |
|
32 | + public function createManager($name) |
|
33 | 33 | { |
34 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), $name ); |
|
34 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), $name); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function createFilter() |
45 | 45 | { |
46 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->createSearch( true ); |
|
46 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->createSearch(true); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return array Associative list of items implementing \Aimeos\MShop\Catalog\Item\Iface with their IDs as keys |
56 | 56 | * @since 2017.03 |
57 | 57 | */ |
58 | - public function getPath( $id, array $domains = array( 'text', 'media' ) ) |
|
58 | + public function getPath($id, array $domains = array('text', 'media')) |
|
59 | 59 | { |
60 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getPath( $id, $domains ); |
|
60 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getPath($id, $domains); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @return \Aimeos\MShop\Catalog\Item\Iface Catalog node, maybe with children depending on the level constant |
73 | 73 | * @since 2017.03 |
74 | 74 | */ |
75 | - public function getTree( $id = null, array $domains = array( 'text', 'media' ), |
|
76 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null ) |
|
75 | + public function getTree($id = null, array $domains = array('text', 'media'), |
|
76 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE, \Aimeos\MW\Criteria\Iface $search = null) |
|
77 | 77 | { |
78 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' )->getTree( $id, $domains, $level, $search ); |
|
78 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog')->getTree($id, $domains, $level, $search); |
|
79 | 79 | } |
80 | 80 | } |
@@ -17,112 +17,112 @@ discard block |
||
17 | 17 | |
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
20 | + \Aimeos\MShop\Factory::setCache(true); |
|
21 | 21 | |
22 | 22 | $this->context = \TestHelperFrontend::getContext(); |
23 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context ); |
|
23 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public static function setUpBeforeClass() |
28 | 28 | { |
29 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
30 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
29 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
30 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
31 | 31 | self::$basket = $orderBaseMgr->createItem(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | protected function tearDown() |
36 | 36 | { |
37 | - unset( $this->object, $this->context ); |
|
37 | + unset($this->object, $this->context); |
|
38 | 38 | |
39 | - \Aimeos\MShop\Factory::setCache( false ); |
|
39 | + \Aimeos\MShop\Factory::setCache(false); |
|
40 | 40 | \Aimeos\MShop\Factory::clear(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCheckAttributes() |
45 | 45 | { |
46 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
47 | - $this->assertEquals( [], $attributes ); |
|
46 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
47 | + $this->assertEquals([], $attributes); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetProviders() |
52 | 52 | { |
53 | - $providers = $this->object->getProviders( 'delivery' ); |
|
54 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
53 | + $providers = $this->object->getProviders('delivery'); |
|
54 | + $this->assertGreaterThan(0, count($providers)); |
|
55 | 55 | |
56 | - foreach( $providers as $provider ) { |
|
57 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
56 | + foreach ($providers as $provider) { |
|
57 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetProvider() |
63 | 63 | { |
64 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
65 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
64 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
65 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testProcess() |
70 | 70 | { |
71 | 71 | $form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard(); |
72 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
73 | - $serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId(); |
|
72 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
73 | + $serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId(); |
|
74 | 74 | |
75 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
75 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
76 | 76 | ->disableOriginalConstructor() |
77 | - ->setMethods( ['process'] ) |
|
77 | + ->setMethods(['process']) |
|
78 | 78 | ->getMock(); |
79 | 79 | |
80 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
81 | - ->setConstructorArgs( [$this->context] ) |
|
82 | - ->setMethods( ['getProvider'] ) |
|
80 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
81 | + ->setConstructorArgs([$this->context]) |
|
82 | + ->setMethods(['getProvider']) |
|
83 | 83 | ->getMock(); |
84 | 84 | |
85 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
85 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
86 | 86 | |
87 | - $provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) ); |
|
88 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
87 | + $provider->expects($this->once())->method('process')->will($this->returnValue($form)); |
|
88 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
89 | 89 | |
90 | 90 | |
91 | - $result = $this->object->process( $item, $serviceId, [], [] ); |
|
92 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result ); |
|
91 | + $result = $this->object->process($item, $serviceId, [], []); |
|
92 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
96 | 96 | public function testUpdateSync() |
97 | 97 | { |
98 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
98 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
99 | 99 | |
100 | - $stream = $this->getMockBuilder( 'Psr\Http\Message\StreamInterface' )->getMock(); |
|
101 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
102 | - $response = $this->getMockBuilder( '\Aimeos\MW\View\Helper\Response\Iface' ) |
|
100 | + $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')->getMock(); |
|
101 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
102 | + $response = $this->getMockBuilder('\Aimeos\MW\View\Helper\Response\Iface') |
|
103 | 103 | ->getMock(); |
104 | 104 | |
105 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
106 | - ->setMethods( ['updateSync', 'query', 'isImplemented'] ) |
|
105 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
106 | + ->setMethods(['updateSync', 'query', 'isImplemented']) |
|
107 | 107 | ->disableOriginalConstructor() |
108 | 108 | ->getMock(); |
109 | 109 | |
110 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
111 | - ->setConstructorArgs( array( $this->context ) ) |
|
112 | - ->setMethods( ['getProvider'] ) |
|
110 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
111 | + ->setConstructorArgs(array($this->context)) |
|
112 | + ->setMethods(['getProvider']) |
|
113 | 113 | ->getMock(); |
114 | 114 | |
115 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
115 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
116 | 116 | |
117 | 117 | |
118 | - $request->expects( $this->once() )->method( 'getQueryParams' )->will( $this->returnValue( ['code' => 'unitcode'] ) ); |
|
119 | - $response->expects( $this->once() )->method( 'createStreamFromString' )->will( $this->returnValue( $stream ) ); |
|
120 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
121 | - $provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) ); |
|
122 | - $provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) ); |
|
123 | - $provider->expects( $this->once() )->method( 'query' ); |
|
118 | + $request->expects($this->once())->method('getQueryParams')->will($this->returnValue(['code' => 'unitcode'])); |
|
119 | + $response->expects($this->once())->method('createStreamFromString')->will($this->returnValue($stream)); |
|
120 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
121 | + $provider->expects($this->once())->method('updateSync')->will($this->returnValue($item)); |
|
122 | + $provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true)); |
|
123 | + $provider->expects($this->once())->method('query'); |
|
124 | 124 | |
125 | - $this->object->updateSync( $request, $response, [], 'paypalexpress', -1 ); |
|
125 | + $this->object->updateSync($request, $response, [], 'paypalexpress', -1); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function getServiceItem() |
133 | 133 | { |
134 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
135 | - return $manager->findItem( 'unitcode' ); |
|
134 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
135 | + return $manager->findItem('unitcode'); |
|
136 | 136 | } |
137 | 137 | } |
@@ -20,118 +20,118 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
29 | 29 | ->getMockForAbstractClass(); |
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | protected function tearDown() |
34 | 34 | { |
35 | - unset( $this->context, $this->object, $this->stub ); |
|
35 | + unset($this->context, $this->object, $this->stub); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testConstructException() |
40 | 40 | { |
41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
46 | + ->setConstructorArgs([$stub, $this->context]) |
|
47 | 47 | ->getMockForAbstractClass(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testCall() |
52 | 52 | { |
53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base') |
|
59 | + ->setConstructorArgs([$stub, $this->context]) |
|
60 | 60 | ->getMockForAbstractClass(); |
61 | 61 | |
62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
63 | 63 | |
64 | - $this->assertTrue( $object->invalid() ); |
|
64 | + $this->assertTrue($object->invalid()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | public function testCheckAttributes() |
69 | 69 | { |
70 | - $this->stub->expects( $this->once() )->method( 'checkAttributes' ) |
|
71 | - ->will( $this->returnValue( [] ) ); |
|
70 | + $this->stub->expects($this->once())->method('checkAttributes') |
|
71 | + ->will($this->returnValue([])); |
|
72 | 72 | |
73 | - $this->assertEquals( [], $this->object->checkAttributes( -1, [] ) ); |
|
73 | + $this->assertEquals([], $this->object->checkAttributes( -1, [] )); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
77 | 77 | public function testGetProvider() |
78 | 78 | { |
79 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' ); |
|
80 | - $provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) ); |
|
79 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'service'); |
|
80 | + $provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery')); |
|
81 | 81 | |
82 | - $this->stub->expects( $this->once() )->method( 'getProvider' ) |
|
83 | - ->will( $this->returnValue( $provider ) ); |
|
82 | + $this->stub->expects($this->once())->method('getProvider') |
|
83 | + ->will($this->returnValue($provider)); |
|
84 | 84 | |
85 | - $this->assertSame( $provider, $this->object->getProvider( -1 ) ); |
|
85 | + $this->assertSame($provider, $this->object->getProvider( -1 )); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testGetProviders() |
90 | 90 | { |
91 | - $this->stub->expects( $this->once() )->method( 'getProviders' ) |
|
92 | - ->will( $this->returnValue( [] ) ); |
|
91 | + $this->stub->expects($this->once())->method('getProviders') |
|
92 | + ->will($this->returnValue([])); |
|
93 | 93 | |
94 | - $this->assertEquals( [], $this->object->getProviders( 'payment' ) ); |
|
94 | + $this->assertEquals([], $this->object->getProviders('payment')); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testProcess() |
99 | 99 | { |
100 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
100 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
101 | 101 | |
102 | - $this->stub->expects( $this->once() )->method( 'process' ) |
|
103 | - ->will( $this->returnValue( new \Aimeos\MShop\Common\Item\Helper\Form\Standard() ) ); |
|
102 | + $this->stub->expects($this->once())->method('process') |
|
103 | + ->will($this->returnValue(new \Aimeos\MShop\Common\Item\Helper\Form\Standard())); |
|
104 | 104 | |
105 | - $this->assertInstanceOf( 'Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process( $item, -1, [], [] ) ); |
|
105 | + $this->assertInstanceOf('Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process($item, -1, [], [])); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | public function testUpdateSync() |
110 | 110 | { |
111 | - $response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock(); |
|
112 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
113 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
111 | + $response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
|
112 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
113 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
114 | 114 | |
115 | - $this->stub->expects( $this->once() )->method( 'updateSync' ) |
|
116 | - ->will( $this->returnValue( $item ) ); |
|
115 | + $this->stub->expects($this->once())->method('updateSync') |
|
116 | + ->will($this->returnValue($item)); |
|
117 | 117 | |
118 | - $this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) ); |
|
118 | + $this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1)); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testGetController() |
123 | 123 | { |
124 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
124 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
125 | 125 | |
126 | - $this->assertSame( $this->stub, $result ); |
|
126 | + $this->assertSame($this->stub, $result); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
130 | - protected function access( $name ) |
|
130 | + protected function access($name) |
|
131 | 131 | { |
132 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
133 | - $method = $class->getMethod( $name ); |
|
134 | - $method->setAccessible( true ); |
|
132 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
133 | + $method = $class->getMethod($name); |
|
134 | + $method->setAccessible(true); |
|
135 | 135 | |
136 | 136 | return $method; |
137 | 137 | } |