Completed
Push — master ( 08fedb...6dd458 )
by Aimeos
05:10
created
src/Controller/Common/Product/Import/Csv/Processor/Attribute/Standard.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
44 44
 	 * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object Decorated processor
45 45
 	 */
46
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
47
-		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null )
46
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
47
+		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null)
48 48
 	{
49
-		parent::__construct( $context, $mapping, $object );
49
+		parent::__construct($context, $mapping, $object);
50 50
 
51 51
 		/** controller/common/product/import/csv/processor/attribute/listtypes
52 52
 		 * Names of the product list types for attributes that are updated or removed
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 		 * @see controller/common/product/import/csv/processor/price/listtypes
68 68
 		 * @see controller/common/product/import/csv/processor/text/listtypes
69 69
 		 */
70
-		$this->listTypes = $context->getConfig()->get( 'controller/common/product/import/csv/processor/attribute/listtypes');
70
+		$this->listTypes = $context->getConfig()->get('controller/common/product/import/csv/processor/attribute/listtypes');
71 71
 
72
-		$this->cache = $this->getCache( 'attribute' );
72
+		$this->cache = $this->getCache('attribute');
73 73
 	}
74 74
 
75 75
 
@@ -80,59 +80,59 @@  discard block
 block discarded – undo
80 80
 	 * @param array $data List of CSV fields with position as key and data as value
81 81
 	 * @return array List of data which hasn't been imported
82 82
 	 */
