Completed
Push — master ( 475749...c0b163 )
by Aimeos
02:12
created
Controller/Common/Product/Import/Csv/Processor/Property/StandardTest.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -49,26 +49,26 @@  discard block
 block discarded – undo
49 49
 			4 => '50',
50 50
 		);
51 51
 
52
-		$product = $this->create( 'job_csv_test' );
52
+		$product = $this->create('job_csv_test');
53 53
 
54
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint );
55
-		$object->process( $product, $data );
54
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint);
55
+		$object->process($product, $data);
56 56
 
57 57
 
58 58
 		$pos = 0;
59 59
 		$expected = array(
60
-			array( 'package-weight', '3.00', 'de' ),
61
-			array( 'package-width', '50', null ),
60
+			array('package-weight', '3.00', 'de'),
61
+			array('package-width', '50', null),
62 62
 		);
63 63
 
64 64
 		$items = $product->getPropertyItems();
65
-		$this->assertEquals( 2, count( $items ) );
65
+		$this->assertEquals(2, count($items));
66 66
 
67
-		foreach( $items as $item )
67
+		foreach ($items as $item)
68 68
 		{
69
-			$this->assertEquals( $expected[$pos][0], $item->getType() );
70
-			$this->assertEquals( $expected[$pos][1], $item->getValue() );
71
-			$this->assertEquals( $expected[$pos][2], $item->getLanguageId() );
69
+			$this->assertEquals($expected[$pos][0], $item->getType());
70
+			$this->assertEquals($expected[$pos][1], $item->getValue());
71
+			$this->assertEquals($expected[$pos][2], $item->getLanguageId());
72 72
 			$pos++;
73 73
 		}
74 74
 	}
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 			1 => '10',
92 92
 		);
93 93
 
94
-		$product = $this->create( 'job_csv_test' );
94
+		$product = $this->create('job_csv_test');
95 95
 
96
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint );
97
-		$object->process( $product, $data );
98
-		$object->process( $product, $dataUpdate );
96
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint);
97
+		$object->process($product, $data);
98
+		$object->process($product, $dataUpdate);
99 99
 
100 100
 
101 101
 		$items = $product->getPropertyItems();
102
-		$item = reset( $items );
102
+		$item = reset($items);
103 103
 
104
-		$this->assertEquals( 1, count( $items ) );
105
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item );
104
+		$this->assertEquals(1, count($items));
105
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Property\\Iface', $item);
106 106
 
107
-		$this->assertEquals( 'package-height', $item->getType() );
108
-		$this->assertEquals( '10', $item->getValue() );
107
+		$this->assertEquals('package-height', $item->getType());
108
+		$this->assertEquals('10', $item->getValue());
109 109
 	}
110 110
 
111 111
 
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 			1 => '3.00',
122 122
 		);
123 123
 
124
-		$product = $this->create( 'job_csv_test' );
124
+		$product = $this->create('job_csv_test');
125 125
 
126
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint );
127
-		$object->process( $product, $data );
126
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint);
127
+		$object->process($product, $data);
128 128
 
129
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, [], $this->endpoint );
130
-		$object->process( $product, [] );
129
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, [], $this->endpoint);
130
+		$object->process($product, []);
131 131
 
132 132
 
133 133
 		$items = $product->getPropertyItems();
134 134
 
135
-		$this->assertEquals( 0, count( $items ) );
135
+		$this->assertEquals(0, count($items));
136 136
 	}
137 137
 
138 138
 
@@ -152,23 +152,23 @@  discard block
 block discarded – undo
152 152
 			3 => '3.00',
153 153
 		);
154 154
 
155
-		$product = $this->create( 'job_csv_test' );
155
+		$product = $this->create('job_csv_test');
156 156
 
157
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard( $this->context, $mapping, $this->endpoint );
158
-		$object->process( $product, $data );
157
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Property\Standard($this->context, $mapping, $this->endpoint);
158
+		$object->process($product, $data);
159 159
 
