@@ -40,28 +40,28 @@ |
||
| 40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
| 41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
| 43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
| 44 | 44 | { |
| 45 | 45 | $result = []; |
| 46 | 46 | $addresses = $order->getAddresses(); |
| 47 | 47 | |
| 48 | - krsort( $addresses ); |
|
| 48 | + krsort($addresses); |
|
| 49 | 49 | |
| 50 | - foreach( $addresses as $item ) |
|
| 50 | + foreach ($addresses as $item) |
|
| 51 | 51 | { |
| 52 | 52 | $data = []; |
| 53 | 53 | $list = $item->toArray(); |
| 54 | 54 | |
| 55 | - foreach( $this->getMapping() as $pos => $key ) |
|
| 55 | + foreach ($this->getMapping() as $pos => $key) |
|
| 56 | 56 | { |
| 57 | - if( array_key_exists( $key, $list ) ) { |
|
| 57 | + if (array_key_exists($key, $list)) { |
|
| 58 | 58 | $data[$pos] = $list[$key]; |
| 59 | 59 | } else { |
| 60 | 60 | $data[$pos] = ''; |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - ksort( $data ); |
|
| 64 | + ksort($data); |
|
| 65 | 65 | $result[] = $data; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -40,21 +40,21 @@ |
||
| 40 | 40 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
| 41 | 41 | * @return array Two dimensional associative list of order data representing the lines in CSV |
| 42 | 42 | */ |
| 43 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ) |
|
| 43 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order) |
|
| 44 | 44 | { |
| 45 | 45 | $result = []; |
| 46 | 46 | $list = $invoice->toArray() + $order->toArray(); |
| 47 | 47 | |
| 48 | - foreach( $this->getMapping() as $pos => $key ) |
|
| 48 | + foreach ($this->getMapping() as $pos => $key) |
|
| 49 | 49 | { |
| 50 | - if( array_key_exists( $key, $list ) ) { |
|
| 50 | + if (array_key_exists($key, $list)) { |
|
| 51 | 51 | $result[$pos] = $list[$key]; |
| 52 | 52 | } else { |
| 53 | 53 | $result[$pos] = ''; |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - ksort( $result ); |
|
| 57 | + ksort($result); |
|
| 58 | 58 | |
| 59 | 59 | return [$result]; |
| 60 | 60 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 26 | 26 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 27 | 27 | */ |
| 28 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping ); |
|
| 28 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping); |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -35,5 +35,5 @@ discard block |
||
| 35 | 35 | * @param \Aimeos\MShop\Order\Item\Base\Iface $order Full order with associated items |
| 36 | 36 | * @return array Two dimensional associative list of order data representing the lines in CSV |
| 37 | 37 | */ |
| 38 | - public function process( \Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order ); |
|
| 38 | + public function process(\Aimeos\MShop\Order\Item\Iface $invoice, \Aimeos\MShop\Order\Item\Base\Iface $order); |
|
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * Initializes the object |
| 30 | 30 | * |
| 31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 32 | - * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
|
| 32 | + * @param string[] $mapping Associative list of field position in CSV as key and domain item key as value |
|
| 33 | 33 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
| 34 | 34 | */ |
| 35 | 35 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 33 | 33 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 36 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null ) |
|
| 35 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 36 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null) |
|
| 37 | 37 | { |
| 38 | 38 | $this->context = $context; |
| 39 | 39 | $this->mapping = $mapping; |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function getObject() |
| 73 | 73 | { |
| 74 | - if( $this->object === null ) { |
|
| 75 | - throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' ); |
|
| 74 | + if ($this->object === null) { |
|
| 75 | + throw new \Aimeos\Controller\Jobs\Exception('No processor object available'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $this->object; |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 28 | 28 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null ) |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null) |
|
| 32 | 32 | { |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,7 +40,7 @@ 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\Coupon\Item\Code\Iface $item, array $data ) |
|
| 43 | + public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data) |
|
| 44 | 44 | { |
| 45 | 45 | return $data; |
| 46 | 46 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 27 | 27 | * @param \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object Decorated processor |
| 28 | 28 | */ |
| 29 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 30 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null ); |
|
| 29 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 30 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $object = null); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -37,5 +37,5 @@ discard block |
||
| 37 | 37 | * @param array $data List of CSV fields with position as key and data as value |
| 38 | 38 | * @return array List of data which hasn't been imported |
| 39 | 39 | */ |
| 40 | - public function process( \Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data ); |
|
| 40 | + public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data); |
|
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | $msg = 'Finished coupon import: %1$d successful, %2$s errors, %3$s total (%4$s)'; |
| 161 | 161 | $logger->log( sprintf( $msg, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
| 162 | 162 | } |
| 163 | - } |
|
| 164 | - catch( \Exception $e ) |
|
| 163 | + } catch( \Exception $e ) |
|
| 165 | 164 | { |
| 166 | 165 | $logger->log( 'Coupon import error: ' . $e->getMessage() ); |
| 167 | 166 | $logger->log( $e->getTraceAsString() ); |
@@ -309,8 +308,7 @@ discard block |
||
| 309 | 308 | $list = $processor->process( $item, $list ); |
| 310 | 309 | |
| 311 | 310 | $manager->commit(); |
| 312 | - } |
|
| 313 | - catch( \Exception $e ) |
|
| 311 | + } catch( \Exception $e ) |
|
| 314 | 312 | { |
| 315 | 313 | $manager->rollback(); |
| 316 | 314 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function getName() |
| 30 | 30 | { |
| 31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Coupon code import CSV' ); |
|
| 31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Coupon code import CSV'); |
|
| 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', 'Imports new and updates existing coupon code from CSV files' ); |
|
| 42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing coupon code from CSV files'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @see controller/jobs/coupon/import/csv/code/skip-lines |
| 72 | 72 | * @see controller/jobs/coupon/import/csv/code/max-size |
| 73 | 73 | */ |
| 74 | - $mappings = $config->get( 'controller/jobs/coupon/import/csv/code/mapping', $mappings ); |
|
| 74 | + $mappings = $config->get('controller/jobs/coupon/import/csv/code/mapping', $mappings); |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /** controller/jobs/coupon/import/csv/code/max-size |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @see controller/jobs/coupon/import/csv/code/skip-lines |
| 91 | 91 | * @see controller/jobs/coupon/import/csv/code/mapping |
| 92 | 92 | */ |
| 93 | - $maxcnt = (int) $config->get( 'controller/jobs/coupon/import/csv/code/max-size', 1000 ); |
|
| 93 | + $maxcnt = (int) $config->get('controller/jobs/coupon/import/csv/code/max-size', 1000); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | /** controller/jobs/coupon/import/csv/code/skip-lines |
@@ -108,64 +108,64 @@ discard block |
||
| 108 | 108 | * @see controller/jobs/coupon/import/csv/code/mapping |
| 109 | 109 | * @see controller/jobs/coupon/import/csv/code/max-size |
| 110 | 110 | */ |
| 111 | - $skiplines = (int) $config->get( 'controller/jobs/coupon/import/csv/code/skip-lines', 0 ); |
|
| 111 | + $skiplines = (int) $config->get('controller/jobs/coupon/import/csv/code/skip-lines', 0); |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | try |
| 115 | 115 | { |
| 116 | - $processor = $this->getProcessors( $mappings ); |
|
| 117 | - $codePos = $this->getCodePosition( $mappings['code'] ); |
|
| 118 | - $fs = $context->getFileSystemManager()->get( 'fs-import' ); |
|
| 116 | + $processor = $this->getProcessors($mappings); |
|
| 117 | + $codePos = $this->getCodePosition($mappings['code']); |
|
| 118 | + $fs = $context->getFileSystemManager()->get('fs-import'); |
|
| 119 | 119 | $dir = 'couponcode/' . $context->getLocale()->getSite()->getCode(); |
| 120 | 120 | |
| 121 | - if( $fs->isDir( $dir ) === false ) { |
|
| 121 | + if ($fs->isDir($dir) === false) { |
|
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - foreach( $fs->scan( $dir ) as $filename ) |
|
| 125 | + foreach ($fs->scan($dir) as $filename) |
|
| 126 | 126 | { |
| 127 | - if( $filename == '.' || $filename == '..' ) { |
|
| 127 | + if ($filename == '.' || $filename == '..') { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - list( $couponId, ) = explode( '.', $filename ); |
|
| 132 | - $container = $this->getContainer( $fs->readf( $dir . '/' . $filename ) ); |
|
| 131 | + list($couponId,) = explode('.', $filename); |
|
| 132 | + $container = $this->getContainer($fs->readf($dir . '/' . $filename)); |
|
| 133 | 133 | |
| 134 | - $msg = sprintf( 'Started coupon import from "%1$s" (%2$s)', $filename, __CLASS__ ); |
|
| 135 | - $logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE ); |
|
| 134 | + $msg = sprintf('Started coupon import from "%1$s" (%2$s)', $filename, __CLASS__); |
|
| 135 | + $logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE); |
|
| 136 | 136 | |
| 137 | - foreach( $container as $content ) |
|
| 137 | + foreach ($container as $content) |
|
| 138 | 138 | { |
| 139 | - for( $i = 0; $i < $skiplines; $i++ ) { |
|
| 139 | + for ($i = 0; $i < $skiplines; $i++) { |
|
| 140 | 140 | $content->next(); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] ) |
|
| 143 | + while (($data = $this->getData($content, $maxcnt, $codePos)) !== []) |
|
| 144 | 144 | { |
| 145 | - $items = $this->getCouponCodeItems( array_keys( $data ) ); |
|
| 146 | - $errcnt = $this->import( $items, $data, $couponId, $processor ); |
|
| 147 | - $chunkcnt = count( $data ); |
|
| 145 | + $items = $this->getCouponCodeItems(array_keys($data)); |
|
| 146 | + $errcnt = $this->import($items, $data, $couponId, $processor); |
|
| 147 | + $chunkcnt = count($data); |
|
| 148 | 148 | |
| 149 | 149 | $msg = 'Imported coupon lines from "%1$s": %2$d/%3$d (%4$s)'; |
| 150 | - $logger->log( sprintf( $msg, $filename, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
| 150 | + $logger->log(sprintf($msg, $filename, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
| 151 | 151 | |
| 152 | 152 | $errors += $errcnt; |
| 153 | 153 | $total += $chunkcnt; |
| 154 | - unset( $items, $data ); |
|
| 154 | + unset($items, $data); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $container->close(); |
| 159 | - $fs->rm( $dir . '/' . $filename ); |
|
| 159 | + $fs->rm($dir . '/' . $filename); |
|
| 160 | 160 | |
| 161 | 161 | $msg = 'Finished coupon import: %1$d successful, %2$s errors, %3$s total (%4$s)'; |
| 162 | - $logger->log( sprintf( $msg, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE ); |
|
| 162 | + $logger->log(sprintf($msg, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | - catch( \Exception $e ) |
|
| 165 | + catch (\Exception $e) |
|
| 166 | 166 | { |
| 167 | - $logger->log( 'Coupon import error: ' . $e->getMessage() ); |
|
| 168 | - $logger->log( $e->getTraceAsString() ); |
|
| 167 | + $logger->log('Coupon import error: ' . $e->getMessage()); |
|
| 168 | + $logger->log($e->getTraceAsString()); |
|
| 169 | 169 | |
| 170 | 170 | throw $e; |
| 171 | 171 | } |
@@ -179,16 +179,16 @@ discard block |
||
| 179 | 179 | * @return integer Position of the "coupon.code" column |
| 180 | 180 | * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "coupon.code.code" is found |
| 181 | 181 | */ |
| 182 | - protected function getCodePosition( array $mapping ) |
|
| 182 | + protected function getCodePosition(array $mapping) |
|
| 183 | 183 | { |
| 184 | - foreach( $mapping as $pos => $key ) |
|
| 184 | + foreach ($mapping as $pos => $key) |
|
| 185 | 185 | { |
| 186 | - if( $key === 'coupon.code.code' ) { |
|
| 186 | + if ($key === 'coupon.code.code') { |
|
| 187 | 187 | return $pos; |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "coupon.code.code" column in CSV mapping found' ) ); |
|
| 191 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "coupon.code.code" column in CSV mapping found')); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param string $filepath Path to the container file |
| 199 | 199 | * @return \Aimeos\MW\Container\Iface Container object |
| 200 | 200 | */ |
| 201 | - protected function getContainer( $filepath ) |
|
| 201 | + protected function getContainer($filepath) |
|
| 202 | 202 | { |
| 203 | 203 | $config = $this->getContext()->getConfig(); |
| 204 | 204 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @see controller/jobs/coupon/import/csv/code/container/content |
| 223 | 223 | * @see controller/jobs/coupon/import/csv/code/container/options |
| 224 | 224 | */ |
| 225 | - $container = $config->get( 'controller/jobs/coupon/import/csv/code/container/type', 'File' ); |
|
| 225 | + $container = $config->get('controller/jobs/coupon/import/csv/code/container/type', 'File'); |
|
| 226 | 226 | |
| 227 | 227 | /** controller/jobs/coupon/import/csv/code/container/content |
| 228 | 228 | * Name of the content type inside the container to read the data from |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @see controller/jobs/coupon/import/csv/code/container/type |
| 243 | 243 | * @see controller/jobs/coupon/import/csv/code/container/options |
| 244 | 244 | */ |
| 245 | - $content = $config->get( 'controller/jobs/coupon/import/csv/code/container/content', 'CSV' ); |
|
| 245 | + $content = $config->get('controller/jobs/coupon/import/csv/code/container/content', 'CSV'); |
|
| 246 | 246 | |
| 247 | 247 | /** controller/jobs/coupon/import/csv/code/container/options |
| 248 | 248 | * List of file container options for the coupon import files |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | * @see controller/jobs/coupon/import/csv/code/container/content |
| 260 | 260 | * @see controller/jobs/coupon/import/csv/code/container/type |
| 261 | 261 | */ |
| 262 | - $options = $config->get( 'controller/jobs/coupon/import/csv/code/container/options', [] ); |
|
| 262 | + $options = $config->get('controller/jobs/coupon/import/csv/code/container/options', []); |
|
| 263 | 263 | |
| 264 | - return \Aimeos\MW\Container\Factory::getContainer( $filepath, $container, $content, $options ); |
|
| 264 | + return \Aimeos\MW\Container\Factory::getContainer($filepath, $container, $content, $options); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
@@ -275,36 +275,36 @@ discard block |
||
| 275 | 275 | * @return integer Number of coupons that couldn't be imported |
| 276 | 276 | * @throws \Aimeos\Controller\Jobs\Exception |
| 277 | 277 | */ |
| 278 | - protected function import( array $items, array $data, $couponId, |
|
| 279 | - \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor ) |
|
| 278 | + protected function import(array $items, array $data, $couponId, |
|
| 279 | + \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface $processor) |
|
| 280 | 280 | { |
| 281 | 281 | $errors = 0; |
| 282 | 282 | $context = $this->getContext(); |
| 283 | - $manager = \Aimeos\MShop::create( $context, 'coupon/code' ); |
|
| 283 | + $manager = \Aimeos\MShop::create($context, 'coupon/code'); |
|
| 284 | 284 | |
| 285 | - foreach( $data as $code => $list ) |
|
| 285 | + foreach ($data as $code => $list) |
|
| 286 | 286 | { |
| 287 | 287 | $manager->begin(); |
| 288 | 288 | |
| 289 | 289 | try |
| 290 | 290 | { |
| 291 | - if( isset( $items[$code] ) ) { |
|
| 291 | + if (isset($items[$code])) { |
|
| 292 | 292 | $item = $items[$code]; |
| 293 | 293 | } else { |
| 294 | 294 | $item = $manager->createItem(); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - $item->setParentId( $couponId ); |
|
| 298 | - $list = $processor->process( $item, $list ); |
|
| 297 | + $item->setParentId($couponId); |
|
| 298 | + $list = $processor->process($item, $list); |
|
| 299 | 299 | |
| 300 | 300 | $manager->commit(); |
| 301 | 301 | } |
| 302 | - catch( \Exception $e ) |
|
| 302 | + catch (\Exception $e) |
|
| 303 | 303 | { |
| 304 | 304 | $manager->rollback(); |
| 305 | 305 | |
| 306 | - $msg = sprintf( 'Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage() ); |
|
| 307 | - $context->getLogger()->log( $msg ); |
|
| 306 | + $msg = sprintf('Unable to import coupon with code "%1$s": %2$s', $code, $e->getMessage()); |
|
| 307 | + $context->getLogger()->log($msg); |
|
| 308 | 308 | |
| 309 | 309 | $errors++; |
| 310 | 310 | } |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | 68 | $serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync(); |
| 69 | - } |
|
| 70 | - catch( \Exception $e ) |
|
| 69 | + } catch( \Exception $e ) |
|
| 71 | 70 | { |
| 72 | 71 | $msg = 'Executing updateAsyc() of "%1$s" failed: %2$s'; |
| 73 | 72 | $context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) ); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function getName() |
| 31 | 31 | { |
| 32 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Batch update of payment/delivery status' ); |
|
| 32 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Batch update of payment/delivery status'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function getDescription() |
| 42 | 42 | { |
| 43 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Executes payment or delivery service providers that uses batch updates' ); |
|
| 43 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Executes payment or delivery service providers that uses batch updates'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -52,32 +52,32 @@ discard block |
||
| 52 | 52 | public function run() |
| 53 | 53 | { |
| 54 | 54 | $context = $this->getContext(); |
| 55 | - $serviceManager = \Aimeos\MShop::create( $context, 'service' ); |
|
| 55 | + $serviceManager = \Aimeos\MShop::create($context, 'service'); |
|
| 56 | 56 | |
| 57 | 57 | $search = $serviceManager->createSearch(); |
| 58 | 58 | $start = 0; |
| 59 | 59 | |
| 60 | 60 | do |
| 61 | 61 | { |
| 62 | - $serviceItems = $serviceManager->searchItems( $search ); |
|
| 62 | + $serviceItems = $serviceManager->searchItems($search); |
|
| 63 | 63 | |
| 64 | - foreach( $serviceItems as $serviceItem ) |
|
| 64 | + foreach ($serviceItems as $serviceItem) |
|
| 65 | 65 | { |
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | - $serviceManager->getProvider( $serviceItem, $serviceItem->getType() )->updateAsync(); |
|
| 68 | + $serviceManager->getProvider($serviceItem, $serviceItem->getType())->updateAsync(); |
|
| 69 | 69 | } |
| 70 | - catch( \Exception $e ) |
|
| 70 | + catch (\Exception $e) |
|
| 71 | 71 | { |
| 72 | 72 | $msg = 'Executing updateAsyc() of "%1$s" failed: %2$s'; |
| 73 | - $context->getLogger()->log( sprintf( $msg, $serviceItem->getProvider(), $e->getMessage() ) ); |
|
| 73 | + $context->getLogger()->log(sprintf($msg, $serviceItem->getProvider(), $e->getMessage())); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $count = count( $serviceItems ); |
|
| 77 | + $count = count($serviceItems); |
|
| 78 | 78 | $start += $count; |
| 79 | - $search->setSlice( $start ); |
|
| 79 | + $search->setSlice($start); |
|
| 80 | 80 | } |
| 81 | - while( $count >= $search->getSliceSize() ); |
|
| 81 | + while ($count >= $search->getSliceSize()); |
|
| 82 | 82 | } |
| 83 | 83 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | * @param array $mapping Associative list of field position in CSV as key and domain item key as value |
| 28 | 28 | * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor Decorated processor |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | - \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null ) |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
|
| 31 | + \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor = null) |
|
| 32 | 32 | { |
| 33 | 33 | } |
| 34 | 34 | |
@@ -40,7 +40,7 @@ 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\Catalog\Item\Iface $catalog, array $data ) |
|
| 43 | + public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data) |
|
| 44 | 44 | { |
| 45 | 45 | return $data; |
| 46 | 46 | } |