83
-	public function process( \Aimeos\MShop\Product\Item\Iface $product, array $data )
83
+	public function process(\Aimeos\MShop\Product\Item\Iface $product, array $data)
84 84
 	{
85 85
 		$context = $this->getContext();
86
-		$listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' );
87
-		$separator = $context->getConfig()->get( 'controller/common/product/import/csv/separator', "\n" );
86
+		$listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
87
+		$separator = $context->getConfig()->get('controller/common/product/import/csv/separator', "\n");
88 88
 
89 89
 		$listMap = [];
90
-		$map = $this->getMappedChunk( $data, $this->getMapping() );
91
-		$listItems = $product->getListItems( 'attribute', $this->listTypes );
90
+		$map = $this->getMappedChunk($data, $this->getMapping());
91
+		$listItems = $product->getListItems('attribute', $this->listTypes);
92 92
 
93
-		foreach( $listItems as $listItem )
93
+		foreach ($listItems as $listItem)
94 94
 		{
95
-			if( ( $refItem = $listItem->getRefItem() ) !== null ) {
96
-				$listMap[ $refItem->getCode() ][ $listItem->getType() ] = $listItem;
95
+			if (($refItem = $listItem->getRefItem()) !== null) {
96
+				$listMap[$refItem->getCode()][$listItem->getType()] = $listItem;
97 97
 			}
98 98
 		}
99 99
 
100
-		foreach( $map as $pos => $list )
100
+		foreach ($map as $pos => $list)
101 101
 		{
102
-			if( $this->checkEntry( $list ) === false ) {
102
+			if ($this->checkEntry($list) === false) {
103 103
 				continue;
104 104
 			}
105 105
 
106
-			$codes = explode( $separator, trim( $list['attribute.code'] ) );
106
+			$codes = explode($separator, trim($list['attribute.code']));
107 107
 
108
-			foreach( $codes as $code )
108
+			foreach ($codes as $code)
109 109
 			{
110
-				$code = trim( $code );
111
-				$typecode = trim( $this->getValue( $list, 'product.lists.type', 'default' ) );
110
+				$code = trim($code);
111
+				$typecode = trim($this->getValue($list, 'product.lists.type', 'default'));
112 112
 
113
-				if( isset( $listMap[$code][$typecode] ) )
113
+				if (isset($listMap[$code][$typecode]))
114 114
 				{
115 115
 					$listItem = $listMap[$code][$typecode];
116
-					unset( $listItems[ $listItem->getId() ] );
116
+					unset($listItems[$listItem->getId()]);
117 117
 				}
118 118
 				else
119 119
 				{
120
-					$listItem = $listManager->createItem( $typecode, 'attribute' );
120
+					$listItem = $listManager->createItem($typecode, 'attribute');
121 121
 				}
122 122
 
123
-				$attrItem = $this->getAttributeItem( $code, trim( $list['attribute.type'] ) );
124
-				$attrItem->fromArray( $list );
125
-				$attrItem->setCode( $code );
123
+				$attrItem = $this->getAttributeItem($code, trim($list['attribute.type']));
124
+				$attrItem->fromArray($list);
125
+				$attrItem->setCode($code);
126 126
 
127
-				$listItem->fromArray( $this->addListItemDefaults( $list, $pos ) );
127
+				$listItem->fromArray($this->addListItemDefaults($list, $pos));
128 128
 
129
-				$product->addListItem( 'attribute', $listItem, $attrItem );
129
+				$product->addListItem('attribute', $listItem, $attrItem);
130 130
 			}
131 131
 		}
132 132
 
133
-		$product->deleteListItems( $listItems );
133
+		$product->deleteListItems($listItems);
134 134
 
135
-		return $this->getObject()->process( $product, $data );
135
+		return $this->getObject()->process($product, $data);
136 136
 	}
137 137
 
138 138
 
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 * @param array $list Associative list of key/value pairs from the mapped data
143 143
 	 * @return boolean True if the entry is valid, false if not
144 144
 	 */
145
-	protected function checkEntry( array $list )
145
+	protected function checkEntry(array $list)
146 146
 	{
147
-		if( !isset( $list['attribute.code'] ) || trim( $list['attribute.code'] ) === ''
148
-			|| trim( $list['attribute.type'] ) === '' || isset( $list['product.lists.type'] )
149
-			&& $this->listTypes !== null && !in_array( trim( $list['product.lists.type'] ), (array) $this->listTypes )
147
+		if (!isset($list['attribute.code']) || trim($list['attribute.code']) === ''
148
+			|| trim($list['attribute.type']) === '' || isset($list['product.lists.type'])
149
+			&& $this->listTypes !== null && !in_array(trim($list['product.lists.type']), (array) $this->listTypes)
150 150
 		) {
151 151
 			return false;
152 152
 		}
@@ -162,22 +162,22 @@  discard block
 block discarded – undo
162 162
 	 * @param string $type Attribute type
163 163
 	 * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item object
164 164
 	 */
165
-	protected function getAttributeItem( $code, $type )
165
+	protected function getAttributeItem($code, $type)
166 166
 	{
167
-		if( ( $item = $this->cache->get( $code, $type ) ) === null )
167
+		if (($item = $this->cache->get($code, $type)) === null)
168 168
 		{
169
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
169
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
170 170
 
171 171
 			$item = $manager->createItem();
172
-			$item->setTypeId( $this->getTypeId( 'attribute/type', 'product', $type ) );
173
-			$item->setDomain( 'product' );
174
-			$item->setLabel( $code );
175
-			$item->setCode( $code );
176
-			$item->setStatus( 1 );
172
+			$item->setTypeId($this->getTypeId('attribute/type', 'product', $type));
173
+			$item->setDomain('product');
174
+			$item->setLabel($code);
175
+			$item->setCode($code);
176
+			$item->setStatus(1);
177 177
 
178
-			$item = $manager->saveItem( $item );
178
+			$item = $manager->saveItem($item);
179 179
 
180
-			$this->cache->set( $item );
180
+			$this->cache->set($item);
181 181
 		}
182 182
 
183 183
 		return $item;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,8 +114,7 @@
 block discarded – undo
114 114
 				{
115 115
 					$listItem = $listMap[$code][$typecode];
116 116
 					unset( $listItems[ $listItem->getId() ] );
117
-				}
118
-				else
117
+				} else
119 118
 				{
120 119
 					$listItem = $listManager->createItem( $typecode, 'attribute' );
121 120
 				}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process start' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process start');
32 32
 	}
33 33
 
34 34
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function getDescription()
41 41
 	{
42
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process subscriptions initially' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Process subscriptions initially');
43 43
 	}
44 44
 
45 45
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 * @see controller/common/subscription/process/payment-status
68 68
 		 * @see controller/common/subscription/process/payment-days
69 69
 		 */
70
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
70
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
71 71
 
72 72
 		/** controller/common/subscription/process/payment-status
73 73
 		 * Minimum payment status that will activate the subscription
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @see controller/common/subscription/process/payment-days
87 87
 		 */
88 88
 		$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED;
89
-		$status = $config->get( 'controller/common/subscription/process/payment-status', $status );
89
+		$status = $config->get('controller/common/subscription/process/payment-status', $status);
90 90
 
91 91
 		/** controller/common/subscription/process/payment-days
92 92
 		 * Number of days to wait for the payment until subscription is removed
@@ -104,74 +104,74 @@  discard block
 block discarded – undo
104 104
 		 * @see controller/common/subscription/process/processors
105 105
 		 * @see controller/common/subscription/process/payment-status
106 106
 		 */
107
-		$days = (float) $config->get( 'controller/common/subscription/process/payment-days', 3 );
107
+		$days = (float) $config->get('controller/common/subscription/process/payment-days', 3);
108 108
 
109 109
 
110
-		$processors = $this->getProcessors( $names );
111
-		$orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
112
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
110
+		$processors = $this->getProcessors($names);
111
+		$orderManager = \Aimeos\MShop\Factory::createManager($context, 'order');
112
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
113 113
 
114
-		$search = $manager->createSearch( true );
114
+		$search = $manager->createSearch(true);
115 115
 		$expr = [
116
-			$search->compare( '==', 'subscription.datenext', null ),
116
+			$search->compare('==', 'subscription.datenext', null),
117 117
 			$search->getConditions(),
118 118
 		];
119
-		$search->setConditions( $search->combine( '&&', $expr ) );
120
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
119
+		$search->setConditions($search->combine('&&', $expr));
120
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
121 121
 
122
-		$date = date( 'Y-m-d H:i:s', time() - 86400 * $days );
122
+		$date = date('Y-m-d H:i:s', time() - 86400 * $days);
123 123
 		$start = 0;
124 124
 
125 125
 		do
126 126
 		{
127 127
 			$ordBaseIds = $payStatus = [];
128 128
 
129
-			$search->setSlice( $start, 100 );
130
-			$items = $manager->searchItems( $search );
129
+			$search->setSlice($start, 100);
130
+			$items = $manager->searchItems($search);
131 131
 
132
-			foreach( $items as $item ) {
132
+			foreach ($items as $item) {
133 133
 				$ordBaseIds[] = $item->getOrderBaseId();
134 134
 			}
135 135
 
136
-			$orderSearch = $orderManager->createSearch()->setSlice( 0, $search->getSliceSize() );
137
-			$orderSearch->setConditions( $orderSearch->compare( '==', 'order.base.id', $ordBaseIds ) );
138
-			$orderSearch->setSortations( [$orderSearch->sort( '+', 'order.id' )] );
136
+			$orderSearch = $orderManager->createSearch()->setSlice(0, $search->getSliceSize());
137
+			$orderSearch->setConditions($orderSearch->compare('==', 'order.base.id', $ordBaseIds));
138
+			$orderSearch->setSortations([$orderSearch->sort('+', 'order.id')]);
139 139
 
140
-			foreach( $orderManager->searchItems( $orderSearch ) as $orderItem ) {
140
+			foreach ($orderManager->searchItems($orderSearch) as $orderItem) {
141 141
 				$payStatus[$orderItem->getBaseId()] = $orderItem->getPaymentStatus();
142 142
 			}
143 143
 
144
-			foreach( $items as $item )
144
+			foreach ($items as $item)
145 145
 			{
146 146
 				try
147 147
 				{
148
-					if( isset( $payStatus[$item->getOrderBaseId()] ) && $payStatus[$item->getOrderBaseId()] >= $status )
148
+					if (isset($payStatus[$item->getOrderBaseId()]) && $payStatus[$item->getOrderBaseId()] >= $status)
149 149
 					{
150
-						foreach( $processors as $processor ) {
151
-							$processor->begin( $item );
150
+						foreach ($processors as $processor) {
151
+							$processor->begin($item);
152 152
 						}
153 153
 
154
-						$interval = new \DateInterval( $item->getInterval() );
155
-						$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
154
+						$interval = new \DateInterval($item->getInterval());
155
+						$item->setDateNext(date_create($item->getTimeCreated())->add($interval)->format('Y-m-d'));
156 156
 					}
157
-					elseif( $item->getTimeCreated() < $date )
157
+					elseif ($item->getTimeCreated() < $date)
158 158
 					{
159
-						$item->setStatus( 0 );
159
+						$item->setStatus(0);
160 160
 					}
161 161
 
162
-					$manager->saveItem( $item );
162
+					$manager->saveItem($item);
163 163
 				}
164
-				catch( \Exception $e )
164
+				catch (\Exception $e)
165 165
 				{
166 166
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
167
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
168
-					$logger->log( $e->getTraceAsString() );
167
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
168
+					$logger->log($e->getTraceAsString());
169 169
 				}
170 170
 			}
171 171
 
172
-			$count = count( $items );
172
+			$count = count($items);
173 173
 			$start += $count;
174 174
 		}
175
-		while( $count === $search->getSliceSize() );
175
+		while ($count === $search->getSliceSize());
176 176
 	}
177 177
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -153,15 +153,13 @@
 block discarded – undo
153 153
 
154 154
 						$interval = new \DateInterval( $item->getInterval() );
155 155
 						$item->setDateNext( date_create( $item->getTimeCreated() )->add( $interval )->format( 'Y-m-d' ) );
156
-					}
157
-					elseif( $item->getTimeCreated() < $date )
156
+					} elseif( $item->getTimeCreated() < $date )
158 157
 					{
159 158
 						$item->setStatus( 0 );
160 159
 					}
161 160
 
162 161
 					$manager->saveItem( $item );
163
-				}
164
-				catch( \Exception $e )
162
+				} catch( \Exception $e )
165 163
 				{
166 164
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
167 165
 					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
controller/jobs/tests/TestHelperJobs.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public static function getControllerPaths()
48 48
 	{
49
-		return self::getAimeos()->getCustomPaths( 'controller/jobs' );
49
+		return self::getAimeos()->getCustomPaths('controller/jobs');
50 50
 	}
51 51
 
52 52
 
53 53
 	/**
54 54
 	 * @param string $site
55 55
 	 */
56
-	private static function createContext( $site )
56
+	private static function createContext($site)
57 57
 	{
58 58
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
59 59
 		$aimeos = self::getAimeos();
@@ -63,80 +63,80 @@  discard block
 block discarded – undo
63 63
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
64 64
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
65 65
 
66
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
67
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
68
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
69
-		$ctx->setConfig( $conf );
66
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
67
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
68
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
69
+		$ctx->setConfig($conf);
70 70
 
71 71
 
72
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
73
-		$ctx->setLogger( $logger );
72
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
73
+		$ctx->setLogger($logger);
74 74
 
75 75
 
76
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
77
-		$ctx->setDatabaseManager( $dbm );
76
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
77
+		$ctx->setDatabaseManager($dbm);
78 78
 
79 79
 
80
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf );
81
-		$ctx->setFilesystemManager( $fs );
80
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
81
+		$ctx->setFilesystemManager($fs);
82 82
 
83 83
 
84
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf );
85
-		$ctx->setMessageQueueManager( $mq );
84
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($conf);
85
+		$ctx->setMessageQueueManager($mq);
86 86
 