160 160
 		$items = $product->getPropertyItems();
161 161
 
162
-		$this->assertEquals( 1, count( $items ) );
162
+		$this->assertEquals(1, count($items));
163 163
 	}
164 164
 
165 165
 
166 166
 	/**
167 167
 	 * @param string $code
168 168
 	 */
169
-	protected function create( $code )
169
+	protected function create($code)
170 170
 	{
171
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
172
-		return $manager->createItem()->setCode( $code );
171
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
172
+		return $manager->createItem()->setCode($code);
173 173
 	}
174 174
 }
175 175
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Order/Export/Csv/Standard.php 1 patch
Spacing   +60 added lines, -60 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', 'Order export CSV' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Order export CSV');
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', 'Exports orders to CSV file' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports orders to CSV file');
43 43
 	}
44 44
 
45 45
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		 * @category Developer
74 74
 		 * @see controller/common/order/export/csv/max-size
75 75
 		 */
76
-		$mappings = $config->get( 'controller/common/order/export/csv/mapping', $mappings );
76
+		$mappings = $config->get('controller/common/order/export/csv/mapping', $mappings);
77 77
 
78 78
 		/** controller/jobs/order/export/csv/mapping
79 79
 		 * List of mappings between the position in the CSV file and item keys
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		 * @category Developer
89 89
 		 * @see controller/common/order/export/csv/max-size
90 90
 		 */
91
-		$mappings = $config->get( 'controller/jobs/order/export/csv/mapping', $mappings );
91
+		$mappings = $config->get('controller/jobs/order/export/csv/mapping', $mappings);
92 92
 
93 93
 
94 94
 		/** controller/common/order/export/csv/max-size
@@ -106,29 +106,29 @@  discard block
 block discarded – undo
106 106
 		 * @category Developer
107 107
 		 * @see controller/common/order/export/csv/mapping
108 108
 		 */
109
-		$maxcnt = (int) $config->get( 'controller/common/order/export/csv/max-size', 1000 );
109
+		$maxcnt = (int) $config->get('controller/common/order/export/csv/max-size', 1000);
110 110
 
111 111
 
112
-		$processors = $this->getProcessors( $mappings );
113
-		$mq = $context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'order-export' );
112
+		$processors = $this->getProcessors($mappings);
113
+		$mq = $context->getMessageQueueManager()->get('mq-admin')->getQueue('order-export');
114 114
 
115
-		while( ( $msg = $mq->get() ) !== null )
115
+		while (($msg = $mq->get()) !== null)
116 116
 		{
117 117
 			try
118 118
 			{
119
-				if( ( $data = json_decode( $msg->getBody(), true ) ) === null ) {
120
-					throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid message: %1$s', $msg->getBody() ) );
119
+				if (($data = json_decode($msg->getBody(), true)) === null) {
120
+					throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid message: %1$s', $msg->getBody()));
121 121
 				}
122 122
 
123
-				$this->export( $processors, $data, $maxcnt );
123
+				$this->export($processors, $data, $maxcnt);
124 124
 			}
125
-			catch( \Exception $e )
125
+			catch (\Exception $e)
126 126
 			{
127
-				$logger->log( 'Order export error: ' . $e->getMessage() );
128
-				$logger->log( $e->getTraceAsString() );
127
+				$logger->log('Order export error: ' . $e->getMessage());
128
+				$logger->log($e->getTraceAsString());
129 129
 			}
130 130
 
131
-			$mq->del( $msg );
131
+			$mq->del($msg);
132 132
 		}
133 133
 	}
134 134
 
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context item
140 140
 	 * @param string $path Absolute path to the exported file
141 141
 	 */
