Completed
Push — master ( ad140d...53844a )
by Aimeos
03:21
created
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Factory.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string|null $name Name of the controller or "Standard" if null
30 30
 	 * @return \Aimeos\Controller\Jobs\Iface New controller object
31 31
 	 */
32
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
32
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
33 33
 	{
34 34
 		/** controller/jobs/product/export/sitemap/name
35 35
 		 * Class name of the used product suggestions scheduler controller implementation
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		 * @since 2015.01
65 65
 		 * @category Developer
66 66
 		 */
67
-		if ( $name === null ) {
67
+		if ($name === null) {
68 68
 			$name = $context->getConfig()->get('controller/jobs/product/export/sitemap/name', 'Standard');
69 69
 		}
70 70
 
71
-		if ( ctype_alnum($name) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73 73
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Export\\Sitemap\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Controller\\Jobs\\Iface';
78 78
 		$classname = '\\Aimeos\\Controller\\Jobs\\Product\\Export\\Sitemap\\' . $name;
79 79
 
80
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
80
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
81 81
 
82 82
 		/** controller/jobs/product/export/sitemap/decorators/excludes
83 83
 		 * Excludes decorators added by the "common" option from the product export sitemap job controller
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
 		 * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/excludes
155 155
 		 * @see controller/jobs/product/export/sitemap/export/sitemap/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'product/export/sitemap' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'product/export/sitemap');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Export/Sitemap/Standard.php 1 patch
Spacing   +26 added lines, -26 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.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		$view->siteItems = $items;
129 129
 		$view->siteFreq = $changefreq;
130 130
 
131
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
131
+		$content->add($view->render($view->config($tplconf, $default)));
132 132
 	}
133 133
 
134 134
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		 * @see controller/jobs/product/export/sitemap/max-query
175 175
 		 * @see controller/jobs/product/export/sitemap/changefreq
176 176
 		 */
177
-		$location = $config->get( 'controller/jobs/product/export/sitemap/location', sys_get_temp_dir() );
177
+		$location = $config->get('controller/jobs/product/export/sitemap/location', sys_get_temp_dir());
178 178
 
179 179
 		/** controller/jobs/product/export/sitemap/container/options
180 180
 		 * List of file container options for the site map files
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 		 * @see controller/jobs/product/export/sitemap/max-query
195 195
 		 * @see controller/jobs/product/export/sitemap/changefreq
196 196
 		*/
197
-		$options = $config->get( 'controller/jobs/product/export/sitemap/container/options', array() );
197
+		$options = $config->get('controller/jobs/product/export/sitemap/container/options', array());
198 198
 
199
-		return \Aimeos\MW\Container\Factory::getContainer( $location, 'Directory', 'Gzip', $options );
199
+		return \Aimeos\MW\Container\Factory::getContainer($location, 'Directory', 'Gzip', $options);
200 200
 	}
201 201
 
202 202
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param integer $filenum New file number
208 208
 	 * @return \Aimeos\MW\Container\Content\Iface New content object
209 209
 	 */
210
-	protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum )
210
+	protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum)
211 211
 	{
212 212
 		$config = $this->getContext()->getConfig();
213 213
 
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 
239 239
 		$view = $this->getContext()->getView();
240 240
 
241
-		$content = $container->create( $this->getFilename( $filenum ) );
242
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
243
-		$container->add( $content );
241
+		$content = $container->create($this->getFilename($filenum));
242
+		$content->add($view->render($view->config($tplconf, $default)));
243
+		$container->add($content);
244 244
 
245 245
 		return $content;
246 246
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param \Aimeos\MW\Container\Content\Iface $content
253 253
 	 */
254
-	protected function closeContent( \Aimeos\MW\Container\Content\Iface $content )
254
+	protected function closeContent(\Aimeos\MW\Container\Content\Iface $content)
255 255
 	{
256 256
 		$config = $this->getContext()->getConfig();
257 257
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
 		$view = $this->getContext()->getView();
284 284
 
285
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
285
+		$content->add($view->render($view->config($tplconf, $default)));
286 286
 	}
287 287
 
288 288
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param \Aimeos\MW\Container\Iface $container File container object
293 293
 	 * @param array $files List of generated site map file names
294 294
 	 */
295
-	protected function createSitemapIndex( \Aimeos\MW\Container\Iface $container, array $files )
295
+	protected function createSitemapIndex(\Aimeos\MW\Container\Iface $container, array $files)
296 296
 	{
297 297
 		$config = $this->getContext()->getConfig();
298 298
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 		$view = $this->getContext()->getView();
325 325
 		$view->siteFiles = $files;
326 326
 
327
-		$content = $container->create( 'aimeos-sitemap-index.xml' );
328
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
329
-		$container->add( $content );
327
+		$content = $container->create('aimeos-sitemap-index.xml');
328
+		$content->add($view->render($view->config($tplconf, $default)));
329
+		$container->add($content);
330 330
 	}
331 331
 
332 332
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param mixed $default Default value if name is unknown
338 338
 	 * @return mixed Configuration value
339 339
 	 */
340
-	protected function getConfig( $name, $default = null )
340
+	protected function getConfig($name, $default = null)
341 341
 	{
342 342
 		$config = $this->getContext()->getConfig();
343 343
 
344
-		switch( $name )
344
+		switch ($name)
345 345
 		{
346 346
 			case 'domain':
347 347
 				return array();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 				 * @see controller/jobs/product/export/sitemap/max-query
369 369
 				 * @see controller/jobs/product/export/sitemap/changefreq
370 370
 				 */
371
-				return $config->get( 'controller/jobs/product/export/sitemap/max-items', 50000 );
371
+				return $config->get('controller/jobs/product/export/sitemap/max-items', 50000);
372 372
 
373 373
 			case 'max-query':
374 374
 				/** controller/jobs/product/export/sitemap/max-query
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				 * @see controller/jobs/product/export/sitemap/max-items
389 389
 				 * @see controller/jobs/product/export/sitemap/changefreq
390 390
 				 */
391
-				return $config->get( 'controller/jobs/product/export/sitemap/max-query', 1000 );
391
+				return $config->get('controller/jobs/product/export/sitemap/max-query', 1000);
392 392
 		}
393 393
 
394 394
 		return $default;
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 * @param integer $number Current file number
402 402
 	 * @return string New file name
403 403
 	 */
404
-	protected function getFilename( $number )
404
+	protected function getFilename($number)
405 405
 	{
406
-		return sprintf( 'aimeos-sitemap-%d.xml', $number );
406
+		return sprintf('aimeos-sitemap-%d.xml', $number);
407 407
 	}
408 408
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Export/Standard.php 1 patch
Spacing   +42 added lines, -42 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 export' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product export');
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 all available products' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Exports all available products');
43 43
 	}
44 44
 
45 45
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function run()
52 52
 	{
53 53
 		$container = $this->createContainer();
54
-		$this->export( $container );
54
+		$this->export($container);
55 55
 		$container->close();
56 56
 	}
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param \Aimeos\MW\Container\Content\Iface $content File content object
63 63
 	 * @param \Aimeos\MShop\Product\Item\Iface[] $items List of product items
64 64
 	 */
65
-	protected function addItems( \Aimeos\MW\Container\Content\Iface $content, array $items )
65
+	protected function addItems(\Aimeos\MW\Container\Content\Iface $content, array $items)
66 66
 	{
67 67
 		$config = $this->getContext()->getConfig();
68 68
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 		$view->exportItems = $items;
97 97
 
98
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
98
+		$content->add($view->render($view->config($tplconf, $default)));
99 99
 	}
100 100
 