87 87
 
88 88
 		$cache = new \Aimeos\MW\Cache\None();
89
-		$ctx->setCache( $cache );
89
+		$ctx->setCache($cache);
90 90
 
91 91
 
92 92
 		$session = new \Aimeos\MW\Session\None();
93
-		$ctx->setSession( $session );
93
+		$ctx->setSession($session);
94 94
 
95 95
 
96
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
97
-		$ctx->setI18n( array( 'de' => $i18n ) );
96
+		$i18n = new \Aimeos\MW\Translation\None('de');
97
+		$ctx->setI18n(array('de' => $i18n));
98 98
 
99 99
 
100
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
101
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
102
-		$ctx->setLocale( $locale );
100
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
101
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
102
+		$ctx->setLocale($locale);
103 103
 
104 104
 
105
-		$view = self::createView( $conf );
106
-		$ctx->setView( $view );
105
+		$view = self::createView($conf);
106
+		$ctx->setView($view);
107 107
 
108 108
 
109
-		$ctx->setEditor( 'core:controller/jobs' );
109
+		$ctx->setEditor('core:controller/jobs');
110 110
 
111 111
 		return $ctx;
112 112
 	}
113 113
 
114 114
 
115
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
115
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
116 116
 	{
117 117
 		$tmplpaths = array_merge_recursive(
118
-			self::getAimeos()->getCustomPaths( 'client/html/templates' ),
119
-			self::getAimeos()->getCustomPaths( 'controller/jobs/templates' )
118
+			self::getAimeos()->getCustomPaths('client/html/templates'),
119
+			self::getAimeos()->getCustomPaths('controller/jobs/templates')
120 120
 		);
121 121
 
122
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
122
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
123 123
 
124
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
125
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
126
-		$view->addHelper( 'translate', $helper );
124
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
125
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
126
+		$view->addHelper('translate', $helper);
127 127
 
128
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
129
-		$view->addHelper( 'url', $helper );
128
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
129
+		$view->addHelper('url', $helper);
130 130
 
131
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
132
-		$view->addHelper( 'number', $helper );
131
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
132
+		$view->addHelper('number', $helper);
133 133
 
134
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
135
-		$view->addHelper( 'date', $helper );
134
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
135
+		$view->addHelper('date', $helper);
136 136
 
137
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'controller/jobs', 'client/html' ) );
138
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
139
-		$view->addHelper( 'config', $helper );
137
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('controller/jobs', 'client/html'));
138
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
139
+		$view->addHelper('config', $helper);
140 140
 