142
-	protected function addJob( $context, $path )
142
+	protected function addJob($context, $path)
143 143
 	{
144
-		$manager = \Aimeos\MAdmin\Factory::createManager( $context, 'job' );
144
+		$manager = \Aimeos\MAdmin\Factory::createManager($context, 'job');
145 145
 
146 146
 		$item = $manager->createItem();
147
-		$item->setResult( ['file' => $path] );
148
-		$item->setLabel( $path );
147
+		$item->setResult(['file' => $path]);
148
+		$item->setLabel($path);
149 149
 
150
-		$manager->saveItem( $item, false );
150
+		$manager->saveItem($item, false);
151 151
 	}
152 152
 
153 153
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 * @see controller/jobs/order/export/csv/container/content
178 178
 		 * @see controller/jobs/order/export/csv/container/options
179 179
 		 */
180
-		$location = $config->get( 'controller/jobs/order/export/csv/location', sys_get_temp_dir() );
180
+		$location = $config->get('controller/jobs/order/export/csv/location', sys_get_temp_dir());
181 181
 
182 182
 		/** controller/jobs/order/export/csv/container/type
183 183
 		 * Nave of the container type to read the data from
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		 * @see controller/jobs/order/export/csv/container/content
201 201
 		 * @see controller/jobs/order/export/csv/container/options
202 202
 		 */
203
-		$container = $config->get( 'controller/jobs/order/export/csv/container/type', 'Directory' );
203
+		$container = $config->get('controller/jobs/order/export/csv/container/type', 'Directory');
204 204
 
205 205
 		/** controller/jobs/order/export/csv/container/content
206 206
 		 * Name of the content type inside the container to read the data from
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		 * @see controller/jobs/order/export/csv/container/type
222 222
 		 * @see controller/jobs/order/export/csv/container/options
223 223
 		 */
224
-		$content = $config->get( 'controller/jobs/order/export/csv/container/content', 'CSV' );
224
+		$content = $config->get('controller/jobs/order/export/csv/container/content', 'CSV');
225 225
 
226 226
 		/** controller/jobs/order/export/csv/container/options
227 227
 		 * List of file container options for the order export files
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 		 * @see controller/jobs/order/export/csv/container/content
240 240
 		 * @see controller/jobs/order/export/csv/container/type
241 241
 		 */
242
-		$options = $config->get( 'controller/jobs/order/export/csv/container/options', [] );
242
+		$options = $config->get('controller/jobs/order/export/csv/container/options', []);
243 243
 
244
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
244
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
245 245
 	}
246 246
 
247 247
 
@@ -253,56 +253,56 @@  discard block
 block discarded – undo
253 253
 	 * @param integer $maxcnt Maximum number of retrieved orders at once
254 254
 	 * @return string Path of the file containing the exported data
255 255
 	 */