101 101
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		 * @see controller/jobs/product/export/max-items
125 125
 		 * @see controller/jobs/product/export/max-query
126 126
 		 */
127
-		$location = $config->get( 'controller/jobs/product/export/location', sys_get_temp_dir() );
127
+		$location = $config->get('controller/jobs/product/export/location', sys_get_temp_dir());
128 128
 
129 129
 		/** controller/jobs/product/export/standard/container/type
130 130
 		 * List of file container options for the export files
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		 * @see controller/jobs/product/export/max-items
142 142
 		 * @see controller/jobs/product/export/max-query
143 143
 		*/
144
-		$container = $config->get( 'controller/jobs/product/export/standard/container/type', 'Directory' );
144
+		$container = $config->get('controller/jobs/product/export/standard/container/type', 'Directory');
145 145
 
146 146
 		/** controller/jobs/product/export/standard/container/content
147 147
 		 * List of file container options for the export files
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		 * @see controller/jobs/product/export/max-items
159 159
 		 * @see controller/jobs/product/export/max-query
160 160
 		 */
161
-		$content = $config->get( 'controller/jobs/product/export/standard/container/content', 'Binary' );
161
+		$content = $config->get('controller/jobs/product/export/standard/container/content', 'Binary');
162 162
 
163 163
 		/** controller/jobs/product/export/standard/container/options
164 164
 		 * List of file container options for the export files
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 		 * @see controller/jobs/product/export/max-items
176 176
 		 * @see controller/jobs/product/export/max-query
177 177
 		 */
178
-		$options = $config->get( 'controller/jobs/product/export/standard/container/options', array() );
178
+		$options = $config->get('controller/jobs/product/export/standard/container/options', array());
179 179
 
180
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
180
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
181 181
 	}
182 182
 
183 183
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @param integer $filenum New file number
189 189
 	 * @return \Aimeos\MW\Container\Content\Iface New content object
190 190
 	 */
191
-	protected function createContent( \Aimeos\MW\Container\Iface $container, $filenum )
191
+	protected function createContent(\Aimeos\MW\Container\Iface $container, $filenum)
192 192
 	{
193 193
 		$config = $this->getContext()->getConfig();
194 194
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$view = $this->getContext()->getView();
221 221
 
222
-		$content = $container->create( $this->getFilename( $filenum ) );
223
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
224
-		$container->add( $content );
222
+		$content = $container->create($this->getFilename($filenum));
223
+		$content->add($view->render($view->config($tplconf, $default)));
224
+		$container->add($content);
225 225
 
226 226
 		return $content;
227 227
 	}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 *
233 233
 	 * @param \Aimeos\MW\Container\Content\Iface $content
234 234
 	 */
235
-	protected function closeContent( \Aimeos\MW\Container\Content\Iface $content )
235
+	protected function closeContent(\Aimeos\MW\Container\Content\Iface $content)
236 236
 	{
237 237
 		$config = $this->getContext()->getConfig();
238 238
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 		$view = $this->getContext()->getView();
265 265
 
266
-		$content->add( $view->render( $view->config( $tplconf, $default ) ) );
266
+		$content->add($view->render($view->config($tplconf, $default)));
267 267
 	}
268 268
 
269 269
 
@@ -273,45 +273,45 @@  discard block
 block discarded – undo
273 273
 	 * @param \Aimeos\MW\Container\Iface $container Container object
274 274
 	 * @return array List of content (file) names
275 275
 	 */
276
-	protected function export( \Aimeos\MW\Container\Iface $container )
276
+	protected function export(\Aimeos\MW\Container\Iface $container)
277 277
 	{
278
-		$default = array( 'attribute', 'media', 'price', 'product', 'text' );
278
+		$default = array('attribute', 'media', 'price', 'product', 'text');
279 279
 
280
-		$domains = $this->getConfig( 'domains', $default );
281
-		$maxItems = $this->getConfig( 'max-items', 10000 );
282
-		$maxQuery = $this->getConfig( 'max-query', 1000 );
280
+		$domains = $this->getConfig('domains', $default);
281
+		$maxItems = $this->getConfig('max-items', 10000);
282
+		$maxQuery = $this->getConfig('max-query', 1000);
283 283
 
284 284
 		$start = 0; $filenum = 1;
285 285
 		$names = array();
286 286
 
287
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
287
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
288 288
 
289
-		$search = $productManager->createSearch( true );
290
-		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
291
-		$search->setSlice( 0, $maxQuery );
289
+		$search = $productManager->createSearch(true);
290
+		$search->setSortations(array($search->sort('+', 'product.id')));
291
+		$search->setSlice(0, $maxQuery);
292 292
 
293
-		$content = $this->createContent( $container, $filenum );
293
+		$content = $this->createContent($container, $filenum);
294 294
 		$names[] = $content->getResource();
295 295
 
296 296
 		do
297 297
 		{
298
-			$items = $productManager->searchItems( $search, $domains );
299
-			$this->addItems( $content, $items );
298
+			$items = $productManager->searchItems($search, $domains);
299
+			$this->addItems($content, $items);
300 300
 
301
-			$count = count( $items );
301
+			$count = count($items);
302 302
 			$start += $count;
303
-			$search->setSlice( $start, $maxQuery );
303
+			$search->setSlice($start, $maxQuery);
304 304
 
305
-			if( $start + $maxQuery > $maxItems * $filenum )
305
+			if ($start + $maxQuery > $maxItems * $filenum)
306 306
 			{
307
-				$this->closeContent( $content );
308
-				$content = $this->createContent( $container, ++$filenum );
307
+				$this->closeContent($content);
308
+				$content = $this->createContent($container, ++$filenum);
309 309
 				$names[] = $content->getResource();
310 310
 			}
311 311
 		}
312
-		while( $count >= $search->getSliceSize() );
312
+		while ($count >= $search->getSliceSize());
313 313
 
314
-		$this->closeContent( $content );
314
+		$this->closeContent($content);
315 315
 
316 316
 		return $names;
317 317
 	}
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 * @param mixed $default Default value if name is unknown
325 325
 	 * @return mixed Configuration value
326 326
 	 */
327
-	protected function getConfig( $name, $default = null )
327
+	protected function getConfig($name, $default = null)
328 328
 	{
329 329
 		$config = $this->getContext()->getConfig();
330 330
 
331
-		switch( $name )
331
+		switch ($name)
332 332
 		{
333 333
 			case 'domain':
334 334
 				/** controller/jobs/product/export/domains
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 				 * @see controller/jobs/product/export/max-items
351 351
 				 * @see controller/jobs/product/export/max-query
352 352
 				 */
353
-				return $config->get( 'controller/jobs/product/export/domains', $default );
353
+				return $config->get('controller/jobs/product/export/domains', $default);
354 354
 
355 355
 			case 'max-items':
356 356
 				/** controller/jobs/product/export/max-items
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				 * @see controller/jobs/product/export/max-query
373 373
 				 * @see controller/jobs/product/export/domains
374 374
 				 */
375
-				return $config->get( 'controller/jobs/product/export/max-items', $default );
375
+				return $config->get('controller/jobs/product/export/max-items', $default);
376 376
 
377 377
 			case 'max-query':
378 378
 				/** controller/jobs/product/export/max-query
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 				 * @see controller/jobs/product/export/max-items
395 395
 				 * @see controller/jobs/product/export/domains
396 396
 				 */
397
-				return $config->get( 'controller/jobs/product/export/max-query', $default );
397
+				return $config->get('controller/jobs/product/export/max-query', $default);
398 398
 		}
399 399
 
400 400
 		return $default;
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * @param integer $number Current file number
408 408
 	 * @return string New file name
409 409
 	 */
410
-	protected function getFilename( $number )
410
+	protected function getFilename($number)
411 411
 	{
412
-		return sprintf( 'aimeos-products-%d.xml', $number );
412
+		return sprintf('aimeos-products-%d.xml', $number);
413 413
 	}
414 414
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Bought/Factory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param string|null $name Name of the controller or "Standard" if null
31 31
 	 * @return \Aimeos\Controller\Jobs\Iface New controller object
32 32
 	 */
33
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
33
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
34 34
 	{
35 35
 		/** controller/jobs/product/bought/name
36 36
 		 * Class name of the used product suggestions scheduler controller implementation
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 		 * @since 2014.03
66 66
 		 * @category Developer
67 67
 		 */
68
-		if( $name === null ) {
69
-			$name = $context->getConfig()->get( 'controller/jobs/product/bought/name', 'Standard' );
68
+		if ($name === null) {
69
+			$name = $context->getConfig()->get('controller/jobs/product/bought/name', 'Standard');
70 70
 		}
71 71
 
72
-		if( ctype_alnum( $name ) === false )
72
+		if (ctype_alnum($name) === false)
73 73
 		{
74
-			$classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Product\\Bought\\' . $name : '<not a string>';
75
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			$classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Bought\\' . $name : '<not a string>';
75
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
76 76
 		}
77 77
 
78 78
 		$iface = '\\Aimeos\\Controller\\Jobs\\Iface';
79 79
 		$classname = '\\Aimeos\\Controller\\Jobs\\Product\\Bought\\' . $name;
80 80
 
81
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
81
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
82 82
 
83 83
 		/** controller/jobs/product/bought/decorators/excludes
84 84
 		 * Excludes decorators added by the "common" option from the product bought job controller
@@ -155,6 +155,6 @@  discard block
 block discarded – undo
155 155
 		 * @see controller/jobs/product/bought/decorators/excludes
156 156
 		 * @see controller/jobs/product/bought/decorators/global
157 157
 		 */
158
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'product/bought' );
158
+		return self::addControllerDecorators($context, $aimeos, $controller, 'product/bought');
159 159
 	}
160 160
 }
161 161
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Bought/Standard.php 1 patch
Spacing   +64 added lines, -64 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', 'Products bought together' );
32
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Products bought together');
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', 'Creates bought together product suggestions' );
43
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Creates bought together product suggestions');
44 44
 	}
45 45
 
46 46
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		 * @see controller/jobs/product/bought/min-confidence
73 73
 		 * @see controller/jobs/product/bought/limit-days
74 74
 		 */
75
-		$maxItems = $config->get( 'controller/jobs/product/bought/max-items', 5 );
75
+		$maxItems = $config->get('controller/jobs/product/bought/max-items', 5);
76 76
 
77 77
 		/** controller/jobs/product/bought/min-support
78 78
 		 * Minimum support value to sort out all irrelevant combinations
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * @see controller/jobs/product/bought/min-confidence
102 102
 		 * @see controller/jobs/product/bought/limit-days
103 103
 		 */
104
-		$minSupport = $config->get( 'controller/jobs/product/bought/min-support', 0.02 );
104
+		$minSupport = $config->get('controller/jobs/product/bought/min-support', 0.02);
105 105
 
106 106
 		/** controller/jobs/product/bought/min-confidence
107 107
 		 * Minimum confidence value for high quality suggestions
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		 * @see controller/jobs/product/bought/min-support
127 127
 		 * @see controller/jobs/product/bought/limit-days
128 128
 		 */
129
-		$minConfidence = $config->get( 'controller/jobs/product/bought/min-confidence', 0.66 );
129
+		$minConfidence = $config->get('controller/jobs/product/bought/min-confidence', 0.66);
130 130
 
131 131
 		/** controller/jobs/product/bought/limit-days
132 132
 		 * Only use orders placed in the past within the configured number of days for calculating bought together products
@@ -150,45 +150,45 @@  discard block
 block discarded – undo
150 150
 		 * @see controller/jobs/product/bought/min-support
151 151
 		 * @see controller/jobs/product/bought/min-confidence
152 152
 		 */
153
-		$days = $config->get( 'controller/jobs/product/bought/limit-days', 180 );
154
-		$date = date( 'Y-m-d H:i:s', time() - $days * 86400 );
153
+		$days = $config->get('controller/jobs/product/bought/limit-days', 180);
154
+		$date = date('Y-m-d H:i:s', time() - $days * 86400);
155 155
 
156 156
 
157
-		$typeItem = $this->getTypeItem( 'product/lists/type', 'product', 'bought-together' );
157
+		$typeItem = $this->getTypeItem('product/lists/type', 'product', 'bought-together');
158 158
 
159
-		$baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
159
+		$baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
160 160
 		$search = $baseManager->createSearch();
161
-		$search->setConditions( $search->compare( '>', 'order.base.ctime', $date ) );
162
-		$search->setSlice( 0, 0 );
161
+		$search->setConditions($search->compare('>', 'order.base.ctime', $date));
162
+		$search->setSlice(0, 0);
163 163
 		$totalOrders = 0;
164
-		$baseManager->searchItems( $search, array(), $totalOrders );
164
+		$baseManager->searchItems($search, array(), $totalOrders);
165 165
 
166
-		$baseProductManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' );
166
+		$baseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product');
167 167
 		$search = $baseProductManager->createSearch();
168
-		$search->setConditions( $search->compare( '>', 'order.base.product.ctime', $date ) );
168
+		$search->setConditions($search->compare('>', 'order.base.product.ctime', $date));
169 169
 		$start = 0;
170 170
 
171 171
 		do
172 172
 		{
173
-			$totalCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' );
174
-			$prodIds = array_keys( $totalCounts );
173
+			$totalCounts = $baseProductManager->aggregate($search, 'order.base.product.productid');
174
+			$prodIds = array_keys($totalCounts);
175 175
 
176
-			foreach( $totalCounts as $id => $count )
176
+			foreach ($totalCounts as $id => $count)
177 177
 			{
178
-				$this->removeListItems( $id, $typeItem->getId() );
178
+				$this->removeListItems($id, $typeItem->getId());
179 179
 
180
-				if( $count / $totalOrders > $minSupport )
180
+				if ($count / $totalOrders > $minSupport)
181 181
 				{
182
-					$productIds = $this->getSuggestions( $id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date );
183
-					$this->addListItems( $id, $typeItem->getId(), $productIds );
182
+					$productIds = $this->getSuggestions($id, $prodIds, $count, $totalOrders, $maxItems, $minSupport, $minConfidence, $date);
183
+					$this->addListItems($id, $typeItem->getId(), $productIds);
184 184
 				}
185 185
 			}
186 186
 
187
-			$count = count( $totalCounts );
187
+			$count = count($totalCounts);
188 188
 			$start += $count;
189
-			$search->setSlice( $start );
189
+			$search->setSlice($start);
190 190
 		}
191
-		while( $count >= $search->getSliceSize() );
191
+		while ($count >= $search->getSliceSize());
192 192
 	}
193 193
 
194 194
 
@@ -205,59 +205,59 @@  discard block
 block discarded – undo
205 205
 	 * @param string $date Date in YYYY-MM-DD HH:mm:ss format after which orders should be used for calculations
206 206
 	 * @return array List of suggested product IDs as key and their confidence as value
207 207
 	 */