141 141
 		return $view;
142 142
 	}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Service/Delivery/Standard.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function getName()
31 31
 	{
32
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Process order delivery services' );
32
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Process order delivery services');
33 33
 	}
34 34
 
35 35
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function getDescription()
42 42
 	{
43
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Sends paid orders to the ERP system or logistic partner' );
43
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Sends paid orders to the ERP system or logistic partner');
44 44
 	}
45 45
 
46 46
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 		 * @see controller/jobs/order/email/delivery/standard/limit-days
70 70
 		 * @see controller/jobs/order/service/delivery/batch-max
71 71
 		 */
72
-		$days = $context->getConfig()->get( 'controller/jobs/order/service/delivery/limit-days', 90 );
73
-		$date = date( 'Y-m-d 00:00:00', time() - 86400 * $days );
72
+		$days = $context->getConfig()->get('controller/jobs/order/service/delivery/limit-days', 90);
73
+		$date = date('Y-m-d 00:00:00', time() - 86400 * $days);
74 74
 
75 75
 		/** controller/jobs/order/service/delivery/batch-max
76 76
 		 * Maximum number of orders processed at once by the delivery service provider
@@ -85,71 +85,71 @@  discard block
 block discarded – undo
85 85
 		 * @category Developer
86 86
 		 * @see controller/jobs/order/service/delivery/limit-days
87 87
 		 */