256
-	protected function export( array $processors, $msg, $maxcnt )
256
+	protected function export(array $processors, $msg, $maxcnt)
257 257
 	{
258
-		$lcontext = $this->getLocaleContext( $msg );
258
+		$lcontext = $this->getLocaleContext($msg);
259 259
 		$baseRef = ['order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'];
260 260
 
261
-		$manager = \Aimeos\MShop\Factory::createManager( $lcontext, 'order' );
262
-		$baseManager = \Aimeos\MShop\Factory::createManager( $lcontext, 'order/base' );
261
+		$manager = \Aimeos\MShop\Factory::createManager($lcontext, 'order');
262
+		$baseManager = \Aimeos\MShop\Factory::createManager($lcontext, 'order/base');
263 263
 
264 264
 		$container = $this->getContainer();
265
-		$content = $container->create( 'order-export_' . date( 'Y-m-d_H-i-s' ) );
266
-		$search = $this->initCriteria( $manager->createSearch()->setSlice( 0, 0x7fffffff ), $msg );
265
+		$content = $container->create('order-export_' . date('Y-m-d_H-i-s'));
266
+		$search = $this->initCriteria($manager->createSearch()->setSlice(0, 0x7fffffff), $msg);
267 267
 		$start = 0;
268 268
 
269 269
 		do
270 270
 		{
271 271
 			$baseIds = [];
272
-			$search->setSlice( $start, $maxcnt );
273
-			$items = $manager->searchItems( $search );
272
+			$search->setSlice($start, $maxcnt);
273
+			$items = $manager->searchItems($search);
274 274
 
275
-			foreach( $items as $item ) {
275
+			foreach ($items as $item) {
276 276
 				$baseIds[] = $item->getBaseId();
277 277
 			}
278 278
 
279 279
 			$baseSearch = $baseManager->createSearch();
280
-			$baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) );
281
-			$baseSearch->setSlice( 0, count( $baseIds ) );
280
+			$baseSearch->setConditions($baseSearch->compare('==', 'order.base.id', $baseIds));
281
+			$baseSearch->setSlice(0, count($baseIds));
282 282
 
283
-			$baseItems = $baseManager->searchItems( $baseSearch, $baseRef );
283
+			$baseItems = $baseManager->searchItems($baseSearch, $baseRef);
284 284
 
285
-			foreach( $items as $id => $item )
285
+			foreach ($items as $id => $item)
286 286
 			{
287
-				foreach( $processors as $type => $processor )
287
+				foreach ($processors as $type => $processor)
288 288
 				{
289
-					foreach( $processor->process( $item, $baseItems[$item->getBaseId()] ) as $line ) {
290
-						$content->add( [0 => $type, 1 => $id] + $line );
289
+					foreach ($processor->process($item, $baseItems[$item->getBaseId()]) as $line) {
290
+						$content->add([0 => $type, 1 => $id] + $line);
291 291
 					}
292 292
 				}
293 293
 			}
294 294
 
295
-			$count = count( $items );
295
+			$count = count($items);
296 296
 			$start += $count;
297 297
 		}
298
-		while( $count === $search->getSliceSize() );
298
+		while ($count === $search->getSliceSize());
299 299
 
300 300
 		$path = $content->getResource();
301
-		$container->add( $content );
301
+		$container->add($content);
302 302
 		$container->close();
303 303
 
304
-		$path = $this->moveFile( $lcontext, $path );
305
-		$this->addJob( $lcontext, $path );
304
+		$path = $this->moveFile($lcontext, $path);
305
+		$this->addJob($lcontext, $path);
306 306
 	}
307 307
 
308 308
 
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 	 * @param array $msg Message data including a "sitecode" value
313 313
 	 * @return \Aimeos\MShop\Context\Item\Iface New context item with updated locale
314 314
 	 */
315
-	protected function getLocaleContext( array $msg )
315
+	protected function getLocaleContext(array $msg)
316 316
 	{
317 317
 		$lcontext = clone $this->getContext();
318
-		$manager = \Aimeos\MShop\Factory::createManager( $lcontext, 'locale' );
318
+		$manager = \Aimeos\MShop\Factory::createManager($lcontext, 'locale');
319 319
 
320
-		$sitecode = ( isset( $msg['sitecode'] ) ? $msg['sitecode'] : 'default' );
321
-		$localeItem = $manager->bootstrap( $sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_PATH );
320
+		$sitecode = (isset($msg['sitecode']) ? $msg['sitecode'] : 'default');
321
+		$localeItem = $manager->bootstrap($sitecode, '', '', false, \Aimeos\MShop\Locale\Manager\Base::SITE_PATH);
322 322
 
323
-		return $lcontext->setLocale( $localeItem );
323
+		return $lcontext->setLocale($localeItem);
324 324
 	}
325 325
 
326 326
 
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 	 * @param array $msg Message data
332 332
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
333 333
 	 */
