@@ -28,14 +28,14 @@ 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 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
34 | 34 | |
35 | 35 | $item = $manager->createItem(); |
36 | - $item->fromArray( $values ); |
|
37 | - $item->setId( null ); |
|
38 | - $manager->saveItem( $item ); |
|
36 | + $item->fromArray($values); |
|
37 | + $item->setId(null); |
|
38 | + $manager->saveItem($item); |
|
39 | 39 | |
40 | 40 | return $item; |
41 | 41 | } |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
48 | 48 | */ |
49 | - public function createItem( array $values = [] ) |
|
49 | + public function createItem(array $values = []) |
|
50 | 50 | { |
51 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
51 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
52 | 52 | |
53 | 53 | $item = $manager->createItem(); |
54 | - $item->fromArray( $values ); |
|
55 | - $item->setId( null ); |
|
56 | - $item->setStatus( 1 ); |
|
54 | + $item->fromArray($values); |
|
55 | + $item->setId(null); |
|
56 | + $item->setStatus(1); |
|
57 | 57 | |
58 | 58 | return $item; |
59 | 59 | } |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | * @param string $id Unique customer ID |
66 | 66 | * @since 2017.04 |
67 | 67 | */ |
68 | - public function deleteItem( $id ) |
|
68 | + public function deleteItem($id) |
|
69 | 69 | { |
70 | - $this->checkUser( $id ); |
|
70 | + $this->checkUser($id); |
|
71 | 71 | |
72 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
73 | - $manager->deleteItem( $id ); |
|
72 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
73 | + $manager->deleteItem($id); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
83 | 83 | * @since 2017.04 |
84 | 84 | */ |
85 | - public function editItem( $id, array $values ) |
|
85 | + public function editItem($id, array $values) |
|
86 | 86 | { |
87 | - $this->checkUser( $id ); |
|
87 | + $this->checkUser($id); |
|
88 | 88 | |
89 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
90 | - $item = $manager->getItem( $id, [], true ); |
|
89 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
90 | + $item = $manager->getItem($id, [], true); |
|
91 | 91 | |
92 | - unset( $values['customer.id'] ); |
|
93 | - $item->fromArray( $values ); |
|
92 | + unset($values['customer.id']); |
|
93 | + $item->fromArray($values); |
|
94 | 94 | |
95 | - $manager->saveItem( $item ); |
|
95 | + $manager->saveItem($item); |
|
96 | 96 | |
97 | 97 | return $item; |
98 | 98 | } |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
107 | 107 | * @since 2017.04 |
108 | 108 | */ |
109 | - public function getItem( $id = null, array $domains = [] ) |
|
109 | + public function getItem($id = null, array $domains = []) |
|
110 | 110 | { |
111 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
111 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
112 | 112 | |
113 | - if( $id == null ) { |
|
114 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
113 | + if ($id == null) { |
|
114 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
115 | 115 | } |
116 | 116 | |
117 | - $this->checkUser( $id ); |
|
117 | + $this->checkUser($id); |
|
118 | 118 | |
119 | - return $manager->getItem( $id, $domains, true ); |
|
119 | + return $manager->getItem($id, $domains, true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
131 | 131 | * @since 2017.04 |
132 | 132 | */ |
133 | - public function findItem( $code, array $domains = [] ) |
|
133 | + public function findItem($code, array $domains = []) |
|
134 | 134 | { |
135 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
135 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param \Aimeos\MShop\Customer\Item\Iface Customer item |
143 | 143 | */ |
144 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
144 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
145 | 145 | { |
146 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
146 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,17 +154,17 @@ discard block |
||
154 | 154 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
155 | 155 | * @since 2017.04 |
156 | 156 | */ |
157 | - public function addAddressItem( array $values ) |
|
157 | + public function addAddressItem(array $values) |
|
158 | 158 | { |
159 | 159 | $context = $this->getContext(); |
160 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
160 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
161 | 161 | |
162 | 162 | $item = $manager->createItem(); |
163 | - $item->fromArray( $values ); |
|
164 | - $item->setId( null ); |
|
165 | - $item->setParentId( $context->getUserId() ); |
|
163 | + $item->fromArray($values); |
|
164 | + $item->setId(null); |
|
165 | + $item->setParentId($context->getUserId()); |
|
166 | 166 | |
167 | - $manager->saveItem( $item ); |
|
167 | + $manager->saveItem($item); |
|
168 | 168 | |
169 | 169 | return $item; |
170 | 170 | } |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
177 | 177 | */ |
178 | - public function createAddressItem( array $values = [] ) |
|
178 | + public function createAddressItem(array $values = []) |
|
179 | 179 | { |
180 | 180 | $context = $this->getContext(); |
181 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
181 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
182 | 182 | |
183 | 183 | $item = $manager->createItem(); |
184 | - $item->fromArray( $values ); |
|
185 | - $item->setId( null ); |
|
184 | + $item->fromArray($values); |
|
185 | + $item->setId(null); |
|
186 | 186 | |
187 | - $item->setParentId( $context->getUserId() ); |
|
187 | + $item->setParentId($context->getUserId()); |
|
188 | 188 | |
189 | 189 | return $item; |
190 | 190 | } |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | * @param string $id Unique customer address ID |
197 | 197 | * @since 2017.04 |
198 | 198 | */ |
199 | - public function deleteAddressItem( $id ) |
|
199 | + public function deleteAddressItem($id) |
|
200 | 200 | { |
201 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
201 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
202 | 202 | |
203 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
203 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
204 | 204 | |
205 | - $manager->deleteItem( $id ); |
|
205 | + $manager->deleteItem($id); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
215 | 215 | * @since 2017.04 |
216 | 216 | */ |
217 | - public function editAddressItem( $id, array $values ) |
|
217 | + public function editAddressItem($id, array $values) |
|
218 | 218 | { |
219 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
219 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
220 | 220 | |
221 | - $item = $manager->getItem( $id, [], true ); |
|
222 | - $this->checkUser( $item->getParentId() ); |
|
221 | + $item = $manager->getItem($id, [], true); |
|
222 | + $this->checkUser($item->getParentId()); |
|
223 | 223 | |
224 | - unset( $values['customer.address.id'] ); |
|
225 | - $item->fromArray( $values ); |
|
224 | + unset($values['customer.address.id']); |
|
225 | + $item->fromArray($values); |
|
226 | 226 | |
227 | - $manager->saveItem( $item ); |
|
227 | + $manager->saveItem($item); |
|
228 | 228 | |
229 | 229 | return $item; |
230 | 230 | } |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
238 | 238 | * @since 2017.04 |
239 | 239 | */ |
240 | - public function getAddressItem( $id ) |
|
240 | + public function getAddressItem($id) |
|
241 | 241 | { |
242 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
242 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
243 | 243 | |
244 | - $item = $manager->getItem( $id ); |
|
245 | - $this->checkUser( $item->getParentId() ); |
|
244 | + $item = $manager->getItem($id); |
|
245 | + $this->checkUser($item->getParentId()); |
|
246 | 246 | |
247 | 247 | return $item; |
248 | 248 | } |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
255 | 255 | */ |
256 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
256 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
257 | 257 | { |
258 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
258 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
267 | 267 | * @since 2017.06 |
268 | 268 | */ |
269 | - public function addListItem( array $values ) |
|
269 | + public function addListItem(array $values) |
|
270 | 270 | { |
271 | 271 | $context = $this->getContext(); |
272 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
272 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
273 | 273 | |
274 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
274 | + if (!isset($values['customer.lists.typeid'])) |
|
275 | 275 | { |
276 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
277 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
276 | + if (!isset($values['customer.lists.type'])) { |
|
277 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
278 | 278 | } |
279 | 279 | |
280 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
281 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
280 | + if (!isset($values['customer.lists.domain'])) { |
|
281 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
282 | 282 | } |
283 | 283 | |
284 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
285 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
284 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
285 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
286 | 286 | $values['customer.lists.typeid'] = $typeItem->getId(); |
287 | 287 | } |
288 | 288 | |
289 | 289 | $item = $manager->createItem(); |
290 | - $item->fromArray( $values ); |
|
291 | - $item->setId( null ); |
|
292 | - $item->setParentId( $context->getUserId() ); |
|
290 | + $item->fromArray($values); |
|
291 | + $item->setId(null); |
|
292 | + $item->setParentId($context->getUserId()); |
|
293 | 293 | |
294 | - $manager->saveItem( $item ); |
|
294 | + $manager->saveItem($item); |
|
295 | 295 | |
296 | 296 | return $item; |
297 | 297 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | public function createListsFilter() |
307 | 307 | { |
308 | 308 | $context = $this->getContext(); |
309 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
309 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
310 | 310 | |
311 | 311 | $filter = $manager->createSearch(); |
312 | - $filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) ); |
|
312 | + $filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId())); |
|
313 | 313 | |
314 | 314 | return $filter; |
315 | 315 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | * @param string $id Unique customer address ID |
322 | 322 | * @since 2017.06 |
323 | 323 | */ |
324 | - public function deleteListItem( $id ) |
|
324 | + public function deleteListItem($id) |
|
325 | 325 | { |
326 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
326 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
327 | 327 | |
328 | - $this->checkUser( $manager->getItem( $id )->getParentId() ); |
|
328 | + $this->checkUser($manager->getItem($id)->getParentId()); |
|
329 | 329 | |
330 | - $manager->deleteItem( $id ); |
|
330 | + $manager->deleteItem($id); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -339,33 +339,33 @@ discard block |
||
339 | 339 | * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item |
340 | 340 | * @since 2017.06 |
341 | 341 | */ |
342 | - public function editListItem( $id, array $values ) |
|
342 | + public function editListItem($id, array $values) |
|
343 | 343 | { |
344 | 344 | $context = $this->getContext(); |
345 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' ); |
|
345 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists'); |
|
346 | 346 | |
347 | - $item = $manager->getItem( $id, [], true ); |
|
348 | - $this->checkUser( $item->getParentId() ); |
|
347 | + $item = $manager->getItem($id, [], true); |
|
348 | + $this->checkUser($item->getParentId()); |
|
349 | 349 | |
350 | - if( !isset( $values['customer.lists.typeid'] ) ) |
|
350 | + if (!isset($values['customer.lists.typeid'])) |
|
351 | 351 | { |
352 | - if( !isset( $values['customer.lists.type'] ) ) { |
|
353 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) ); |
|
352 | + if (!isset($values['customer.lists.type'])) { |
|
353 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code')); |
|
354 | 354 | } |
355 | 355 | |
356 | - if( !isset( $values['customer.lists.domain'] ) ) { |
|
357 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) ); |
|
356 | + if (!isset($values['customer.lists.domain'])) { |
|
357 | + throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain')); |
|
358 | 358 | } |
359 | 359 | |
360 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' ); |
|
361 | - $typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] ); |
|
360 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type'); |
|
361 | + $typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']); |
|
362 | 362 | $values['customer.lists.typeid'] = $typeItem->getId(); |
363 | 363 | } |
364 | 364 | |
365 | - unset( $values['customer.lists.id'] ); |
|
366 | - $item->fromArray( $values ); |
|
365 | + unset($values['customer.lists.id']); |
|
366 | + $item->fromArray($values); |
|
367 | 367 | |
368 | - $manager->saveItem( $item ); |
|
368 | + $manager->saveItem($item); |
|
369 | 369 | |
370 | 370 | return $item; |
371 | 371 | } |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
379 | 379 | * @since 2017.06 |
380 | 380 | */ |
381 | - public function getListItem( $id ) |
|
381 | + public function getListItem($id) |
|
382 | 382 | { |
383 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
384 | - $item = $manager->getItem( $id ); |
|
383 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
384 | + $item = $manager->getItem($id); |
|
385 | 385 | |
386 | - $this->checkUser( $item->getParentId() ); |
|
386 | + $this->checkUser($item->getParentId()); |
|
387 | 387 | |
388 | 388 | return $item; |
389 | 389 | } |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items |
398 | 398 | * @since 2017.06 |
399 | 399 | */ |
400 | - public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
400 | + public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
401 | 401 | { |
402 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
402 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
403 | 403 | |
404 | - return $manager->searchItems( $filter, [], $total ); |
|
404 | + return $manager->searchItems($filter, [], $total); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -411,12 +411,12 @@ discard block |
||
411 | 411 | * @param string $id Unique customer ID |
412 | 412 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
413 | 413 | */ |
414 | - protected function checkUser( $id ) |
|
414 | + protected function checkUser($id) |
|
415 | 415 | { |
416 | - if( $id != $this->getContext()->getUserId() ) |
|
416 | + if ($id != $this->getContext()->getUserId()) |
|
417 | 417 | { |
418 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
419 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
418 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
419 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | } |