@@ -40,54 +40,54 @@ discard block |
||
40 | 40 | * @param array $data List of CSV fields with position as key and data as value |
41 | 41 | * @return array List of data which hasn't been imported |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data ) |
|
43 | + public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data) |
|
44 | 44 | { |
45 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
45 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
46 | 46 | $manager->begin(); |
47 | 47 | |
48 | 48 | try |
49 | 49 | { |
50 | 50 | $propMap = []; |
51 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
52 | - $items = $this->getPropertyItems( $product->getId() ); |
|
51 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
52 | + $items = $this->getPropertyItems($product->getId()); |
|
53 | 53 | |
54 | - foreach( $items as $item ) { |
|
55 | - $propMap[ $item->getValue() ][ $item->getType() ] = $item; |
|
54 | + foreach ($items as $item) { |
|
55 | + $propMap[$item->getValue()][$item->getType()] = $item; |
|
56 | 56 | } |
57 | 57 | |
58 | - foreach( $map as $list ) |
|
58 | + foreach ($map as $list) |
|
59 | 59 | { |
60 | - $typecode = trim( $list['product.property.type'] ); |
|
61 | - $value = trim( $list['product.property.value'] ); |
|
60 | + $typecode = trim($list['product.property.type']); |
|
61 | + $value = trim($list['product.property.value']); |
|
62 | 62 | |
63 | - if( $typecode == '' || $value == '' ) { |
|
63 | + if ($typecode == '' || $value == '') { |
|
64 | 64 | continue; |
65 | 65 | } |
66 | 66 | |
67 | - $list['product.property.typeid'] = $this->getTypeId( 'product/property/type', 'product', $typecode ); |
|
67 | + $list['product.property.typeid'] = $this->getTypeId('product/property/type', 'product', $typecode); |
|
68 | 68 | $list['product.property.parentid'] = $product->getId(); |
69 | 69 | |
70 | - if( isset( $propMap[$value][$typecode] ) ) |
|
70 | + if (isset($propMap[$value][$typecode])) |
|
71 | 71 | { |
72 | 72 | $item = $propMap[$value][$typecode]; |
73 | - unset( $items[ $item->getId() ] ); |
|
73 | + unset($items[$item->getId()]); |
|
74 | 74 | } |
75 | 75 | else |
76 | 76 | { |
77 | 77 | $item = $manager->createItem(); |
78 | 78 | } |
79 | 79 | |
80 | - $item->fromArray( $list ); |
|
81 | - $manager->saveItem( $item, false ); |
|
80 | + $item->fromArray($list); |
|
81 | + $manager->saveItem($item, false); |
|
82 | 82 | } |
83 | 83 | |
84 | - $manager->deleteItems( array_keys( $items ) ); |
|
84 | + $manager->deleteItems(array_keys($items)); |
|
85 | 85 | |
86 | - $data = $this->getObject()->process( $product, $data ); |
|
86 | + $data = $this->getObject()->process($product, $data); |
|
87 | 87 | |
88 | 88 | $manager->commit(); |
89 | 89 | } |
90 | - catch( \Exception $e ) |
|
90 | + catch (\Exception $e) |
|
91 | 91 | { |
92 | 92 | $manager->rollback(); |
93 | 93 | throw $e; |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | * @param string $prodid Unique product ID |
104 | 104 | * @return array Associative list of product property items |
105 | 105 | */ |
106 | - protected function getPropertyItems( $prodid ) |
|
106 | + protected function getPropertyItems($prodid) |
|
107 | 107 | { |
108 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
108 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
109 | 109 | |
110 | 110 | $search = $manager->createSearch(); |
111 | - $search->setConditions( $search->compare( '==', 'product.property.parentid', $prodid ) ); |
|
111 | + $search->setConditions($search->compare('==', 'product.property.parentid', $prodid)); |
|
112 | 112 | |
113 | - return $manager->searchItems( $search ); |
|
113 | + return $manager->searchItems($search); |
|
114 | 114 | } |
115 | 115 | } |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $item = $propMap[$value][$typecode]; |
73 | 73 | unset( $items[ $item->getId() ] ); |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | $item = $manager->createItem(); |
78 | 77 | } |
@@ -86,8 +85,7 @@ discard block |
||
86 | 85 | $data = $this->getObject()->process( $product, $data ); |
87 | 86 | |
88 | 87 | $manager->commit(); |
89 | - } |
|
90 | - catch( \Exception $e ) |
|
88 | + } catch( \Exception $e ) |
|
91 | 89 | { |
92 | 90 | $manager->rollback(); |
93 | 91 | throw $e; |
@@ -40,21 +40,21 @@ |
||
40 | 40 | * @param array $data List of CSV fields with position as key and data as value |
41 | 41 | * @return array List of data which hasn't been imported |
42 | 42 | */ |
43 | - public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data ) |
|
43 | + public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data) |
|
44 | 44 | { |
45 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
46 | - $map = $this->getMappedChunk( $data, $this->getMapping() ); |
|
45 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
46 | + $map = $this->getMappedChunk($data, $this->getMapping()); |
|
47 | 47 | |
48 | - foreach( $map as $list ) |
|
48 | + foreach ($map as $list) |
|
49 | 49 | { |
50 | - if( trim( $list['coupon.code.code'] ) == '' ) { |
|
50 | + if (trim($list['coupon.code.code']) == '') { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | - $item->fromArray( $list ); |
|
55 | - $manager->saveItem( $item ); |
|
54 | + $item->fromArray($list); |
|
55 | + $manager->saveItem($item); |
|
56 | 56 | } |
57 | 57 | |
58 | - return $this->getObject()->process( $item, $data ); |
|
58 | + return $this->getObject()->process($item, $data); |
|
59 | 59 | } |
60 | 60 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product export' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product export'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Exports all available products' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports all available products'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function run() |
52 | 52 | { |
53 | 53 | $container = $this->createContainer(); |
54 | - $this->export( $container ); |
|
54 | + $this->export($container); |
|
55 | 55 | $container->close(); |
56 | 56 | } |
57 | 57 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param \Aimeos\MW\Container\Content\Iface $content File content object |
63 | 63 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items |
64 | 64 | */ |
65 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) |
|
65 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) |
|
66 | 66 | { |
67 | 67 | /** controller/jobs/product/export/standard/template-items |
68 | 68 | * Relative path to the XML items template of the product site map job controller. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $view->exportItems = $items; |
96 | 96 | |
97 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
97 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @see controller/jobs/product/export/max-items |
124 | 124 | * @see controller/jobs/product/export/max-query |
125 | 125 | */ |
126 | - $location = $config->get( 'controller/jobs/product/export/location' ); |
|
126 | + $location = $config->get('controller/jobs/product/export/location'); |
|
127 | 127 | |
128 | 128 | /** controller/jobs/product/export/standard/container/type |
129 | 129 | * List of file container options for the export files |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @see controller/jobs/product/export/max-items |
141 | 141 | * @see controller/jobs/product/export/max-query |
142 | 142 | */ |
143 | - $container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' ); |
|
143 | + $container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory'); |
|
144 | 144 | |
145 | 145 | /** controller/jobs/product/export/standard/container/content |
146 | 146 | * List of file container options for the export files |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @see controller/jobs/product/export/max-items |
158 | 158 | * @see controller/jobs/product/export/max-query |
159 | 159 | */ |
160 | - $content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' ); |
|
160 | + $content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary'); |
|
161 | 161 | |
162 | 162 | /** controller/jobs/product/export/standard/container/options |
163 | 163 | * List of file container options for the export files |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | * @see controller/jobs/product/export/max-items |
175 | 175 | * @see controller/jobs/product/export/max-query |
176 | 176 | */ |
177 | - $options = $config->get( 'controller/jobs/product/export/standard/container/options', [] ); |
|
177 | + $options = $config->get('controller/jobs/product/export/standard/container/options', []); |
|
178 | 178 | |
179 | - if( $location === null ) |
|
179 | + if ($location === null) |
|
180 | 180 | { |
181 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location' ); |
|
182 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
181 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/location'); |
|
182 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
183 | 183 | } |
184 | 184 | |
185 | - return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options ); |
|
185 | + return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param integer $filenum New file number |
194 | 194 | * @return \Aimeos\MW\Container\Content\Iface New content object |
195 | 195 | */ |
196 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
196 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
197 | 197 | { |
198 | 198 | /** controller/jobs/product/export/standard/template-header |
199 | 199 | * Relative path to the XML site map header template of the product site map job controller. |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | $context = $this->getContext(); |
224 | 224 | $view = $context->getView(); |
225 | 225 | |
226 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
227 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
228 | - $container->add( $content ); |
|
226 | + $content = $container->create($this->getFilename($filenum)); |
|
227 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
228 | + $container->add($content); |
|
229 | 229 | |
230 | 230 | return $content; |
231 | 231 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param \Aimeos\MW\Container\Content\Iface $content |
238 | 238 | */ |
239 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
239 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
240 | 240 | { |
241 | 241 | /** controller/jobs/product/export/standard/template-footer |
242 | 242 | * Relative path to the XML site map footer template of the product site map job controller. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $context = $this->getContext(); |
267 | 267 | $view = $context->getView(); |
268 | 268 | |
269 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
269 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -276,45 +276,45 @@ discard block |
||
276 | 276 | * @param \Aimeos\MW\Container\Iface $container Container object |
277 | 277 | * @return array List of content (file) names |
278 | 278 | */ |
279 | - protected function export( \Aimeos\MW\Container\Iface $container ) |
|
279 | + protected function export(\Aimeos\MW\Container\Iface $container) |
|
280 | 280 | { |
281 | - $default = array( 'attribute', 'media', 'price', 'product', 'text' ); |
|
281 | + $default = array('attribute', 'media', 'price', 'product', 'text'); |
|
282 | 282 | |
283 | - $domains = $this->getConfig( 'domains', $default ); |
|
284 | - $maxItems = $this->getConfig( 'max-items', 10000 ); |
|
285 | - $maxQuery = $this->getConfig( 'max-query', 1000 ); |
|
283 | + $domains = $this->getConfig('domains', $default); |
|
284 | + $maxItems = $this->getConfig('max-items', 10000); |
|
285 | + $maxQuery = $this->getConfig('max-query', 1000); |
|
286 | 286 | |
287 | 287 | $start = 0; $filenum = 1; |
288 | 288 | $names = []; |
289 | 289 | |
290 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
290 | + $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
291 | 291 | |
292 | - $search = $productManager->createSearch( true ); |
|
293 | - $search->setSortations( array( $search->sort( '+', 'product.id' ) ) ); |
|
294 | - $search->setSlice( 0, $maxQuery ); |
|
292 | + $search = $productManager->createSearch(true); |
|
293 | + $search->setSortations(array($search->sort('+', 'product.id'))); |
|
294 | + $search->setSlice(0, $maxQuery); |
|
295 | 295 | |
296 | - $content = $this->createContent( $container, $filenum ); |
|
296 | + $content = $this->createContent($container, $filenum); |
|
297 | 297 | $names[] = $content->getResource(); |
298 | 298 | |
299 | 299 | do |
300 | 300 | { |
301 | - $items = $productManager->searchItems( $search, $domains ); |
|
302 | - $this->addItems( $content, $items ); |
|
301 | + $items = $productManager->searchItems($search, $domains); |
|
302 | + $this->addItems($content, $items); |
|
303 | 303 | |
304 | - $count = count( $items ); |
|
304 | + $count = count($items); |
|
305 | 305 | $start += $count; |
306 | - $search->setSlice( $start, $maxQuery ); |
|
306 | + $search->setSlice($start, $maxQuery); |
|
307 | 307 | |
308 | - if( $start + $maxQuery > $maxItems * $filenum ) |
|
308 | + if ($start + $maxQuery > $maxItems * $filenum) |
|
309 | 309 | { |
310 | - $this->closeContent( $content ); |
|
311 | - $content = $this->createContent( $container, ++$filenum ); |
|
310 | + $this->closeContent($content); |
|
311 | + $content = $this->createContent($container, ++$filenum); |
|
312 | 312 | $names[] = $content->getResource(); |
313 | 313 | } |
314 | 314 | } |
315 | - while( $count >= $search->getSliceSize() ); |
|
315 | + while ($count >= $search->getSliceSize()); |
|
316 | 316 | |
317 | - $this->closeContent( $content ); |
|
317 | + $this->closeContent($content); |
|
318 | 318 | |
319 | 319 | return $names; |
320 | 320 | } |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | * @param mixed $default Default value if name is unknown |
328 | 328 | * @return mixed Configuration value |
329 | 329 | */ |
330 | - protected function getConfig( $name, $default = null ) |
|
330 | + protected function getConfig($name, $default = null) |
|
331 | 331 | { |
332 | 332 | $config = $this->getContext()->getConfig(); |
333 | 333 | |
334 | - switch( $name ) |
|
334 | + switch ($name) |
|
335 | 335 | { |
336 | 336 | case 'domain': |
337 | 337 | /** controller/jobs/product/export/domains |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @see controller/jobs/product/export/max-items |
355 | 355 | * @see controller/jobs/product/export/max-query |
356 | 356 | */ |
357 | - return $config->get( 'controller/jobs/product/export/domains', $default ); |
|
357 | + return $config->get('controller/jobs/product/export/domains', $default); |
|
358 | 358 | |
359 | 359 | case 'max-items': |
360 | 360 | /** controller/jobs/product/export/max-items |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @see controller/jobs/product/export/max-query |
378 | 378 | * @see controller/jobs/product/export/domains |
379 | 379 | */ |
380 | - return $config->get( 'controller/jobs/product/export/max-items', $default ); |
|
380 | + return $config->get('controller/jobs/product/export/max-items', $default); |
|
381 | 381 | |
382 | 382 | case 'max-query': |
383 | 383 | /** controller/jobs/product/export/max-query |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @see controller/jobs/product/export/max-items |
401 | 401 | * @see controller/jobs/product/export/domains |
402 | 402 | */ |
403 | - return $config->get( 'controller/jobs/product/export/max-query', $default ); |
|
403 | + return $config->get('controller/jobs/product/export/max-query', $default); |
|
404 | 404 | |
405 | 405 | case 'filename': |
406 | 406 | /** controller/jobs/product/export/filename |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @see controller/jobs/product/export/max-query |
422 | 422 | * @see controller/jobs/product/export/domains |
423 | 423 | */ |
424 | - return $config->get( 'controller/jobs/product/export/filename', $default ); |
|
424 | + return $config->get('controller/jobs/product/export/filename', $default); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | return $default; |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * @param integer $number Current file number |
435 | 435 | * @return string New file name |
436 | 436 | */ |
437 | - protected function getFilename( $number ) |
|
437 | + protected function getFilename($number) |
|
438 | 438 | { |
439 | - return sprintf( $this->getConfig( 'filename', 'aimeos-products-%1$d_%2$s.xml' ), $number, date( 'Y-m-d_H:i:s' ) ); |
|
439 | + return sprintf($this->getConfig('filename', 'aimeos-products-%1$d_%2$s.xml'), $number, date('Y-m-d_H:i:s')); |
|
440 | 440 | } |
441 | 441 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Product site map' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Product site map'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Creates a product site map for search engines' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates a product site map for search engines'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $container = $this->createContainer(); |
54 | 54 | |
55 | - $files = $this->export( $container ); |
|
56 | - $this->createSitemapIndex( $container, $files ); |
|
55 | + $files = $this->export($container); |
|
56 | + $this->createSitemapIndex($container, $files); |
|
57 | 57 | |
58 | 58 | $container->close(); |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param \Aimeos\MW\Container\Content\Iface $content File content object |
66 | 66 | * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items |
67 | 67 | */ |
68 | - protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items ) |
|
68 | + protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items) |
|
69 | 69 | { |
70 | 70 | $config = $this->getContext()->getConfig(); |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @see controller/jobs/product/export/sitemap/max-items |
97 | 97 | * @see controller/jobs/product/export/sitemap/max-query |
98 | 98 | */ |
99 | - $changefreq = $config->get( 'controller/jobs/product/export/sitemap/changefreq', 'daily' ); |
|
99 | + $changefreq = $config->get('controller/jobs/product/export/sitemap/changefreq', 'daily'); |
|
100 | 100 | |
101 | 101 | /** controller/jobs/product/export/sitemap/standard/template-items |
102 | 102 | * Relative path to the XML items template of the product site map job controller. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $view->siteItems = $items; |
130 | 130 | $view->siteFreq = $changefreq; |
131 | 131 | |
132 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
132 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @see controller/jobs/product/export/sitemap/max-query |
176 | 176 | * @see controller/jobs/product/export/sitemap/changefreq |
177 | 177 | */ |
178 | - $location = $config->get( 'controller/jobs/product/export/sitemap/location' ); |
|
178 | + $location = $config->get('controller/jobs/product/export/sitemap/location'); |
|
179 | 179 | |
180 | 180 | /** controller/jobs/product/export/sitemap/container/options |
181 | 181 | * List of file container options for the site map files |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | * @see controller/jobs/product/export/sitemap/max-query |
197 | 197 | * @see controller/jobs/product/export/sitemap/changefreq |
198 | 198 | */ |
199 | - $default = array( 'gzip-mode' => 'wb' ); |
|
200 | - $options = $config->get( 'controller/jobs/product/export/sitemap/container/options', $default ); |
|
199 | + $default = array('gzip-mode' => 'wb'); |
|
200 | + $options = $config->get('controller/jobs/product/export/sitemap/container/options', $default); |
|
201 | 201 | |
202 | - if( $location === null ) |
|
202 | + if ($location === null) |
|
203 | 203 | { |
204 | - $msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location' ); |
|
205 | - throw new \Aimeos\Controller\Jobs\Exception( $msg ); |
|
204 | + $msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/product/export/sitemap/location'); |
|
205 | + throw new \Aimeos\Controller\Jobs\Exception($msg); |
|
206 | 206 | } |
207 | 207 | |
208 | - return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options ); |
|
208 | + return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param integer $filenum New file number |
217 | 217 | * @return \Aimeos\MW\Container\Content\Iface New content object |
218 | 218 | */ |
219 | - protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum ) |
|
219 | + protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum) |
|
220 | 220 | { |
221 | 221 | /** controller/jobs/product/export/sitemap/standard/template-header |
222 | 222 | * Relative path to the XML site map header template of the product site map job controller. |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $context = $this->getContext(); |
247 | 247 | $view = $context->getView(); |
248 | 248 | |
249 | - $content = $container->create( $this->getFilename( $filenum ) ); |
|
250 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
251 | - $container->add( $content ); |
|
249 | + $content = $container->create($this->getFilename($filenum)); |
|
250 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
251 | + $container->add($content); |
|
252 | 252 | |
253 | 253 | return $content; |
254 | 254 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param \Aimeos\MW\Container\Content\Iface $content |
261 | 261 | */ |
262 | - protected function closeContent( \Aimeos\MW\Container\Content\Iface $content ) |
|
262 | + protected function closeContent(\Aimeos\MW\Container\Content\Iface $content) |
|
263 | 263 | { |
264 | 264 | /** controller/jobs/product/export/sitemap/standard/template-footer |
265 | 265 | * Relative path to the XML site map footer template of the product site map job controller. |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $context = $this->getContext(); |
290 | 290 | $view = $context->getView(); |
291 | 291 | |
292 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
292 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param \Aimeos\MW\Container\Iface $container File container object |
300 | 300 | * @param array $files List of generated site map file names |
301 | 301 | */ |
302 | - protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files ) |
|
302 | + protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files) |
|
303 | 303 | { |
304 | 304 | /** controller/jobs/product/export/sitemap/standard/template-index |
305 | 305 | * Relative path to the XML site map index template of the product site map job controller. |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | |
332 | 332 | $view->siteFiles = $files; |
333 | 333 | |
334 | - $content = $container->create( 'aimeos-sitemap-index.xml' ); |
|
335 | - $content->add( $view->render( $context->getConfig()->get( $tplconf, $default ) ) ); |
|
336 | - $container->add( $content ); |
|
334 | + $content = $container->create('aimeos-sitemap-index.xml'); |
|
335 | + $content->add($view->render($context->getConfig()->get($tplconf, $default))); |
|
336 | + $container->add($content); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | * @param mixed $default Default value if name is unknown |
345 | 345 | * @return mixed Configuration value |
346 | 346 | */ |
347 | - protected function getConfig( $name, $default = null ) |
|
347 | + protected function getConfig($name, $default = null) |
|
348 | 348 | { |
349 | 349 | $config = $this->getContext()->getConfig(); |
350 | 350 | |
351 | - switch( $name ) |
|
351 | + switch ($name) |
|
352 | 352 | { |
353 | 353 | case 'domain': |
354 | 354 | return []; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @see controller/jobs/product/export/sitemap/max-query |
376 | 376 | * @see controller/jobs/product/export/sitemap/changefreq |
377 | 377 | */ |
378 | - return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 ); |
|
378 | + return $config->get('controller/jobs/product/export/sitemap/max-items', 50000); |
|
379 | 379 | |
380 | 380 | case 'max-query': |
381 | 381 | /** controller/jobs/product/export/sitemap/max-query |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * @see controller/jobs/product/export/sitemap/max-items |
396 | 396 | * @see controller/jobs/product/export/sitemap/changefreq |
397 | 397 | */ |
398 | - return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 ); |
|
398 | + return $config->get('controller/jobs/product/export/sitemap/max-query', 1000); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | return $default; |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * @param integer $number Current file number |
409 | 409 | * @return string New file name |
410 | 410 | */ |
411 | - protected function getFilename( $number ) |
|
411 | + protected function getFilename($number) |
|
412 | 412 | { |
413 | - return sprintf( 'aimeos-sitemap-%d.xml', $number ); |
|
413 | + return sprintf('aimeos-sitemap-%d.xml', $number); |
|
414 | 414 | } |
415 | 415 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public static function bootstrap() |
16 | 16 | { |
17 | 17 | self::getAimeos(); |
18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
18 | + \Aimeos\MShop\Factory::setCache(false); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - public static function getContext( $site = 'unittest' ) |
|
22 | + public static function getContext($site = 'unittest') |
|
23 | 23 | { |
24 | - if( !isset( self::$context[$site] ) ) { |
|
25 | - self::$context[$site] = self::createContext( $site ); |
|
24 | + if (!isset(self::$context[$site])) { |
|
25 | + self::$context[$site] = self::createContext($site); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | return clone self::$context[$site]; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | |
32 | 32 | public static function getAimeos() |
33 | 33 | { |
34 | - if( !isset( self::$aimeos ) ) |
|
34 | + if (!isset(self::$aimeos)) |
|
35 | 35 | { |
36 | 36 | require_once 'Bootstrap.php'; |
37 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
37 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
38 | 38 | |
39 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
40 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
39 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
40 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return self::$aimeos; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @param string $site |
49 | 49 | */ |
50 | - private static function createContext( $site ) |
|
50 | + private static function createContext($site) |
|
51 | 51 | { |
52 | 52 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
53 | 53 | $aimeos = self::getAimeos(); |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
58 | 58 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
59 | 59 | |
60 | - $conf = new \Aimeos\MW\Config\PHPArray( [], $paths ); |
|
61 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
62 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
63 | - $ctx->setConfig( $conf ); |
|
60 | + $conf = new \Aimeos\MW\Config\PHPArray([], $paths); |
|
61 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
62 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
63 | + $ctx->setConfig($conf); |
|
64 | 64 | |
65 | 65 | |
66 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
67 | - $ctx->setDatabaseManager( $dbm ); |
|
66 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
67 | + $ctx->setDatabaseManager($dbm); |
|
68 | 68 | |
69 | 69 | |
70 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
71 | - $ctx->setLogger( $logger ); |
|
70 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
71 | + $ctx->setLogger($logger); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | $session = new \Aimeos\MW\Session\None(); |
75 | - $ctx->setSession( $session ); |
|
75 | + $ctx->setSession($session); |
|
76 | 76 | |
77 | 77 | |
78 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
79 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
80 | - $ctx->setLocale( $locale ); |
|
78 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
79 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
80 | + $ctx->setLocale($locale); |
|
81 | 81 | |
82 | 82 | |
83 | - $ctx->setEditor( 'core:controller/common' ); |
|
83 | + $ctx->setEditor('core:controller/common'); |
|
84 | 84 | |
85 | 85 | return $ctx; |
86 | 86 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function getName() |
30 | 30 | { |
31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process renew' ); |
|
31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process renew'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getDescription() |
41 | 41 | { |
42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Renews subscriptions at next date' ); |
|
42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Renews subscriptions at next date'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -54,62 +54,62 @@ discard block |
||
54 | 54 | $config = $context->getConfig(); |
55 | 55 | $logger = $context->getLogger(); |
56 | 56 | |
57 | - $names = (array) $config->get( 'controller/common/subscription/process/processors', [] ); |
|
57 | + $names = (array) $config->get('controller/common/subscription/process/processors', []); |
|
58 | 58 | |
59 | - $date = date( 'Y-m-d' ); |
|
60 | - $processors = $this->getProcessors( $names ); |
|
61 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
59 | + $date = date('Y-m-d'); |
|
60 | + $processors = $this->getProcessors($names); |
|
61 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
62 | 62 | |
63 | - $search = $manager->createSearch( true ); |
|
63 | + $search = $manager->createSearch(true); |
|
64 | 64 | $expr = [ |
65 | - $search->compare( '<=', 'subscription.datenext', $date ), |
|
66 | - $search->combine( '||', [ |
|
67 | - $search->compare( '==', 'subscription.dateend', null ), |
|
68 | - $search->compare( '>', 'subscription.dateend', $date ), |
|
69 | - ] ), |
|
65 | + $search->compare('<=', 'subscription.datenext', $date), |
|
66 | + $search->combine('||', [ |
|
67 | + $search->compare('==', 'subscription.dateend', null), |
|
68 | + $search->compare('>', 'subscription.dateend', $date), |
|
69 | + ]), |
|
70 | 70 | $search->getConditions(), |
71 | 71 | ]; |
72 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
73 | - $search->setSortations( [$search->sort( '+', 'subscription.id' )] ); |
|
72 | + $search->setConditions($search->combine('&&', $expr)); |
|
73 | + $search->setSortations([$search->sort('+', 'subscription.id')]); |
|
74 | 74 | |
75 | 75 | $start = 0; |
76 | 76 | |
77 | 77 | do |
78 | 78 | { |
79 | - $search->setSlice( $start, 100 ); |
|
80 | - $items = $manager->searchItems( $search ); |
|
79 | + $search->setSlice($start, 100); |
|
80 | + $items = $manager->searchItems($search); |
|
81 | 81 | |
82 | - foreach( $items as $item ) |
|
82 | + foreach ($items as $item) |
|
83 | 83 | { |
84 | 84 | try |
85 | 85 | { |
86 | - $context = $this->createContext( $item->getOrderBaseId() ); |
|
87 | - $newOrder = $this->createOrderBase( $context, $item ); |
|
88 | - $newInvoice = $this->createOrderInvoice( $context, $newOrder ); |
|
86 | + $context = $this->createContext($item->getOrderBaseId()); |
|
87 | + $newOrder = $this->createOrderBase($context, $item); |
|
88 | + $newInvoice = $this->createOrderInvoice($context, $newOrder); |
|
89 | 89 | |
90 | - $this->createPayment( $context, $newOrder, $newInvoice ); |
|
90 | + $this->createPayment($context, $newOrder, $newInvoice); |
|
91 | 91 | |
92 | - $interval = new \DateInterval( $item->getInterval() ); |
|
93 | - $item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) ); |
|
92 | + $interval = new \DateInterval($item->getInterval()); |
|
93 | + $item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d')); |
|
94 | 94 | |
95 | - $manager->saveItem( $item ); |
|
95 | + $manager->saveItem($item); |
|
96 | 96 | |
97 | - foreach( $processors as $processor ) { |
|
98 | - $processor->renew( $item, $newInvoice ); |
|
97 | + foreach ($processors as $processor) { |
|
98 | + $processor->renew($item, $newInvoice); |
|
99 | 99 | } |
100 | 100 | } |
101 | - catch( \Exception $e ) |
|
101 | + catch (\Exception $e) |
|
102 | 102 | { |
103 | 103 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
104 | - $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
|
105 | - $logger->log( $e->getTraceAsString() ); |
|
104 | + $logger->log(sprintf($msg, $item->getId(), $e->getMessage())); |
|
105 | + $logger->log($e->getTraceAsString()); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - $count = count( $items ); |
|
109 | + $count = count($items); |
|
110 | 110 | $start += $count; |
111 | 111 | } |
112 | - while( $count === $search->getSliceSize() ); |
|
112 | + while ($count === $search->getSliceSize()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,30 +119,30 @@ discard block |
||
119 | 119 | * @param string $baseId Unique order base ID |
120 | 120 | * @return \Aimeos\MShop\Context\Item\Iface New context object |
121 | 121 | */ |
122 | - protected function createContext( $baseId ) |
|
122 | + protected function createContext($baseId) |
|
123 | 123 | { |
124 | 124 | $context = clone $this->getContext(); |
125 | 125 | |
126 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
127 | - $baseItem = $manager->getItem( $baseId ); |
|
126 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
127 | + $baseItem = $manager->getItem($baseId); |
|
128 | 128 | |
129 | 129 | $locale = $baseItem->getLocale(); |
130 | 130 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
131 | 131 | |
132 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
133 | - $locale = $manager->bootstrap( $baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level ); |
|
132 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
133 | + $locale = $manager->bootstrap($baseItem->getSiteCode(), $locale->getLanguageId(), $locale->getCurrencyId(), false, $level); |
|
134 | 134 | |
135 | - $context->setLocale( $locale ); |
|
135 | + $context->setLocale($locale); |
|
136 | 136 | |
137 | 137 | try |
138 | 138 | { |
139 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
140 | - $customerItem = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] ); |
|
139 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
140 | + $customerItem = $manager->getItem($baseItem->getCustomerId(), ['customer/group']); |
|
141 | 141 | |
142 | - $context->setUserId( $baseItem->getCustomerId() ); |
|
143 | - $context->setGroupIds( $customerItem->getGroups() ); |
|
142 | + $context->setUserId($baseItem->getCustomerId()); |
|
143 | + $context->setGroupIds($customerItem->getGroups()); |
|
144 | 144 | } |
145 | - catch( \Exception $e ) {} // Subscription without account |
|
145 | + catch (\Exception $e) {} // Subscription without account |
|
146 | 146 | |
147 | 147 | return $context; |
148 | 148 | } |
@@ -155,36 +155,36 @@ discard block |
||
155 | 155 | * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item with order base ID and order product ID |
156 | 156 | * @return \Aimeos\MShop\Order\Item\Base\Iface Complete order with product, addresses and services saved to the storage |
157 | 157 | */ |
158 | - protected function createOrderBase( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription ) |
|
158 | + protected function createOrderBase(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Subscription\Item\Iface $subscription) |
|
159 | 159 | { |
160 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
160 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
161 | 161 | |
162 | - $basket = $manager->load( $subscription->getOrderBaseId() ); |
|
162 | + $basket = $manager->load($subscription->getOrderBaseId()); |
|
163 | 163 | |
164 | 164 | $newBasket = $manager->createItem(); |
165 | - $newBasket->setCustomerId( $basket->getCustomerId() ); |
|
165 | + $newBasket->setCustomerId($basket->getCustomerId()); |
|
166 | 166 | |
167 | - foreach( $basket->getProducts() as $orderProduct ) |
|
167 | + foreach ($basket->getProducts() as $orderProduct) |
|
168 | 168 | { |
169 | - if( $orderProduct->getId() === $subscription->getOrderProductId() ) |
|
169 | + if ($orderProduct->getId() === $subscription->getOrderProductId()) |
|
170 | 170 | { |
171 | - $orderProduct->setId( null ); |
|
172 | - $newBasket->addProduct( $orderProduct ); |
|
171 | + $orderProduct->setId(null); |
|
172 | + $newBasket->addProduct($orderProduct); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - foreach( $basket->getAddresses() as $type => $orderAddress ) { |
|
177 | - $newBasket->setAddress( $orderAddress, $type ); |
|
176 | + foreach ($basket->getAddresses() as $type => $orderAddress) { |
|
177 | + $newBasket->setAddress($orderAddress, $type); |
|
178 | 178 | } |
179 | 179 | |
180 | - foreach( $basket->getServices() as $type => $orderServices ) |
|
180 | + foreach ($basket->getServices() as $type => $orderServices) |
|
181 | 181 | { |
182 | - foreach( $orderServices as $orderService ) { |
|
183 | - $newBasket->addService( $orderService, $type ); |
|
182 | + foreach ($orderServices as $orderService) { |
|
183 | + $newBasket->addService($orderService, $type); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - return $manager->store( $newBasket ); |
|
187 | + return $manager->store($newBasket); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services saved to the storage |
196 | 196 | * @return \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order saved to the storage |
197 | 197 | */ |
198 | - protected function createOrderInvoice( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
198 | + protected function createOrderInvoice(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
199 | 199 | { |
200 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
200 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
201 | 201 | |
202 | 202 | $item = $manager->createItem(); |
203 | - $item->setBaseId( $basket->getId() ); |
|
204 | - $item->setType( 'subscription' ); |
|
203 | + $item->setBaseId($basket->getId()); |
|
204 | + $item->setType('subscription'); |
|
205 | 205 | |
206 | - return $manager->saveItem( $item ); |
|
206 | + return $manager->saveItem($item); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -214,17 +214,17 @@ discard block |
||
214 | 214 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Complete order with product, addresses and services |
215 | 215 | * @param \Aimeos\MShop\Order\Item\Iface New invoice item associated to the order |
216 | 216 | */ |
217 | - protected function createPayment( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
218 | - \Aimeos\MShop\Order\Item\Iface $invoice ) |
|
217 | + protected function createPayment(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
218 | + \Aimeos\MShop\Order\Item\Iface $invoice) |
|
219 | 219 | { |
220 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
220 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
221 | 221 | |
222 | - foreach( $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ) as $service ) |
|
222 | + foreach ($basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT) as $service) |
|
223 | 223 | { |
224 | - $item = $manager->getItem( $service->getServiceId() ); |
|
225 | - $provider = $manager->getProvider( $item, 'payment' ); |
|
224 | + $item = $manager->getItem($service->getServiceId()); |
|
225 | + $provider = $manager->getProvider($item, 'payment'); |
|
226 | 226 | |
227 | - $provider->repay( $invoice ); |
|
227 | + $provider->repay($invoice); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | foreach( $processors as $processor ) { |
98 | 98 | $processor->renew( $item, $newInvoice ); |
99 | 99 | } |
100 | - } |
|
101 | - catch( \Exception $e ) |
|
100 | + } catch( \Exception $e ) |
|
102 | 101 | { |
103 | 102 | $msg = 'Unable to process subscription with ID "%1$S": %2$s'; |
104 | 103 | $logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) ); |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | |
142 | 141 | $context->setUserId( $baseItem->getCustomerId() ); |
143 | 142 | $context->setGroupIds( $customerItem->getGroups() ); |
144 | - } |
|
145 | - catch( \Exception $e ) {} // Subscription without account |
|
143 | + } catch( \Exception $e ) {} // Subscription without account |
|
146 | 144 | |
147 | 145 | return $context; |
148 | 146 | } |