334
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $msg )
334
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $msg)
335 335
 	{
336
-		if( isset( $msg['filter'] ) ) {
337
-			$criteria->setConditions( $criteria->toConditions( $msg['filter'] ) );
336
+		if (isset($msg['filter'])) {
337
+			$criteria->setConditions($criteria->toConditions($msg['filter']));
338 338
 		}
339 339
 
340
-		if( isset( $msg['sort'] ) ) {
341
-			$criteria->setSortations( $criteria->toSortations( $msg['sort'] ) );
340
+		if (isset($msg['sort'])) {
341
+			$criteria->setSortations($criteria->toSortations($msg['sort']));
342 342
 		}
343 343
 
344 344
 		return $criteria;
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
 	 * @param string $path Absolute path to the exported file
353 353
 	 * @return string Relative path of the file in the storage
354 354
 	 */
355
-	protected function moveFile( $context, $path )
355
+	protected function moveFile($context, $path)
356 356
 	{
357
-		$filename = basename( $path );
358
-		$context->getFileSystemManager()->get( 'fs-admin' )->writef( $filename, $path );
357
+		$filename = basename($path);
358
+		$context->getFileSystemManager()->get('fs-admin')->writef($filename, $path);
359 359
 
360
-		unlink( $path );
360
+		unlink($path);
361 361
 		return $filename;
362 362
 	}
363 363
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Subscription/Process/Begin/Standard.php 1 patch
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.
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/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.
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php 1 patch
Spacing   +50 added lines, -50 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', '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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,44 +344,44 @@  discard block
 block discarded – undo
344 344
 	 * @param boolean $default True to filter exported products by default criteria
345 345
 	 * @return array List of content (file) names
346 346
 	 */
347
-	protected function export( \Aimeos\MW\Container\Iface $container, $default = true )
347
+	protected function export(\Aimeos\MW\Container\Iface $container, $default = true)
348 348
 	{
349
-		$domains = $this->getConfig( 'domains', [] );
350
-		$maxItems = $this->getConfig( 'max-items', 10000 );
351
-		$maxQuery = $this->getConfig( 'max-query', 1000 );
349
+		$domains = $this->getConfig('domains', []);
350
+		$maxItems = $this->getConfig('max-items', 10000);
351
+		$maxQuery = $this->getConfig('max-query', 1000);
352 352
 
353 353
 		$start = 0; $filenum = 1;
354 354
 		$names = [];
355 355
 
356
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' );
356
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'index');
357 357
 
358
-		$search = $manager->createSearch( $default );
359
-		$search->setConditions( $search->compare( '!=', 'index.catalog.id', null ) );
360
-		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
361
-		$search->setSlice( 0, $maxQuery );
358
+		$search = $manager->createSearch($default);
359
+		$search->setConditions($search->compare('!=', 'index.catalog.id', null));
360
+		$search->setSortations(array($search->sort('+', 'product.id')));
361
+		$search->setSlice(0, $maxQuery);
362 362
 
363
-		$content = $this->createContent( $container, $filenum );
363
+		$content = $this->createContent($container, $filenum);
364 364
 		$names[] = $content->getResource();
365 365
 
366 366
 		do
367 367
 		{
368
-			$items = $manager->searchItems( $search, $domains );
369
-			$this->addItems( $content, $items );
368
+			$items = $manager->searchItems($search, $domains);
369
+			$this->addItems($content, $items);
370 370
 
371
-			$count = count( $items );
371
+			$count = count($items);
372 372
 			$start += $count;
373
-			$search->setSlice( $start, $maxQuery );
373
+			$search->setSlice($start, $maxQuery);
374 374
 
375
-			if( $start + $maxQuery > $maxItems * $filenum )
375
+			if ($start + $maxQuery > $maxItems * $filenum)
376 376
 			{
377
-				$this->closeContent( $content );
378
-				$content = $this->createContent( $container, ++$filenum );
377
+				$this->closeContent($content);
378
+				$content = $this->createContent($container, ++$filenum);
379 379
 				$names[] = $content->getResource();
380 380
 			}
381 381
 		}
382
-		while( $count >= $search->getSliceSize() );
382
+		while ($count >= $search->getSliceSize());
383 383
 
384
-		$this->closeContent( $content );
384
+		$this->closeContent($content);
385 385
 
386 386
 		return $names;
387 387
 	}
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 	 * @param mixed $default Default value if name is unknown
395 395
 	 * @return mixed Configuration value
396 396
 	 */
397
-	protected function getConfig( $name, $default = null )
397
+	protected function getConfig($name, $default = null)
398 398
 	{
399 399
 		$config = $this->getContext()->getConfig();
400 400
 
401
-		switch( $name )
401
+		switch ($name)
402 402
 		{
403 403
 			case 'domains':
404 404
 				/** controller/jobs/product/export/sitemap/domains
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 				 * @see controller/jobs/product/export/sitemap/max-query
420 420
 				 * @see controller/jobs/product/export/sitemap/changefreq
421 421
 				 */
422
-				return $config->get( 'controller/jobs/product/export/sitemap/domains', $default );
422
+				return $config->get('controller/jobs/product/export/sitemap/domains', $default);
423 423
 
424 424
 			case 'max-items':
425 425
 				/** controller/jobs/product/export/sitemap/max-items
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 				 * @see controller/jobs/product/export/sitemap/changefreq
445 445
 				 * @see controller/jobs/product/export/sitemap/domains
446 446
 				 */
447
-				return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 );
447
+				return $config->get('controller/jobs/product/export/sitemap/max-items', 50000);
448 448
 
449 449
 			case 'max-query':
450 450
 				/** controller/jobs/product/export/sitemap/max-query
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 				 * @see controller/jobs/product/export/sitemap/changefreq
466 466
 				 * @see controller/jobs/product/export/sitemap/domains
467 467
 				 */
468
-				return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 );
468
+				return $config->get('controller/jobs/product/export/sitemap/max-query', 1000);
469 469
 		}
470 470
 
471 471
 		return $default;
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 	 * @param integer $number Current file number
479 479
 	 * @return string New file name
480 480
 	 */
481
-	protected function getFilename( $number )
481
+	protected function getFilename($number)
482 482
 	{
483
-		return sprintf( 'aimeos-sitemap-%d.xml', $number );
483
+		return sprintf('aimeos-sitemap-%d.xml', $number);
484 484
 	}
485 485
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Order/Service/Delivery/StandardTest.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		$context = \TestHelperJobs::getContext();
21 21
 		$aimeos = \TestHelperJobs::getAimeos();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos);
24 24
 	}
25 25
 
26 26
 
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function testGetName()
34 34
 	{
35
-		$this->assertEquals( 'Process order delivery services', $this->object->getName() );
35
+		$this->assertEquals('Process order delivery services', $this->object->getName());
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetDescription()
40 40
 	{
41 41
 		$text = 'Sends paid orders to the ERP system or logistic partner';
42
-		$this->assertEquals( $text, $this->object->getDescription() );
42
+		$this->assertEquals($text, $this->object->getDescription());
43 43
 	}
44 44
 
45 45
 
@@ -50,47 +50,47 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
 		$name = 'ControllerJobsServiceDeliveryProcessDefaultRun';
53
-		$context->getConfig()->set( 'mshop/service/manager/name', $name );
54
-		$context->getConfig()->set( 'mshop/order/manager/name', $name );
53
+		$context->getConfig()->set('mshop/service/manager/name', $name);
54
+		$context->getConfig()->set('mshop/order/manager/name', $name);
55 55
 
56 56
 
57
-		$serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
58
-			->setMethods( array( 'getProvider', 'searchItems' ) )
59
-			->setConstructorArgs( array( $context ) )
57
+		$serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
58
+			->setMethods(array('getProvider', 'searchItems'))
59
+			->setConstructorArgs(array($context))
60 60
 			->getMock();
61 61
 
62
-		$orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
63
-			->setMethods( array( 'saveItems', 'searchItems' ) )
64
-			->setConstructorArgs( array( $context ) )
62
+		$orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
63
+			->setMethods(array('saveItems', 'searchItems'))
64
+			->setConstructorArgs(array($context))
65 65
 			->getMock();
66 66
 
67
-		\Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub );
68
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub );
67
+		\Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub);
68
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
69 69
 
70 70
 
71 71
 		$serviceItem = $serviceManagerStub->createItem();
72 72
 		$orderItem = $orderManagerStub->createItem();
73 73
 
74
-		$serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
75
-			->setConstructorArgs( array( $context, $serviceItem ) )
74
+		$serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
75
+			->setConstructorArgs(array($context, $serviceItem))
76 76
 			->getMock();
77 77
 
78 78
 
79
-		$serviceManagerStub->expects( $this->once() )->method( 'searchItems' )
80
-			->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) );
79
+		$serviceManagerStub->expects($this->once())->method('searchItems')
80
+			->will($this->onConsecutiveCalls(array($serviceItem), []));
81 81
 
82
-		$serviceManagerStub->expects( $this->once() )->method( 'getProvider' )
83
-			->will( $this->returnValue( $serviceProviderStub ) );
82
+		$serviceManagerStub->expects($this->once())->method('getProvider')
83
+			->will($this->returnValue($serviceProviderStub));
84 84
 
85
-		$orderManagerStub->expects( $this->once() )->method( 'searchItems' )
86
-			->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) );
85
+		$orderManagerStub->expects($this->once())->method('searchItems')
86
+			->will($this->onConsecutiveCalls(array($orderItem), []));
87 87
 
88
-		$serviceProviderStub->expects( $this->once() )->method( 'processBatch' );
88
+		$serviceProviderStub->expects($this->once())->method('processBatch');
89 89
 
90
-		$orderManagerStub->expects( $this->once() )->method( 'saveItems' );
90
+		$orderManagerStub->expects($this->once())->method('saveItems');
91 91
 
92 92
 
93
-		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos );
93
+		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos);
94 94
 		$object->run();
95 95
 	}
96 96
 
@@ -102,48 +102,48 @@  discard block
 block discarded – undo
102 102
 
103 103
 
104 104
 		$name = 'ControllerJobsServiceDeliveryProcessDefaultRun';
105
-		$context->getConfig()->set( 'mshop/service/manager/name', $name );
106
-		$context->getConfig()->set( 'mshop/order/manager/name', $name );
105
+		$context->getConfig()->set('mshop/service/manager/name', $name);
106
+		$context->getConfig()->set('mshop/order/manager/name', $name);
107 107
 
108 108
 
109
-		$orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
110
-			->setMethods( array( 'saveItems', 'searchItems' ) )
111
-			->setConstructorArgs( array( $context ) )
109
+		$orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
110
+			->setMethods(array('saveItems', 'searchItems'))
111
+			->setConstructorArgs(array($context))
112 112
 			->getMock();
113 113
 
114
-		$serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
115
-			->setMethods( array( 'getProvider', 'searchItems' ) )
116
-			->setConstructorArgs( array( $context ) )
114
+		$serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
115
+			->setMethods(array('getProvider', 'searchItems'))
116
+			->setConstructorArgs(array($context))
117 117
 			->getMock();
118 118
 
119
-		\Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub );
120
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub );
119
+		\Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub);
120
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
121 121
 
122 122
 
123 123
 		$serviceItem = $serviceManagerStub->createItem();
124 124
 		$orderItem = $orderManagerStub->createItem();
125 125
 
126
-		$serviceProviderStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
127
-			->setConstructorArgs( array( $context, $serviceItem ) )
126
+		$serviceProviderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
127
+			->setConstructorArgs(array($context, $serviceItem))
128 128
 			->getMock();
129 129
 
130 130
 
131
-		$serviceManagerStub->expects( $this->once() )->method( 'searchItems' )
132
-			->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) );
131
+		$serviceManagerStub->expects($this->once())->method('searchItems')
132
+			->will($this->onConsecutiveCalls(array($serviceItem), []));
133 133
 