208
-	protected function getSuggestions( $id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date )
208
+	protected function getSuggestions($id, $prodIds, $count, $total, $maxItems, $minSupport, $minConfidence, $date)
209 209
 	{
210 210
 		$refIds = array();
211 211
 		$context = $this->getContext();
212 212
 
213
-		$catalogListManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' );
214
-		$baseProductManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' );
213
+		$catalogListManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists');
214
+		$baseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product');
215 215
 
216 216
 
217 217
 		$search = $baseProductManager->createSearch();
218
-		$func = $search->createFunction( 'order.base.product.count', array( (string) $id ) );
218
+		$func = $search->createFunction('order.base.product.count', array((string) $id));
219 219
 		$expr = array(
220
-			$search->compare( '==', 'order.base.product.productid', $prodIds ),
221
-			$search->compare( '>', 'order.base.product.ctime', $date ),
222
-			$search->compare( '==', $func, 1 ),
220
+			$search->compare('==', 'order.base.product.productid', $prodIds),
221
+			$search->compare('>', 'order.base.product.ctime', $date),
222
+			$search->compare('==', $func, 1),
223 223
 		);
224
-		$search->setConditions( $search->combine( '&&', $expr ) );
224
+		$search->setConditions($search->combine('&&', $expr));
225 225
 
226
-		$relativeCounts = $baseProductManager->aggregate( $search, 'order.base.product.productid' );
226
+		$relativeCounts = $baseProductManager->aggregate($search, 'order.base.product.productid');
227 227
 
228 228
 
229 229
 		$search = $catalogListManager->createSearch();
230 230
 		$expr = array(
231
-			$search->compare( '==', 'catalog.lists.refid', array_keys( $relativeCounts ) ),
232
-			$search->compare( '==', 'catalog.lists.domain', 'product' ),
231
+			$search->compare('==', 'catalog.lists.refid', array_keys($relativeCounts)),
232
+			$search->compare('==', 'catalog.lists.domain', 'product'),
233 233
 		);
234
-		$search->setConditions( $search->combine( '&&', $expr ) );
234
+		$search->setConditions($search->combine('&&', $expr));
235 235
 
236
-		foreach( $catalogListManager->searchItems( $search ) as $listItem ) {
236
+		foreach ($catalogListManager->searchItems($search) as $listItem) {
237 237
 			$refIds[$listItem->getRefId()] = true;
238 238
 		}
239 239
 
240 240
 
241
-		unset( $relativeCounts[$id] );
241
+		unset($relativeCounts[$id]);
242 242
 		$supportA = $count / $total;
243 243
 		$products = array();
244 244
 
245
-		foreach( $relativeCounts as $prodId => $relCnt )
245
+		foreach ($relativeCounts as $prodId => $relCnt)
246 246
 		{
247
-			if( !isset( $refIds[$prodId] ) ) {
247
+			if (!isset($refIds[$prodId])) {
248 248
 				continue;
249 249
 			}
250 250
 
251 251
 			$supportAB = $relCnt / $total;
252 252
 
253
-			if( $supportAB > $minSupport && ( $conf = ( $supportAB / $supportA ) ) > $minConfidence ) {
253
+			if ($supportAB > $minSupport && ($conf = ($supportAB / $supportA)) > $minConfidence) {
254 254
 				$products[$prodId] = $conf;
255 255
 			}
256 256
 		}
257 257
 
258
-		arsort( $products );
258
+		arsort($products);
259 259
 
260
-		return array_keys( array_slice( $products, 0, $maxItems, true ) );
260
+		return array_keys(array_slice($products, 0, $maxItems, true));
261 261
 	}
262 262
 
263 263
 
@@ -268,26 +268,26 @@  discard block
 block discarded – undo
268 268
 	 * @param integer $typeId Unique ID of the list type used for the referenced products
269 269
 	 * @param array $productIds List of position as key and product ID as value
270 270
 	 */
271
-	protected function addListItems( $productId, $typeId, array $productIds )
271
+	protected function addListItems($productId, $typeId, array $productIds)
272 272
 	{
273
-		if( empty( $productIds ) ) {
273
+		if (empty($productIds)) {
274 274
 			return;
275 275
 		}
276 276
 
277
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
277
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
278 278
 		$item = $manager->createItem();
279 279
 
280
-		foreach( $productIds as $pos => $refid )
280
+		foreach ($productIds as $pos => $refid)
281 281
 		{
282
-			$item->setId( null );
283
-			$item->setParentId( $productId );
284
-			$item->setDomain( 'product' );
285
-			$item->setTypeId( $typeId );
286
-			$item->setPosition( $pos );
287
-			$item->setRefId( $refid );
288
-			$item->setStatus( 1 );
289
-
290
-			$manager->saveItem( $item );
282
+			$item->setId(null);
283
+			$item->setParentId($productId);
284
+			$item->setDomain('product');
285
+			$item->setTypeId($typeId);
286
+			$item->setPosition($pos);
287
+			$item->setRefId($refid);
288
+			$item->setStatus(1);
289
+
290
+			$manager->saveItem($item);
291 291
 		}
292 292
 	}
293 293
 
@@ -298,20 +298,20 @@  discard block
 block discarded – undo
298 298
 	 * @param string $productId Unique ID of the product the references should be removed from
299 299
 	 * @param integer $typeId Unique ID of the list type the referenced products should be removed from
300 300
 	 */
301
-	protected function removeListItems( $productId, $typeId )
301
+	protected function removeListItems($productId, $typeId)
302 302
 	{
303
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
303
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
304 304
 
305 305
 		$search = $manager->createSearch();
306 306
 		$expr = array(
307
-			$search->compare( '==', 'product.lists.parentid', $productId ),
308
-			$search->compare( '==', 'product.lists.domain', 'product' ),
309
-			$search->compare( '==', 'product.lists.typeid', $typeId ),
307
+			$search->compare('==', 'product.lists.parentid', $productId),
308
+			$search->compare('==', 'product.lists.domain', 'product'),
309
+			$search->compare('==', 'product.lists.typeid', $typeId),
310 310
 		);
311
-		$search->setConditions( $search->combine( '&&', $expr ) );
311
+		$search->setConditions($search->combine('&&', $expr));
312 312
 
313
-		$listItems = $manager->searchItems( $search );
313
+		$listItems = $manager->searchItems($search);
314 314
 
315
-		$manager->deleteItems( array_keys( $listItems ) );
315
+		$manager->deleteItems(array_keys($listItems));
316 316
 	}
317 317
 }
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Import/Csv/Factory.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param string|null $name Name of the controller or "Standard" if null
30 30
 	 * @return \Aimeos\Controller\Jobs\Iface New controller object
31 31
 	 */
32
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null )
32
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null)
33 33
 	{
34 34
 		/** controller/jobs/product/import/csv/name
35 35
 		 * Class name of the used product suggestions scheduler controller implementation
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		 * @since 2015.01
65 65
 		 * @category Developer
66 66
 		 */
67
-		if ( $name === null ) {
67
+		if ($name === null) {
68 68
 			$name = $context->getConfig()->get('controller/jobs/product/import/csv/name', 'Standard');
69 69
 		}
70 70
 
71
-		if ( ctype_alnum($name) === false )
71
+		if (ctype_alnum($name) === false)
72 72
 		{
73 73
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name : '<not a string>';
74
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
75 75
 		}
76 76
 
77 77
 		$iface = '\\Aimeos\\Controller\\Jobs\\Iface';
78 78
 		$classname = '\\Aimeos\\Controller\\Jobs\\Product\\Import\\Csv\\' . $name;
79 79
 
80
-		$controller = self::createControllerBase( $context, $aimeos, $classname, $iface );
80
+		$controller = self::createControllerBase($context, $aimeos, $classname, $iface);
81 81
 
82 82
 		/** controller/jobs/product/import/csv/decorators/excludes
83 83
 		 * Excludes decorators added by the "common" option from the product import CSV job controller
@@ -154,6 +154,6 @@  discard block
 block discarded – undo
154 154
 		 * @see controller/jobs/product/import/csv/decorators/excludes
155 155
 		 * @see controller/jobs/product/import/csv/decorators/global
156 156
 		 */
157
-		return self::addControllerDecorators( $context, $aimeos, $controller, 'product/import/csv' );
157
+		return self::addControllerDecorators($context, $aimeos, $controller, 'product/import/csv');
158 158
 	}
159 159
 }
160 160
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Product/Import/Csv/Standard.php 2 patches
Spacing   +68 added lines, -68 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 import CSV' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Product import 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', 'Imports new and updates existing products from CSV files' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing products from CSV files');
43 43
 	}
44 44
 
45 45
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$context = $this->getContext();
55 55
 		$config = $context->getConfig();
56 56
 		$logger = $context->getLogger();
57
-		$domains = array( 'attribute', 'media', 'price', 'product', 'text' );
57
+		$domains = array('attribute', 'media', 'price', 'product', 'text');
58 58
 		$mappings = $this->getDefaultMapping();
59 59
 
60 60
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		 * @see controller/common/product/import/csv/converter
75 75
 		 * @see controller/common/product/import/csv/max-size
76 76
 		 */
77
-		$domains = $config->get( 'controller/common/product/import/csv/domains', $domains );
77
+		$domains = $config->get('controller/common/product/import/csv/domains', $domains);
78 78
 
79 79
 		/** controller/jobs/product/import/csv/domains
80 80
 		 * List of item domain names that should be retrieved along with the product items
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 * @see controller/jobs/product/import/csv/backup
95 95
 		 * @see controller/common/product/import/csv/max-size
96 96
 		 */
97
-		$domains = $config->get( 'controller/jobs/product/import/csv/domains', $domains );
97
+		$domains = $config->get('controller/jobs/product/import/csv/domains', $domains);
98 98
 
99 99
 
100 100
 		/** controller/common/product/import/csv/mapping
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		 * @see controller/common/product/import/csv/converter
123 123
 		 * @see controller/common/product/import/csv/max-size
124 124
 		 */
125
-		$mappings = $config->get( 'controller/common/product/import/csv/mapping', $mappings );
125
+		$mappings = $config->get('controller/common/product/import/csv/mapping', $mappings);
126 126
 
127 127
 		/** controller/jobs/product/import/csv/mapping
128 128
 		 * List of mappings between the position in the CSV file and item keys
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		 * @see controller/jobs/product/import/csv/backup
143 143
 		 * @see controller/common/product/import/csv/max-size
144 144
 		 */
145
-		$mappings = $config->get( 'controller/jobs/product/import/csv/mapping', $mappings );
145
+		$mappings = $config->get('controller/jobs/product/import/csv/mapping', $mappings);
146 146
 
147 147
 
148 148
 		/** controller/common/product/import/csv/converter
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		 * @see controller/common/product/import/csv/mapping
185 185
 		 * @see controller/common/product/import/csv/max-size
186 186
 		 */
187
-		$converters = $config->get( 'controller/common/product/import/csv/converter', array() );
187
+		$converters = $config->get('controller/common/product/import/csv/converter', array());
188 188
 
189 189
 		/** controller/jobs/product/import/csv/converter
190 190
 		 * List of converter names for the values at the position in the CSV file
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		 * @see controller/jobs/product/import/csv/backup
205 205
 		 * @see controller/common/product/import/csv/max-size
206 206
 		 */
207
-		$converters = $config->get( 'controller/jobs/product/import/csv/converter', $converters );
207
+		$converters = $config->get('controller/jobs/product/import/csv/converter', $converters);
208 208
 
209 209
 
210 210
 		/** controller/common/product/import/csv/max-size
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		 * @see controller/common/product/import/csv/mapping
225 225
 		 * @see controller/common/product/import/csv/converter
226 226
 		 */
227
-		$maxcnt = (int) $config->get( 'controller/common/product/import/csv/max-size', 1000 );
227
+		$maxcnt = (int) $config->get('controller/common/product/import/csv/max-size', 1000);
228 228
 
229 229
 
230 230
 		/** controller/jobs/product/import/csv/skip-lines
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		 * @see controller/jobs/product/import/csv/backup
247 247
 		 * @see controller/common/product/import/csv/max-size
248 248
 		 */
249
-		$skiplines = (int) $config->get( 'controller/jobs/product/import/csv/skip-lines', 0 );
249
+		$skiplines = (int) $config->get('controller/jobs/product/import/csv/skip-lines', 0);
250 250
 
251 251
 
252 252
 		/** controller/jobs/product/import/csv/strict
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		 * @see controller/jobs/product/import/csv/backup
271 271
 		 * @see controller/common/product/import/csv/max-size
272 272
 		 */
273
-		$strict = (bool) $config->get( 'controller/jobs/product/import/csv/strict', true );
273
+		$strict = (bool) $config->get('controller/jobs/product/import/csv/strict', true);
274 274
 
275 275
 
276 276
 		/** controller/jobs/product/import/csv/backup
@@ -303,74 +303,74 @@  discard block
 block discarded – undo
303 303
 		 * @see controller/jobs/product/import/csv/strict
304 304
 		 * @see controller/common/product/import/csv/max-size
305 305
 		 */
306
-		$backup = $config->get( 'controller/jobs/product/import/csv/backup' );
306
+		$backup = $config->get('controller/jobs/product/import/csv/backup');
307 307
 
308 308
 
309
-		if( !isset( $mappings['item'] ) || !is_array( $mappings['item'] ) )
309
+		if (!isset($mappings['item']) || !is_array($mappings['item']))
310 310
 		{
311
-			$msg = sprintf( 'Required mapping key "%1$s" is missing or contains no array', 'item' );
312
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
311
+			$msg = sprintf('Required mapping key "%1$s" is missing or contains no array', 'item');
312
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
313 313
 		}
314 314
 
315 315
 		try
316 316
 		{
317 317
 			$procMappings = $mappings;
318
-			unset( $procMappings['item'] );
318
+			unset($procMappings['item']);
319 319
 
320
-			$codePos = $this->getCodePosition( $mappings['item'] );
321
-			$convlist = $this->getConverterList( $converters );
322
-			$processor = $this->getProcessors( $procMappings );
320
+			$codePos = $this->getCodePosition($mappings['item']);
321
+			$convlist = $this->getConverterList($converters);
322
+			$processor = $this->getProcessors($procMappings);
323 323
 			$container = $this->getContainer();
324 324
 			$path = $container->getName();
325 325
 
326
-			$msg = sprintf( 'Started product import from "%1$s" (%2$s)', $path, __CLASS__ );
327
-			$logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE );
326
+			$msg = sprintf('Started product import from "%1$s" (%2$s)', $path, __CLASS__);
327
+			$logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE);
328 328
 
329
-			foreach( $container as $content )
329
+			foreach ($container as $content)
330 330
 			{
331 331
 				$name = $content->getName();
332 332
 
333
-				for( $i = 0; $i < $skiplines; $i++ ) {
333
+				for ($i = 0; $i < $skiplines; $i++) {
334 334
 					$content->next();
335 335
 				}
336 336
 
337
-				while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== array() )
337
+				while (($data = $this->getData($content, $maxcnt, $codePos)) !== array())
338 338
 				{
339
-					$data = $this->convertData( $convlist, $data );
340
-					$products = $this->getProducts( array_keys( $data ), $domains );
341
-					$errcnt = $this->import( $products, $data, $mappings['item'], $processor, $strict );
342
-					$chunkcnt = count( $data );
339
+					$data = $this->convertData($convlist, $data);
340
+					$products = $this->getProducts(array_keys($data), $domains);
341
+					$errcnt = $this->import($products, $data, $mappings['item'], $processor, $strict);
342
+					$chunkcnt = count($data);
343 343
 
344 344
 					$msg = 'Imported product lines from "%1$s": %2$d/%3$d (%4$s)';
345
-					$logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
345
+					$logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
346 346
 
347 347
 					$errors += $errcnt;
348 348
 					$total += $chunkcnt;
349
-					unset( $products, $data );
349
+					unset($products, $data);
350 350
 				}
351 351
 			}
352 352
 
353 353
 			$container->close();
354 354
 		}
355
-		catch( \Exception $e )
355
+		catch (\Exception $e)
356 356
 		{
357
-			$logger->log( 'Product import error: ' . $e->getMessage() );
358
-			$logger->log( $e->getTraceAsString() );
357
+			$logger->log('Product import error: ' . $e->getMessage());
358
+			$logger->log($e->getTraceAsString());
359 359
 
360
-			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
360
+			throw new \Aimeos\Controller\Jobs\Exception($e->getMessage());
361 361
 		}
362 362
 
363 363
 		$msg = 'Finished product import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)';
364
-		$logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
364
+		$logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
365 365
 
366
-		if( $errors > 0 )
366
+		if ($errors > 0)
367 367
 		{
368
-			$msg = sprintf( 'Invalid product lines in "%1$s": %2$d/%3$d', $path, $errors, $total );
369
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
368
+			$msg = sprintf('Invalid product lines in "%1$s": %2$d/%3$d', $path, $errors, $total);
369
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
370 370
 		}
371 371
 
372
-		if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) {
373
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) );
372
+		if (!empty($backup) && @rename($path, strftime($backup)) === false) {
373
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file'));
374 374
 		}
375 375
 	}
376 376
 
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
 	 * @return integer Position of the "product.code" column
383 383
 	 * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "product.code" is found
384 384
 	 */
385
-	protected function getCodePosition( array $mapping )
385
+	protected function getCodePosition(array $mapping)
386 386
 	{
387
-		foreach( $mapping as $pos => $key )
387
+		foreach ($mapping as $pos => $key)
388 388
 		{
389
-			if( $key === 'product.code' ) {
389
+			if ($key === 'product.code') {
390 390
 				return $pos;
391 391
 			}
392 392
 		}
393 393
 
394
-		throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "product.code" column in CSV mapping found' ) );
394
+		throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "product.code" column in CSV mapping found'));
395 395
 	}
396 396
 
397 397
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 		 * @see controller/jobs/product/import/csv/container/content
427 427
 		 * @see controller/jobs/product/import/csv/container/options
428 428
 		*/
429
-		$location = $config->get( 'controller/jobs/product/import/csv/location', '.' );
429
+		$location = $config->get('controller/jobs/product/import/csv/location', '.');
430 430
 
431 431
 		/** controller/jobs/product/import/csv/container/type
432 432
 		 * Nave of the container type to read the data from
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		 * @see controller/jobs/product/import/csv/container/content
450 450
 		 * @see controller/jobs/product/import/csv/container/options
451 451
 		*/
452
-		$container = $config->get( 'controller/jobs/product/import/csv/container/type', 'Directory' );
452
+		$container = $config->get('controller/jobs/product/import/csv/container/type', 'Directory');
453 453
 
454 454
 		/** controller/jobs/product/import/csv/container/content
455 455
 		 * Name of the content type inside the container to read the data from
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 		 * @see controller/jobs/product/import/csv/container/type
471 471
 		 * @see controller/jobs/product/import/csv/container/options
472 472
 		*/
473
-		$content = $config->get( 'controller/jobs/product/import/csv/container/content', 'CSV' );
473
+		$content = $config->get('controller/jobs/product/import/csv/container/content', 'CSV');
474 474
 
475 475
 		/** controller/jobs/product/import/csv/container/options
476 476
 		 * List of file container options for the product import files
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		 * @see controller/jobs/product/import/csv/container/content
489 489
 		 * @see controller/jobs/product/import/csv/container/type
490 490
 		*/
491
-		$options = $config->get( 'controller/jobs/product/import/csv/container/options', array() );
491
+		$options = $config->get('controller/jobs/product/import/csv/container/options', array());
492 492
 
493
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
493
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
494 494
 	}
495 495
 
496 496
 
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 	 * @return integer Number of products that couldn't be imported
506 506
 	 * @throws \Aimeos\Controller\Jobs\Exception
507 507
 	 */
508
-	protected function import( array $products, array $data, array $mapping,
509
-		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor, $strict )
508
+	protected function import(array $products, array $data, array $mapping,
509
+		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor, $strict)
510 510
 	{
511 511
 		$errors = 0;
512 512
 		$context = $this->getContext();
513
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'product' );
513
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'product');
514 514
 