88
-		$maxItems = $context->getConfig()->get( 'controller/jobs/order/service/delivery/batch-max', 100 );
88
+		$maxItems = $context->getConfig()->get('controller/jobs/order/service/delivery/batch-max', 100);
89 89
 
90 90
 
91
-		$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager( $context );
91
+		$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context);
92 92
 		$serviceSearch = $serviceManager->createSearch();
93
-		$serviceSearch->setConditions( $serviceSearch->compare( '==', 'service.type.code', 'delivery' ) );
93
+		$serviceSearch->setConditions($serviceSearch->compare('==', 'service.type.code', 'delivery'));
94 94
 
95
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context );
95
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
96 96
 		$orderSearch = $orderManager->createSearch();
97 97
 
98 98
 		$start = 0;
99 99
 
100 100
 		do
101 101
 		{
102
-			$serviceItems = $serviceManager->searchItems( $serviceSearch );
102
+			$serviceItems = $serviceManager->searchItems($serviceSearch);
103 103
 
104
-			foreach( $serviceItems as $serviceItem )
104
+			foreach ($serviceItems as $serviceItem)
105 105
 			{
106 106
 				try
107 107
 				{
108
-					$serviceProvider = $serviceManager->getProvider( $serviceItem, $serviceItem->getType() );
108
+					$serviceProvider = $serviceManager->getProvider($serviceItem, $serviceItem->getType());
109 109
 
110 110
 					$expr = array(
111
-						$orderSearch->compare( '>', 'order.datepayment', $date ),
112
-						$orderSearch->compare( '>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING ),
113
-						$orderSearch->compare( '==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED ),
114
-						$orderSearch->compare( '==', 'order.base.service.code', $serviceItem->getCode() ),
115
-						$orderSearch->compare( '==', 'order.base.service.type', 'delivery' ),
111
+						$orderSearch->compare('>', 'order.datepayment', $date),
112
+						$orderSearch->compare('>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING),
113
+						$orderSearch->compare('==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED),
114
+						$orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()),
115
+						$orderSearch->compare('==', 'order.base.service.type', 'delivery'),
116 116
 					);
117
-					$orderSearch->setConditions( $orderSearch->combine( '&&', $expr ) );
117
+					$orderSearch->setConditions($orderSearch->combine('&&', $expr));
118 118
 
119 119
 					$orderStart = 0;
120 120
 
121 121
 					do
122 122
 					{
123
-						$orderSearch->setSlice( $orderStart, $maxItems );
124
-						$orderItems = $orderManager->searchItems( $orderSearch );
123
+						$orderSearch->setSlice($orderStart, $maxItems);
124
+						$orderItems = $orderManager->searchItems($orderSearch);
125 125
 
126 126
 						try
127 127
 						{
128
-							$serviceProvider->processBatch( $orderItems );
129
-							$orderManager->saveItems( $orderItems );
128
+							$serviceProvider->processBatch($orderItems);
129
+							$orderManager->saveItems($orderItems);
130 130
 						}
131
-						catch( \Exception $e )
131
+						catch (\Exception $e)
132 132
 						{
133 133
 							$str = 'Error while processing orders by delivery service "%1$s": %2$s';
134
-							$context->getLogger()->log( sprintf( $str, $serviceItem->getLabel(), $e->getMessage() ) );
134
+							$context->getLogger()->log(sprintf($str, $serviceItem->getLabel(), $e->getMessage()));
135 135
 						}
136 136
 
137
-						$orderCount = count( $orderItems );
137
+						$orderCount = count($orderItems);
138 138
 						$orderStart += $orderCount;
139 139
 					}
140
-					while( $orderCount >= $orderSearch->getSliceSize() );
140
+					while ($orderCount >= $orderSearch->getSliceSize());
141 141
 				}
142
-				catch( \Exception $e )
142
+				catch (\Exception $e)
143 143
 				{
144 144
 					$str = 'Error while processing service with ID "%1$s": %2$s';
145
-					$context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) );
145
+					$context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage()));
146 146
 				}
147 147
 			}