134
-		$serviceManagerStub->expects( $this->once() )->method( 'getProvider' )
135
-			->will( $this->returnValue( $serviceProviderStub ) );
134
+		$serviceManagerStub->expects($this->once())->method('getProvider')
135
+			->will($this->returnValue($serviceProviderStub));
136 136
 
137
-		$orderManagerStub->expects( $this->once() )->method( 'searchItems' )
138
-			->will( $this->onConsecutiveCalls( array( $orderItem ), [] ) );
137
+		$orderManagerStub->expects($this->once())->method('searchItems')
138
+			->will($this->onConsecutiveCalls(array($orderItem), []));
139 139
 
140
-		$serviceProviderStub->expects( $this->once() )->method( 'processBatch' )
141
-			->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test order service delivery: process' ) ) );
140
+		$serviceProviderStub->expects($this->once())->method('processBatch')
141
+			->will($this->throwException(new \Aimeos\MShop\Service\Exception('test order service delivery: process')));
142 142
 
143
-		$orderManagerStub->expects( $this->never() )->method( 'saveItems' );
143
+		$orderManagerStub->expects($this->never())->method('saveItems');
144 144
 
145 145
 
146
-		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos );
146
+		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos);
147 147
 		$object->run();
148 148
 	}
149 149
 
@@ -155,36 +155,36 @@  discard block
 block discarded – undo
155 155
 
156 156
 
157 157
 		$name = 'ControllerJobsServiceDeliveryProcessDefaultRun';
158
-		$context->getConfig()->set( 'mshop/service/manager/name', $name );
159
-		$context->getConfig()->set( 'mshop/order/manager/name', $name );
158
+		$context->getConfig()->set('mshop/service/manager/name', $name);
159
+		$context->getConfig()->set('mshop/order/manager/name', $name);
160 160
 
161 161
 
162
-		$orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
163
-			->setMethods( array( 'saveItem', 'searchItems' ) )
164
-			->setConstructorArgs( array( $context ) )
162
+		$orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
163
+			->setMethods(array('saveItem', 'searchItems'))
164
+			->setConstructorArgs(array($context))
165 165
 			->getMock();
166 166
 
167
-		$serviceManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
168
-			->setMethods( array( 'getProvider', 'searchItems' ) )
169
-			->setConstructorArgs( array( $context ) )
167
+		$serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
168
+			->setMethods(array('getProvider', 'searchItems'))
169
+			->setConstructorArgs(array($context))
170 170
 			->getMock();
171 171
 
172
-		\Aimeos\MShop\Service\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub );
173
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub );
172
+		\Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub);
173
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
174 174
 
175 175
 
176 176
 		$serviceItem = $serviceManagerStub->createItem();
177 177
 
178
-		$serviceManagerStub->expects( $this->once() )->method( 'searchItems' )
179
-			->will( $this->onConsecutiveCalls( array( $serviceItem ), [] ) );
178
+		$serviceManagerStub->expects($this->once())->method('searchItems')
179
+			->will($this->onConsecutiveCalls(array($serviceItem), []));
180 180
 
181
-		$serviceManagerStub->expects( $this->once() )->method( 'getProvider' )
182
-			->will( $this->throwException( new \Aimeos\MShop\Service\Exception( 'test sorder service delivery: getProvider' ) ) );
181
+		$serviceManagerStub->expects($this->once())->method('getProvider')
182
+			->will($this->throwException(new \Aimeos\MShop\Service\Exception('test sorder service delivery: getProvider')));
183 183
 
184
-		$orderManagerStub->expects( $this->never() )->method( 'searchItems' );
184
+		$orderManagerStub->expects($this->never())->method('searchItems');
185 185
 
186 186
 
187
-		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard( $context, $aimeos );
187
+		$object = new \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard($context, $aimeos);
188 188
 		$object->run();
189 189
 	}
190 190
 }
Please login to merge, or discard this patch.