515
-		foreach( $data as $code => $list )
515
+		foreach ($data as $code => $list)
516 516
 		{
517 517
 			$remaining = array();
518 518
 
@@ -520,36 +520,36 @@  discard block
 block discarded – undo
520 520
 
521 521
 			try
522 522
 			{
523
-				if( isset( $products[$code] ) ) {
523
+				if (isset($products[$code])) {
524 524
 					$product = $products[$code];
525 525
 				} else {
526 526
 					$product = $manager->createItem();
527 527
 				}
528 528
 
529
-				$map = $this->getMappedData( $mapping, $list );
529
+				$map = $this->getMappedData($mapping, $list);
530 530
 
531
-				$typecode = ( isset( $map['product.type'] ) ? $map['product.type'] : 'default' );
532
-				$map['product.typeid'] = $this->getTypeId( 'product/type', 'product', $typecode );
531
+				$typecode = (isset($map['product.type']) ? $map['product.type'] : 'default');
532
+				$map['product.typeid'] = $this->getTypeId('product/type', 'product', $typecode);
533 533
 
534
-				$product->fromArray( $this->addItemDefaults( $map ) );
535
-				$manager->saveItem( $product );
534
+				$product->fromArray($this->addItemDefaults($map));
535
+				$manager->saveItem($product);
536 536
 
537
-				$remaining = $processor->process( $product, $list );
537
+				$remaining = $processor->process($product, $list);
538 538
 
539 539
 				$manager->commit();
540 540
 			}
541
-			catch( \Exception $e )
541
+			catch (\Exception $e)
542 542
 			{
543 543
 				$manager->rollback();
544 544
 
545
-				$msg = sprintf( 'Unable to import product with code "%1$s": %2$s', $code, $e->getMessage() );
546
-				$context->getLogger()->log( $msg );
545
+				$msg = sprintf('Unable to import product with code "%1$s": %2$s', $code, $e->getMessage());
546
+				$context->getLogger()->log($msg);
547 547
 
548 548
 				$errors++;
549 549
 			}
550 550
 
551
-			if( $strict && !empty( $remaining ) ) {
552
-				$context->getLogger()->log( 'Not imported: ' . print_r( $remaining, true ) );
551
+			if ($strict && !empty($remaining)) {
552
+				$context->getLogger()->log('Not imported: ' . print_r($remaining, true));
553 553
 			}
554 554
 		}
555 555
 
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
 	 * @param array $list Associative list of domain item keys and their values, e.g. "product.status" => 1
564 564
 	 * @return array Given associative list enriched by default values if they were not already set
565 565
 	 */
566
-	protected function addItemDefaults( array $list )
566
+	protected function addItemDefaults(array $list)
567 567
 	{
568
-		if( !isset( $list['product.status'] ) ) {
568
+		if (!isset($list['product.status'])) {
569 569
 			$list['product.status'] = 1;
570 570
 		}
571 571
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -351,8 +351,7 @@  discard block
 block discarded – undo
351 351
 			}
352 352
 
353 353
 			$container->close();
354
-		}
355
-		catch( \Exception $e )
354
+		} catch( \Exception $e )
356 355
 		{
357 356
 			$logger->log( 'Product import error: ' . $e->getMessage() );
358 357
 			$logger->log( $e->getTraceAsString() );
@@ -537,8 +536,7 @@  discard block
 block discarded – undo
537 536
 				$remaining = $processor->process( $product, $list );
538 537
 
539 538
 				$manager->commit();
540
-			}
541
-			catch( \Exception $e )
539
+			} catch( \Exception $e )
542 540
 			{
543 541
 				$manager->rollback();
544 542
 
Please login to merge, or discard this patch.
controller/jobs/tests/bootstrap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,22 +11,22 @@
 block discarded – undo
11 11
  * Set error reporting to maximum
12 12
  */
13 13
 error_reporting( -1 );
14
-ini_set( 'display_errors', '1' );
14
+ini_set('display_errors', '1');
15 15
 
16
-date_default_timezone_set( 'UTC' );
16
+date_default_timezone_set('UTC');
17 17
 
18 18
 /**
19 19
  * Set locale settings to reasonable defaults
20 20
  */
21
-setlocale( LC_ALL, 'en_US.UTF-8' );
22
-setlocale( LC_NUMERIC, 'POSIX' );
23
-setlocale( LC_CTYPE, 'en_US.UTF-8' );
24
-setlocale( LC_TIME, 'POSIX' );
21
+setlocale(LC_ALL, 'en_US.UTF-8');
22
+setlocale(LC_NUMERIC, 'POSIX');
23
+setlocale(LC_CTYPE, 'en_US.UTF-8');
24
+setlocale(LC_TIME, 'POSIX');
25 25
 
26 26
 /*
27 27
  * Set include path for tests
28 28
  */
29
-define( 'PATH_TESTS', __DIR__ );
29
+define('PATH_TESTS', __DIR__);
30 30
 
31 31
 require_once 'TestHelperJobs.php';
32 32
 \TestHelperJobs::bootstrap();
Please login to merge, or discard this patch.
controller/jobs/tests/Perf/Product/Import/Csv/StandardTest.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@  discard block
 block discarded – undo
17 17
 		$this->context = \TestHelperJobs::getContext('unitperf');
18 18
 
19 19
 		$config = $this->context->getConfig();
20
-		$config->set( 'controller/jobs/product/import/csv/location', 'tmp/product-import.zip' );
21
-		$config->set( 'controller/jobs/product/import/csv/container/type', 'Zip' );
22
-		$config->set( 'controller/jobs/product/import/csv/container/content', 'CSV' );
23
-		$config->set( 'controller/jobs/product/import/csv/mapping', $this->getMapping() );
20
+		$config->set('controller/jobs/product/import/csv/location', 'tmp/product-import.zip');
21
+		$config->set('controller/jobs/product/import/csv/container/type', 'Zip');
22
+		$config->set('controller/jobs/product/import/csv/container/content', 'CSV');
23
+		$config->set('controller/jobs/product/import/csv/mapping', $this->getMapping());
24 24
 
25
-		$container = \Aimeos\MW\Container\Factory::getContainer( 'tmp/product-import.zip', 'Zip', 'CSV', array() );
25
+		$container = \Aimeos\MW\Container\Factory::getContainer('tmp/product-import.zip', 'Zip', 'CSV', array());
26 26
 
27
-		$content = $container->create( 'product.csv' );
27
+		$content = $container->create('product.csv');
28 28
 
29
-		for( $i = 0; $i < 1000; $i++ )
29
+		for ($i = 0; $i < 1000; $i++)
30 30
 		{
31 31
 			$data = array();
32 32
 
33
-			$data = $this->addProduct( $data, $i );
34
-			$data = $this->addText( $data, $i );
35
-			$data = $this->addMedia( $data, $i );
36
-			$data = $this->addPrice( $data, $i );
37
-			$data = $this->addAttribute( $data, $i );
38
-			$data = $this->addProductRef( $data, $i );
39
-			$data = $this->addProperty( $data, $i );
33
+			$data = $this->addProduct($data, $i);
34
+			$data = $this->addText($data, $i);
35
+			$data = $this->addMedia($data, $i);
36
+			$data = $this->addPrice($data, $i);
37
+			$data = $this->addAttribute($data, $i);
38
+			$data = $this->addProductRef($data, $i);
39
+			$data = $this->addProperty($data, $i);
40 40
 
41
-			$content->add( $data );
41
+			$content->add($data);
42 42
 		}
43 43
 
44
-		$container->add( $content );
44
+		$container->add($content);
45 45
 
46 46
 		$container->close();
47 47
 	}
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 		$this->cleanupPrice();
56 56
 		$this->cleanupProduct();
57 57
 
58
-		unlink( 'tmp/product-import.zip' );
58
+		unlink('tmp/product-import.zip');
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testImport()
63 63
 	{
64 64
 		$aimeos = \TestHelperJobs::getAimeos();
65
-		$cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController( $this->context, $aimeos, 'Standard' );
65
+		$cntl = \Aimeos\Controller\Jobs\Product\Import\Csv\Factory::createController($this->context, $aimeos, 'Standard');
66 66
 
67
-		$start = microtime( true );
67
+		$start = microtime(true);
68 68
 
69 69
 		$cntl->run();
70 70
 
71
-		$stop = microtime( true );
72
-		echo "\n    product import CSV: " . ( ( $stop - $start ) ) . " sec\n";
71
+		$stop = microtime(true);
72
+		echo "\n    product import CSV: " . (($stop - $start)) . " sec\n";
73 73
 	}
74 74
 
75 75
 