148 148
 
149
-			$count = count( $serviceItems );
149
+			$count = count($serviceItems);
150 150
 			$start += $count;
151
-			$serviceSearch->setSlice( $start );
151
+			$serviceSearch->setSlice($start);
152 152
 		}
153
-		while( $count >= $serviceSearch->getSliceSize() );
153
+		while ($count >= $serviceSearch->getSliceSize());
154 154
 	}
155 155
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
127 127
 						{
128 128
 							$serviceProvider->processBatch( $orderItems );
129 129
 							$orderManager->saveItems( $orderItems );
130
-						}
131
-						catch( \Exception $e )
130
+						} catch( \Exception $e )
132 131
 						{
133 132
 							$str = 'Error while processing orders by delivery service "%1$s": %2$s';
134 133
 							$context->getLogger()->log( sprintf( $str, $serviceItem->getLabel(), $e->getMessage() ) );
@@ -138,8 +137,7 @@  discard block
 block discarded – undo
138 137
 						$orderStart += $orderCount;
139 138
 					}
140 139
 					while( $orderCount >= $orderSearch->getSliceSize() );
141
-				}
142
-				catch( \Exception $e )
140
+				} catch( \Exception $e )
143 141
 				{
144 142
 					$str = 'Error while processing service with ID "%1$s": %2$s';
145 143
 					$context->getLogger()->log( sprintf( $str, $serviceItem->getId(), $e->getMessage() ) );
Please login to merge, or discard this patch.
Controller/Common/Subscription/Export/Csv/Processor/Product/Standard.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
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\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Base\Iface $order )
43
+	public function process(\Aimeos\MShop\Subscription\Item\Iface $subscription, \Aimeos\MShop\Order\Item\Base\Iface $order)
44 44
 	{
45 45
 		$result = [];
46 46
 
47
-		foreach( $order->getProducts() as $item )
47
+		foreach ($order->getProducts() as $item)
48 48
 		{
49
-			if( $subscription->getOrderProductId() != $item->getId() ) {
49
+			if ($subscription->getOrderProductId() != $item->getId()) {
50 50
 				continue;
51 51
 			}
52 52
 
53 53
 			$data = [];
54 54
 			$list = $item->toArray();
55 55
 
56
-			foreach( $item->getAttributeItems() as $attrItem )
56
+			foreach ($item->getAttributeItems() as $attrItem)
57 57
 			{
58
-				foreach( $attrItem->toArray() as $key => $value )
58
+				foreach ($attrItem->toArray() as $key => $value)
59 59
 				{
60
-					if( isset( $list[$key] ) ) {
60
+					if (isset($list[$key])) {
61 61
 						$list[$key] .= "\n" . $value;
62 62
 					} else {
63 63
 						$list[$key] = $value;
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 				}
66 66
 			}
67 67
 
68
-			foreach( $this->getMapping() as $pos => $key )
68
+			foreach ($this->getMapping() as $pos => $key)
69 69
 			{
70
-				if( array_key_exists( $key, $list ) ) {
70
+				if (array_key_exists($key, $list)) {
71 71
 					$data[$pos] = $list[$key];
72 72
 				} else {
73 73
 					$data[$pos] = '';
74 74
 				}
75 75
 			}
76 76
 
77
-			ksort( $data );
77
+			ksort($data);
78 78
 			$result[] = $data;
79 79
 		}
80 80
 
Please login to merge, or discard this patch.
src/Controller/Common/Order/Export/Csv/Processor/Product/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
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
 
47
-		foreach( $order->getProducts() as $item )
47
+		foreach ($order->getProducts() as $item)
48 48
 		{
49 49
 			$data = [];
50 50
 			$list = $item->toArray();
51 51
 
52
-			foreach( $item->getAttributeItems() as $attrItem )
52
+			foreach ($item->getAttributeItems() as $attrItem)
53 53
 			{
54
-				foreach( $attrItem->toArray() as $key => $value )
54
+				foreach ($attrItem->toArray() as $key => $value)
55 55
 				{
56
-					if( isset( $list[$key] ) ) {
56
+					if (isset($list[$key])) {
57 57
 						$list[$key] .= "\n" . $value;
58 58
 					} else {
59 59
 						$list[$key] = $value;
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 				}
62 62
 			}
63 63
 
64
-			foreach( $this->getMapping() as $pos => $key )
64
+			foreach ($this->getMapping() as $pos => $key)
65 65
 			{
66
-				if( array_key_exists( $key, $list ) ) {
66
+				if (array_key_exists($key, $list)) {
67 67
 					$data[$pos] = $list[$key];
68 68
 				} else {
69 69
 					$data[$pos] = '';
70 70
 				}
71 71
 			}
72 72
 
73
-			ksort( $data );
73
+			ksort($data);
74 74
 			$result[] = $data;
75 75
 		}
76 76
 
Please login to merge, or discard this patch.
src/Controller/Common/Order/Export/Csv/Processor/Service/Standard.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,25 +40,25 @@  discard block
 block discarded – undo
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
 		$services = $order->getServices();
47 47
 
48
-		krsort( $services );
48
+		krsort($services);
49 49
 
50
-		foreach( $services as $list )
50
+		foreach ($services as $list)
51 51
 		{
52
-			foreach( $list as $item )
52
+			foreach ($list as $item)
53 53
 			{
54 54
 				$data = [];
55 55
 				$list = $item->toArray();
56 56
 
57
-				foreach( $item->getAttributeItems() as $attrItem )
57
+				foreach ($item->getAttributeItems() as $attrItem)
58 58
 				{
59
-					foreach( $attrItem->toArray() as $key => $value )
59
+					foreach ($attrItem->toArray() as $key => $value)
60 60
 					{
61
-						if( isset( $list[$key] ) ) {
61
+						if (isset($list[$key])) {
62 62
 							$list[$key] .= "\n" . $value;
63 63
 						} else {
64 64
 							$list[$key] = $value;
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
 					}
67 67
 				}
68 68
 
69
-				foreach( $this->getMapping() as $pos => $key )
69
+				foreach ($this->getMapping() as $pos => $key)
70 70
 				{
71
-					if( array_key_exists( $key, $list ) ) {
71
+					if (array_key_exists($key, $list)) {
72 72
 						$data[$pos] = $list[$key];
73 73
 					} else {
74 74
 						$data[$pos] = '';
75 75
 					}
76 76
 				}
77 77
 
78
-				ksort( $data );
78
+				ksort($data);
79 79
 				$result[] = $data;
80 80
 			}
81 81
 		}
Please login to merge, or discard this patch.