76
-	protected function addAttribute( array $data, $cnt )
76
+	protected function addAttribute(array $data, $cnt)
77 77
 	{
78 78
 		$data[] = 'length'; // type
79 79
 		$data[] = 'import-' . ($cnt % 30); // code
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 
89
-	protected function addMedia( array $data, $cnt )
89
+	protected function addMedia(array $data, $cnt)
90 90
 	{
91 91
 		$data[] = "/path/to/image-$cnt.jpg"; // url
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 
96 96
 
97
-	protected function addPrice( array $data, $cnt )
97
+	protected function addPrice(array $data, $cnt)
98 98
 	{
99 99
 		$data[] = 1; // quantity
100 100
 		$data[] = 'import-' . $cnt; // label
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	}
106 106
 
107 107
 
108
-	protected function addProduct( array $data, $cnt )
108
+	protected function addProduct(array $data, $cnt)
109 109
 	{
110 110
 		$data[] = 'import-' . $cnt; // code
111 111
 		$data[] = 'import-' . $cnt; // label
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	}
117 117
 
118 118
 
119
-	protected function addProductRef( array $data, $cnt )
119
+	protected function addProductRef(array $data, $cnt)
120 120
 	{
121 121
 		$data[] = 'import-' . ($cnt % 100); // code
122 122
 		$data[] = 'suggestion'; // type
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	}
126 126
 
127 127
 
128
-	protected function addProperty( array $data, $cnt )
128
+	protected function addProperty(array $data, $cnt)
129 129
 	{
130 130
 		$data[] = 'package-weight'; // type
131 131
 		$data[] = '0.5'; // value
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 
137
-	protected function addText( array $data, $cnt )
137
+	protected function addText(array $data, $cnt)
138 138
 	{
139 139
 		$data[] = 'name'; // type
140 140
 		$data[] = 'import-name-' . $cnt; //content
@@ -149,132 +149,132 @@  discard block
 block discarded – undo
149 149
 
150 150
 	protected function cleanupAttribute()
151 151
 	{
152
-		$manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager( $this->context );
152
+		$manager = \Aimeos\MShop\Attribute\Manager\Factory::createManager($this->context);
153 153
 
154 154
 		$search = $manager->createSearch();
155 155
 		$expr = array(
156
-			$search->compare( '==', 'attribute.domain', 'product' ),
157
-			$search->compare( '==', 'attribute.label', 'import-%' ),
156
+			$search->compare('==', 'attribute.domain', 'product'),
157
+			$search->compare('==', 'attribute.label', 'import-%'),
158 158
 		);
159
-		$search->setConditions( $search->combine( '&&', $expr ) );
160
-		$search->setSortations( array( $search->sort( '+', 'attribute.id' ) ) );
159
+		$search->setConditions($search->combine('&&', $expr));
160
+		$search->setSortations(array($search->sort('+', 'attribute.id')));
161 161
 
162 162
 		$start = 0;
163 163
 
164 164
 		do
165 165
 		{
166
-			$result = $manager->searchItems( $search );
167
-			$manager->deleteItems( array_keys( $result ) );
166
+			$result = $manager->searchItems($search);
167
+			$manager->deleteItems(array_keys($result));
168 168
 
169
-			$count = count( $result );
169
+			$count = count($result);
170 170
 			$start += $count;
171
-			$search->setSlice( $start );
171
+			$search->setSlice($start);
172 172
 		}
173
-		while( $count == $search->getSliceSize() );
173
+		while ($count == $search->getSliceSize());
174 174
 	}
175 175
 
176 176
 
177 177
 	protected function cleanupMedia()
178 178
 	{
179
-		$manager = \Aimeos\MShop\Media\Manager\Factory::createManager( $this->context );
179
+		$manager = \Aimeos\MShop\Media\Manager\Factory::createManager($this->context);
180 180
 
181 181
 		$search = $manager->createSearch();
182 182
 		$expr = array(
183
-			$search->compare( '==', 'media.domain', 'product' ),
184
-			$search->compare( '==', 'media.label', 'import-%' ),
183
+			$search->compare('==', 'media.domain', 'product'),
184
+			$search->compare('==', 'media.label', 'import-%'),
185 185
 		);
186
-		$search->setConditions( $search->combine( '&&', $expr ) );
187
-		$search->setSortations( array( $search->sort( '+', 'media.id' ) ) );
186
+		$search->setConditions($search->combine('&&', $expr));
187
+		$search->setSortations(array($search->sort('+', 'media.id')));
188 188
 
189 189
 		$start = 0;
190 190
 
191 191
 		do
192 192
 		{
193
-			$result = $manager->searchItems( $search );
194
-			$manager->deleteItems( array_keys( $result ) );
193
+			$result = $manager->searchItems($search);
194
+			$manager->deleteItems(array_keys($result));
195 195
 
196
-			$count = count( $result );
196
+			$count = count($result);
197 197
 			$start += $count;
198
-			$search->setSlice( $start );
198
+			$search->setSlice($start);
199 199
 		}
200
-		while( $count == $search->getSliceSize() );
200
+		while ($count == $search->getSliceSize());
201 201
 	}
202 202
 
203 203
 
204 204
 	protected function cleanupPrice()
205 205
 	{
206
-		$manager = \Aimeos\MShop\Price\Manager\Factory::createManager( $this->context );
206
+		$manager = \Aimeos\MShop\Price\Manager\Factory::createManager($this->context);
207 207
 
208 208
 		$search = $manager->createSearch();
209 209
 		$expr = array(
210
-				$search->compare( '==', 'price.domain', 'product' ),
211
-				$search->compare( '==', 'price.label', 'import-%' ),
210
+				$search->compare('==', 'price.domain', 'product'),
211
+				$search->compare('==', 'price.label', 'import-%'),
212 212
 		);
213
-		$search->setConditions( $search->combine( '&&', $expr ) );
214
-		$search->setSortations( array( $search->sort( '+', 'price.id' ) ) );
213
+		$search->setConditions($search->combine('&&', $expr));
214
+		$search->setSortations(array($search->sort('+', 'price.id')));
215 215
 
216 216
 		$start = 0;
217 217
 
218 218
 		do
219 219
 		{
220
-			$result = $manager->searchItems( $search );
221
-			$manager->deleteItems( array_keys( $result ) );
220
+			$result = $manager->searchItems($search);
221
+			$manager->deleteItems(array_keys($result));
222 222
 
223
-			$count = count( $result );
223
+			$count = count($result);
224 224
 			$start += $count;
225
-			$search->setSlice( $start );
225
+			$search->setSlice($start);
226 226
 		}
227
-		while( $count == $search->getSliceSize() );
227
+		while ($count == $search->getSliceSize());
228 228
 	}
229 229
 
230 230
 
231 231
 	protected function cleanupProduct()
232 232
 	{
233
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
233
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
234 234
 
235 235
 		$search = $manager->createSearch();
236
-		$search->setConditions( $search->compare( '==', 'product.code', 'import-%' ) );
237
-		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
236
+		$search->setConditions($search->compare('==', 'product.code', 'import-%'));
237
+		$search->setSortations(array($search->sort('+', 'product.id')));
238 238
 
239 239
 		$start = 0;
240 240
 
241 241
 		do
242 242
 		{
243
-			$result = $manager->searchItems( $search );
244
-			$manager->deleteItems( array_keys( $result ) );
243
+			$result = $manager->searchItems($search);
244
+			$manager->deleteItems(array_keys($result));
245 245
 
246
-			$count = count( $result );
246
+			$count = count($result);
247 247
 			$start += $count;
248
-			$search->setSlice( $start );
248
+			$search->setSlice($start);
249 249
 		}
250
-		while( $count == $search->getSliceSize() );
250
+		while ($count == $search->getSliceSize());
251 251
 	}
252 252
 
253 253
 
254 254
 	protected function cleanupText()
255 255
 	{
256
-		$manager = \Aimeos\MShop\Text\Manager\Factory::createManager( $this->context );
256
+		$manager = \Aimeos\MShop\Text\Manager\Factory::createManager($this->context);
257 257
 
258 258
 		$search = $manager->createSearch();
259 259
 		$expr = array(
260
-			$search->compare( '==', 'text.domain', 'product' ),
261
-			$search->compare( '==', 'text.label', 'import-%' ),
260
+			$search->compare('==', 'text.domain', 'product'),
261
+			$search->compare('==', 'text.label', 'import-%'),
262 262
 		);
263
-		$search->setConditions( $search->combine( '&&', $expr ) );
264
-		$search->setSortations( array( $search->sort( '+', 'text.id' ) ) );
263
+		$search->setConditions($search->combine('&&', $expr));
264
+		$search->setSortations(array($search->sort('+', 'text.id')));
265 265
 
266 266
 		$start = 0;
267 267
 
268 268
 		do
269 269
 		{
270
-			$result = $manager->searchItems( $search );
271
-			$manager->deleteItems( array_keys( $result ) );
270
+			$result = $manager->searchItems($search);
271
+			$manager->deleteItems(array_keys($result));
272 272
 
273
-			$count = count( $result );
273
+			$count = count($result);
274 274
 			$start += $count;
275
-			$search->setSlice( $start );
275
+			$search->setSlice($start);
276 276
 		}
277
-		while( $count == $search->getSliceSize() );
277
+		while ($count == $search->getSliceSize());
278 278
 	}
279 279
 
280 280
 
Please login to merge, or discard this patch.