Completed
Push — master ( 6a7433...48eba7 )
by Aimeos
02:24
created
jobs/tests/Controller/Jobs/Product/Export/Sitemap/StandardTest.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Sitemap\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 
35 35
 		$this->object = null;
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
 	public function testGetName()
40 40
 	{
41
-		$this->assertEquals( 'Product site map', $this->object->getName() );
41
+		$this->assertEquals('Product site map', $this->object->getName());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetDescription()
46 46
 	{
47 47
 		$text = 'Creates a product site map for search engines';
48
-		$this->assertEquals( $text, $this->object->getDescription() );
48
+		$this->assertEquals($text, $this->object->getDescription());
49 49
 	}
50 50
 
51 51
 
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
 		$this->object->run();
55 55
 
56 56
 		$ds = DIRECTORY_SEPARATOR;
57
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
58
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
59
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
57
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
58
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
59
+		$this->assertFileExists('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
60 60
 
61
-		$file1 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb' ), 0x1000 );
62
-		$file2 = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb' ), 0x1000 );
63
-		$index = gzread( gzopen( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb' ), 0x1000 );
61
+		$file1 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-1.xml.gz', 'rb'), 0x1000);
62
+		$file2 = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-2.xml.gz', 'rb'), 0x1000);
63
+		$index = gzread(gzopen('tmp' . $ds . 'aimeos-sitemap-index.xml.gz', 'rb'), 0x1000);
64 64
 
65
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-1.xml.gz' );
66
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-2.xml.gz' );
67
-		unlink( 'tmp' . $ds . 'aimeos-sitemap-index.xml.gz' );
65
+		unlink('tmp' . $ds . 'aimeos-sitemap-1.xml.gz');
66
+		unlink('tmp' . $ds . 'aimeos-sitemap-2.xml.gz');
67
+		unlink('tmp' . $ds . 'aimeos-sitemap-index.xml.gz');
68 68
 
69
-		$this->assertContains( 'Cafe_Noire_Expresso', $file2 );
70
-		$this->assertContains( 'Unittest%3A_Bundle', $file2 );
69
+		$this->assertContains('Cafe_Noire_Expresso', $file2);
70
+		$this->assertContains('Unittest%3A_Bundle', $file2);
71 71
 
72
-		$this->assertContains( 'aimeos-sitemap-1.xml.gz', $index );
73
-		$this->assertContains( 'aimeos-sitemap-2.xml.gz', $index );
72
+		$this->assertContains('aimeos-sitemap-1.xml.gz', $index);
73
+		$this->assertContains('aimeos-sitemap-2.xml.gz', $index);
74 74
 	}
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
controller/jobs/tests/Controller/Jobs/Product/Export/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(true);
22 22
 
23 23
 		$this->context = \TestHelperJobs::getContext();
24 24
 		$this->aimeos = \TestHelperJobs::getAimeos();
25 25
 
26
-		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard( $this->context, $this->aimeos );
26
+		$this->object = new \Aimeos\Controller\Jobs\Product\Export\Standard($this->context, $this->aimeos);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 
35 35
 		$this->object = null;
@@ -38,34 +38,34 @@  discard block
 block discarded – undo
38 38
 
39 39
 	public function testGetName()
40 40
 	{
41
-		$this->assertEquals( 'Product export', $this->object->getName() );
41
+		$this->assertEquals('Product export', $this->object->getName());
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testGetDescription()
46 46
 	{
47 47
 		$text = 'Exports all available products';
48
-		$this->assertEquals( $text, $this->object->getDescription() );
48
+		$this->assertEquals($text, $this->object->getDescription());
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testRun()
53 53
 	{
54
-		$this->context->getConfig()->set( 'controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml' );
54
+		$this->context->getConfig()->set('controller/jobs/product/export/filename', 'aimeos-products-%1$d.xml');
55 55
 
56 56
 		$this->object->run();
57 57
 
58 58
 		$ds = DIRECTORY_SEPARATOR;
59
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-1.xml' );
60
-		$this->assertFileExists( 'tmp' . $ds . 'aimeos-products-2.xml' );
59
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-1.xml');
60
+		$this->assertFileExists('tmp' . $ds . 'aimeos-products-2.xml');
61 61
 
62
-		$file1 = file_get_contents( 'tmp' . $ds . 'aimeos-products-1.xml' );
63
-		$file2 = file_get_contents( 'tmp' . $ds . 'aimeos-products-2.xml' );
62
+		$file1 = file_get_contents('tmp' . $ds . 'aimeos-products-1.xml');
63
+		$file2 = file_get_contents('tmp' . $ds . 'aimeos-products-2.xml');
64 64
 
65
-		unlink( 'tmp' . $ds . 'aimeos-products-1.xml' );
66
-		unlink( 'tmp' . $ds . 'aimeos-products-2.xml' );
65
+		unlink('tmp' . $ds . 'aimeos-products-1.xml');
66
+		unlink('tmp' . $ds . 'aimeos-products-2.xml');
67 67
 
68
-		$this->assertContains( 'CNE', $file2 );
69
-		$this->assertContains( 'U:BUNDLE', $file2 );
68
+		$this->assertContains('CNE', $file2);
69
+		$this->assertContains('U:BUNDLE', $file2);
70 70
 	}
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
common/src/Controller/Common/Product/Import/Csv/Processor/Done.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
28 28
 	 * @param \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor Decorated processor
29 29
 	 */
30
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
-		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null )
30
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
31
+		\Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $processor = null)
32 32
 	{
33 33
 	}
34 34
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param array $data List of CSV fields with position as key and data as value
41 41
 	 * @return array List of data which hasn't been imported
42 42
 	 */
43
-	public function process( \Aimeos\MShop\Product\Item\Iface $item, array $data )
43
+	public function process(\Aimeos\MShop\Product\Item\Iface $item, array $data)
44 44
 	{
45 45
 		return $data;
46 46
 	}
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Product/Import/Csv/Base.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 * @param array $data Associative list of product codes and lists of CSV field indexes and their data
31 31
 	 * @return array Associative list of CSV field indexes and their converted data
32 32
 	 */
33
-	protected function convertData( array $convlist, array $data )
33
+	protected function convertData(array $convlist, array $data)
34 34
 	{
35
-		foreach( $convlist as $idx => $converter )
35
+		foreach ($convlist as $idx => $converter)
36 36
 		{
37
-			foreach( $data as $code => $list )
37
+			foreach ($data as $code => $list)
38 38
 			{
39
-				if( isset( $list[$idx] ) ) {
40
-					$data[$code][$idx] = $converter->translate( $list[$idx] );
39
+				if (isset($list[$idx])) {
40
+					$data[$code][$idx] = $converter->translate($list[$idx]);
41 41
 				}
42 42
 			}
43 43
 		}
@@ -53,36 +53,36 @@  discard block
 block discarded – undo
53 53
 	 * @param string|null Name of the cache implementation
54 54
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object
55 55
 	 */
56
-	protected function getCache( $type, $name = null )
56
+	protected function getCache($type, $name = null)
57 57
 	{
58 58
 		$context = $this->getContext();
59 59
 		$config = $context->getConfig();
60 60
 
61
-		if( ctype_alnum( $type ) === false )
61
+		if (ctype_alnum($type) === false)
62 62
 		{
63 63
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>';
64
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
64
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
65 65
 		}
66 66
 
67
-		if( $name === null ) {
68
-			$name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $config->get('controller/common/product/import/csv/cache/' . $type . '/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\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $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
-		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name;
77
+		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name;
78 78
 
79
-		if( class_exists( $classname ) === false ) {
80
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
79
+		if (class_exists($classname) === false) {
80
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
81 81
 		}
82 82
 
83
-		$object = new $classname( $context );
83
+		$object = new $classname($context);
84 84
 
85
-		\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object );
85
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object);
86 86
 
87 87
 		return $object;
88 88
 	}
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 * @param array $convmap List of converter names for the values at the position in the CSV file
95 95
 	 * @return array Associative list of positions and converter objects
96 96
 	 */
97
-	protected function getConverterList( array $convmap )
97
+	protected function getConverterList(array $convmap)
98 98
 	{
99 99
 		$convlist = [];
100 100
 
101
-		foreach( $convmap as $idx => $name ) {
102
-			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name );
101
+		foreach ($convmap as $idx => $name) {
102
+			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name);
103 103
 		}
104 104
 
105 105
 		return $convlist;
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 * @param integer $codePos Column position which contains the unique product code (starting from 0)
115 115
 	 * @return array List of arrays with product codes as keys and list of values from the CSV file
116 116
 	 */
117
-	protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos )
117
+	protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos)
118 118
 	{
119 119
 		$count = 0;
120 120
 		$data = [];
121 121
 
122
-		while( $content->valid() && $count++ < $maxcnt )
122
+		while ($content->valid() && $count++ < $maxcnt)
123 123
 		{
124 124
 			$row = $content->current();
125
-			$data[ $row[$codePos] ] = $row;
125
+			$data[$row[$codePos]] = $row;
126 126
 			$content->next();
127 127
 		}
128 128
 
@@ -221,21 +221,21 @@  discard block
 block discarded – undo
221 221
 	 * @param array $mapping List of domain item keys with the CSV field position as key
222 222
 	 * @return array List of associative arrays containing the chunked properties
223 223
 	 */
224
-	protected function getMappedChunk( array &$data, array $mapping )
224
+	protected function getMappedChunk(array &$data, array $mapping)
225 225
 	{
226 226
 		$idx = 0;
227 227
 		$map = [];
228 228
 
229
-		foreach( $mapping as $pos => $key )
229
+		foreach ($mapping as $pos => $key)
230 230
 		{
231
-			if( isset( $map[$idx][$key] ) ) {
231
+			if (isset($map[$idx][$key])) {
232 232
 				$idx++;
233 233
 			}
234 234
 
235
-			if( isset( $data[$pos] ) )
235
+			if (isset($data[$pos]))
236 236
 			{
237 237
 				$map[$idx][$key] = $data[$pos];
238
-				unset( $data[$pos] );
238
+				unset($data[$pos]);
239 239
 			}
240 240
 		}
241 241
 
@@ -249,37 +249,37 @@  discard block
 block discarded – undo
249 249
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
250 250
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object
251 251
 	 */
252
-	protected function getProcessors( array $mappings )
252
+	protected function getProcessors(array $mappings)
253 253
 	{
254 254
 		$context = $this->getContext();
255 255
 		$config = $context->getConfig();
256
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, [] );
256
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, []);
257 257
 
258
-		foreach( $mappings as $type => $mapping )
258
+		foreach ($mappings as $type => $mapping)
259 259
 		{
260
-			if( ctype_alnum( $type ) === false )
260
+			if (ctype_alnum($type) === false)
261 261
 			{
262 262
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>';
263
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
263
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
264 264
 			}
265 265
 
266
-			$name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' );
266
+			$name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard');
267 267
 
268
-			if( ctype_alnum( $name ) === false )
268
+			if (ctype_alnum($name) === false)
269 269
 			{
270 270
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
271
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
271
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
272 272
 			}
273 273
 
274
-			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
274
+			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
275 275
 
276
-			if( class_exists( $classname ) === false ) {
277
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
276
+			if (class_exists($classname) === false) {
277
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
278 278
 			}
279 279
 
280
-			$object = new $classname( $context, $mapping, $object );
280
+			$object = new $classname($context, $mapping, $object);
281 281
 
282
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object );
282
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object);
283 283
 		}
284 284
 
285 285
 		return $object;
@@ -293,17 +293,17 @@  discard block
 block discarded – undo
293 293
 	 * @param array $domains List of domains whose items should be fetched too
294 294
 	 * @return array Associative list of product codes as key and product items as value
295 295
 	 */
296
-	protected function getProducts( array $codes, array $domains )
296
+	protected function getProducts(array $codes, array $domains)
297 297
 	{
298 298
 		$result = [];
299
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
299
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
300 300
 
301 301
 		$search = $manager->createSearch();
302
-		$search->setConditions( $search->compare( '==', 'product.code', $codes ) );
303
-		$search->setSlice( 0, count( $codes ) );
302
+		$search->setConditions($search->compare('==', 'product.code', $codes));
303
+		$search->setSlice(0, count($codes));
304 304
 
305
-		foreach( $manager->searchItems( $search, $domains ) as $item ) {
306
-			$result[ $item->getCode() ] = $item;
305
+		foreach ($manager->searchItems($search, $domains) as $item) {
306
+			$result[$item->getCode()] = $item;
307 307
 		}
308 308
 
309 309
 		return $result;
@@ -318,23 +318,23 @@  discard block
 block discarded – undo
318 318
 	 * @param string $code Unique code of the type item
319 319
 	 * @return string Unique ID of the type item
320 320
 	 */
321
-	protected function getTypeId( $path, $domain, $code )
321
+	protected function getTypeId($path, $domain, $code)
322 322
 	{
323
-		if( !isset( self::$types[$path][$domain] ) )
323
+		if (!isset(self::$types[$path][$domain]))
324 324
 		{
325
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $path );
326
-			$key = str_replace( '/', '.', $path );
325
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $path);
326
+			$key = str_replace('/', '.', $path);
327 327
 
328 328
 			$search = $manager->createSearch();
329
-			$search->setConditions( $search->compare( '==', $key . '.domain', $domain ) );
329
+			$search->setConditions($search->compare('==', $key . '.domain', $domain));
330 330
 
331
-			foreach( $manager->searchItems( $search ) as $id => $item ) {
332
-				self::$types[$path][$domain][ $item->getCode() ] = $id;
331
+			foreach ($manager->searchItems($search) as $id => $item) {
332
+				self::$types[$path][$domain][$item->getCode()] = $id;
333 333
 			}
334 334
 		}
335 335
 
336
-		if( !isset( self::$types[$path][$domain][$code] ) ) {
337
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path ) );
336
+		if (!isset(self::$types[$path][$domain][$code])) {
337
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path));
338 338
 		}
339 339
 
340 340
 		return self::$types[$path][$domain][$code];
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Product/Import/Csv/Traits.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 * @param array $data Associative list of product codes and lists of CSV field indexes and their data
38 38
 	 * @return array Associative list of CSV field indexes and their converted data
39 39
 	 */
40
-	protected function convertData( array $convlist, array $data )
40
+	protected function convertData(array $convlist, array $data)
41 41
 	{
42
-		foreach( $convlist as $idx => $converter )
42
+		foreach ($convlist as $idx => $converter)
43 43
 		{
44
-			foreach( $data as $code => $list )
44
+			foreach ($data as $code => $list)
45 45
 			{
46
-				if( isset( $list[$idx] ) ) {
47
-					$data[$code][$idx] = $converter->translate( $list[$idx] );
46
+				if (isset($list[$idx])) {
47
+					$data[$code][$idx] = $converter->translate($list[$idx]);
48 48
 				}
49 49
 			}
50 50
 		}
@@ -60,36 +60,36 @@  discard block
 block discarded – undo
60 60
 	 * @param string|null Name of the cache implementation
61 61
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object
62 62
 	 */
63
-	protected function getCache( $type, $name = null )
63
+	protected function getCache($type, $name = null)
64 64
 	{
65 65
 		$context = $this->getContext();
66 66
 		$config = $context->getConfig();
67 67
 
68
-		if( ctype_alnum( $type ) === false )
68
+		if (ctype_alnum($type) === false)
69 69
 		{
70 70
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>';
71
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
71
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
72 72
 		}
73 73
 
74
-		if( $name === null ) {
75
-			$name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' );
74
+		if ($name === null) {
75
+			$name = $config->get('controller/common/product/import/csv/cache/' . $type . '/name', 'Standard');
76 76
 		}
77 77
 
78
-		if( ctype_alnum( $name ) === false )
78
+		if (ctype_alnum($name) === false)
79 79
 		{
80 80
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<not a string>';
81
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
81
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
82 82
 		}
83 83
 
84
-		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name;
84
+		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name;
85 85
 
86
-		if( class_exists( $classname ) === false ) {
87
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
86
+		if (class_exists($classname) === false) {
87
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
88 88
 		}
89 89
 
90
-		$object = new $classname( $context );
90
+		$object = new $classname($context);
91 91
 
92
-		\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object );
92
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object);
93 93
 
94 94
 		return $object;
95 95
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * @param array $convmap List of converter names for the values at the position in the CSV file
102 102
 	 * @return array Associative list of positions and converter objects
103 103
 	 */
104
-	protected function getConverterList( array $convmap )
104
+	protected function getConverterList(array $convmap)
105 105
 	{
106 106
 		$convlist = [];
107 107
 
108
-		foreach( $convmap as $idx => $name ) {
109
-			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name );
108
+		foreach ($convmap as $idx => $name) {
109
+			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name);
110 110
 		}
111 111
 
112 112
 		return $convlist;
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 * @param integer $codePos Column position which contains the unique product code (starting from 0)
122 122
 	 * @return array List of arrays with product codes as keys and list of values from the CSV file
123 123
 	 */
124
-	protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos )
124
+	protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos)
125 125
 	{
126 126
 		$count = 0;
127 127
 		$data = [];
128 128
 
129
-		while( $content->valid() && $count++ < $maxcnt )
129
+		while ($content->valid() && $count++ < $maxcnt)
130 130
 		{
131 131
 			$row = $content->current();
132
-			$data[ $row[$codePos] ] = $row;
132
+			$data[$row[$codePos]] = $row;
133 133
 			$content->next();
134 134
 		}
135 135
 
@@ -228,21 +228,21 @@  discard block
 block discarded – undo
228 228
 	 * @param array $mapping List of domain item keys with the CSV field position as key
229 229
 	 * @return array List of associative arrays containing the chunked properties
230 230
 	 */
231
-	protected function getMappedChunk( array &$data, array $mapping )
231
+	protected function getMappedChunk(array &$data, array $mapping)
232 232
 	{
233 233
 		$idx = 0;
234 234
 		$map = [];
235 235
 
236
-		foreach( $mapping as $pos => $key )
236
+		foreach ($mapping as $pos => $key)
237 237
 		{
238
-			if( isset( $map[$idx][$key] ) ) {
238
+			if (isset($map[$idx][$key])) {
239 239
 				$idx++;
240 240
 			}
241 241
 
242
-			if( isset( $data[$pos] ) )
242
+			if (isset($data[$pos]))
243 243
 			{
244 244
 				$map[$idx][$key] = $data[$pos];
245
-				unset( $data[$pos] );
245
+				unset($data[$pos]);
246 246
 			}
247 247
 		}
248 248
 
@@ -256,37 +256,37 @@  discard block
 block discarded – undo
256 256
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
257 257
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object
258 258
 	 */
259
-	protected function getProcessors( array $mappings )
259
+	protected function getProcessors(array $mappings)
260 260
 	{
261 261
 		$context = $this->getContext();
262 262
 		$config = $context->getConfig();
263
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, [] );
263
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, []);
264 264
 
265
-		foreach( $mappings as $type => $mapping )
265
+		foreach ($mappings as $type => $mapping)
266 266
 		{
267
-			if( ctype_alnum( $type ) === false )
267
+			if (ctype_alnum($type) === false)
268 268
 			{
269 269
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>';
270
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
270
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
271 271
 			}
272 272
 
273
-			$name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' );
273
+			$name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard');
274 274
 
275
-			if( ctype_alnum( $name ) === false )
275
+			if (ctype_alnum($name) === false)
276 276
 			{
277 277
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
278
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
278
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
279 279
 			}
280 280
 
281
-			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
281
+			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
282 282
 
283
-			if( class_exists( $classname ) === false ) {
284
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
283
+			if (class_exists($classname) === false) {
284
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
285 285
 			}
286 286
 
287
-			$object = new $classname( $context, $mapping, $object );
287
+			$object = new $classname($context, $mapping, $object);
288 288
 
289
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object );
289
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object);
290 290
 		}
291 291
 
292 292
 		return $object;
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 	 * @param array $domains List of domains whose items should be fetched too
301 301
 	 * @return array Associative list of product codes as key and product items as value
302 302
 	 */
303
-	protected function getProducts( array $codes, array $domains )
303
+	protected function getProducts(array $codes, array $domains)
304 304
 	{
305 305
 		$result = [];
306
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
306
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
307 307
 
308 308
 		$search = $manager->createSearch();
309
-		$search->setConditions( $search->compare( '==', 'product.code', $codes ) );
310
-		$search->setSlice( 0, count( $codes ) );
309
+		$search->setConditions($search->compare('==', 'product.code', $codes));
310
+		$search->setSlice(0, count($codes));
311 311
 
312
-		foreach( $manager->searchItems( $search, $domains ) as $item ) {
313
-			$result[ $item->getCode() ] = $item;
312
+		foreach ($manager->searchItems($search, $domains) as $item) {
313
+			$result[$item->getCode()] = $item;
314 314
 		}
315 315
 
316 316
 		return $result;
@@ -325,23 +325,23 @@  discard block
 block discarded – undo
325 325
 	 * @param string $code Unique code of the type item
326 326
 	 * @return string Unique ID of the type item
327 327
 	 */
328
-	protected function getTypeId( $path, $domain, $code )
328
+	protected function getTypeId($path, $domain, $code)
329 329
 	{
330
-		if( !isset( self::$types[$path][$domain] ) )
330
+		if (!isset(self::$types[$path][$domain]))
331 331
 		{
332
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $path );
333
-			$key = str_replace( '/', '.', $path );
332
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $path);
333
+			$key = str_replace('/', '.', $path);
334 334
 
335 335
 			$search = $manager->createSearch();
336
-			$search->setConditions( $search->compare( '==', $key . '.domain', $domain ) );
336
+			$search->setConditions($search->compare('==', $key . '.domain', $domain));
337 337
 
338
-			foreach( $manager->searchItems( $search ) as $id => $item ) {
339
-				self::$types[$path][$domain][ $item->getCode() ] = $id;
338
+			foreach ($manager->searchItems($search) as $id => $item) {
339
+				self::$types[$path][$domain][$item->getCode()] = $id;
340 340
 			}
341 341
 		}
342 342
 
343
-		if( !isset( self::$types[$path][$domain][$code] ) ) {
344
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path ) );
343
+		if (!isset(self::$types[$path][$domain][$code])) {
344
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path));
345 345
 		}
346 346
 
347 347
 		return self::$types[$path][$domain][$code];
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Coupon/Import/Csv/Base.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 	 * @param array $codes List of coupon codes
27 27
 	 * @return array Associative list of coupon codes as key and coupon code items as value
28 28
 	 */
29
-	protected function getCouponCodeItems( array $codes )
29
+	protected function getCouponCodeItems(array $codes)
30 30
 	{
31 31
 		$result = [];
32
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' );
32
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code');
33 33
 
34 34
 		$search = $manager->createSearch();
35
-		$search->setConditions( $search->compare( '==', 'coupon.code.code', $codes ) );
36
-		$search->setSlice( 0, count( $codes ) );
35
+		$search->setConditions($search->compare('==', 'coupon.code.code', $codes));
36
+		$search->setSlice(0, count($codes));
37 37
 
38
-		foreach( $manager->searchItems( $search ) as $item ) {
39
-			$result[ $item->getCode() ] = $item;
38
+		foreach ($manager->searchItems($search) as $item) {
39
+			$result[$item->getCode()] = $item;
40 40
 		}
41 41
 
42 42
 		return $result;
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 * @param integer $codePos Column position which contains the unique coupon code (starting from 0)
52 52
 	 * @return array List of arrays with coupon codes as keys and list of values from the CSV file
53 53
 	 */
54
-	protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos )
54
+	protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos)
55 55
 	{
56 56
 		$count = 0;
57 57
 		$data = [];
58 58
 
59
-		while( $content->valid() && $count++ < $maxcnt )
59
+		while ($content->valid() && $count++ < $maxcnt)
60 60
 		{
61 61
 			$row = $content->current();
62
-			$data[ $row[$codePos] ] = $row;
62
+			$data[$row[$codePos]] = $row;
63 63
 			$content->next();
64 64
 		}
65 65
 
@@ -98,21 +98,21 @@  discard block
 block discarded – undo
98 98
 	 * @param array $mapping List of domain item keys with the CSV field position as key
99 99
 	 * @return array List of associative arrays containing the chunked properties
100 100
 	 */
101
-	protected function getMappedChunk( array &$data, array $mapping )
101
+	protected function getMappedChunk(array &$data, array $mapping)
102 102
 	{
103 103
 		$idx = 0;
104 104
 		$map = [];
105 105
 
106
-		foreach( $mapping as $pos => $key )
106
+		foreach ($mapping as $pos => $key)
107 107
 		{
108
-			if( isset( $map[$idx][$key] ) ) {
108
+			if (isset($map[$idx][$key])) {
109 109
 				$idx++;
110 110
 			}
111 111
 
112
-			if( isset( $data[$pos] ) )
112
+			if (isset($data[$pos]))
113 113
 			{
114 114
 				$map[$idx][$key] = $data[$pos];
115
-				unset( $data[$pos] );
115
+				unset($data[$pos]);
116 116
 			}
117 117
 		}
118 118
 
@@ -126,37 +126,37 @@  discard block
 block discarded – undo
126 126
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
127 127
 	 * @return \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Iface Processor object
128 128
 	 */
129
-	protected function getProcessors( array $mappings )
129
+	protected function getProcessors(array $mappings)
130 130
 	{
131 131
 		$context = $this->getContext();
132 132
 		$config = $context->getConfig();
133
-		$object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done( $context, [] );
133
+		$object = new \Aimeos\Controller\Common\Coupon\Import\Csv\Processor\Done($context, []);
134 134
 
135
-		foreach( $mappings as $type => $mapping )
135
+		foreach ($mappings as $type => $mapping)
136 136
 		{
137
-			if( ctype_alnum( $type ) === false )
137
+			if (ctype_alnum($type) === false)
138 138
 			{
139 139
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type : '<not a string>';
140
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
140
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
141 141
 			}
142 142
 
143
-			$name = $config->get( 'controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard' );
143
+			$name = $config->get('controller/common/coupon/import/csv/processor/' . $type . '/name', 'Standard');
144 144
 
145
-			if( ctype_alnum( $name ) === false )
145
+			if (ctype_alnum($name) === false)
146 146
 			{
147 147
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
148
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
148
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
149 149
 			}
150 150
 
151
-			$classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
151
+			$classname = '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
152 152
 
153
-			if( class_exists( $classname ) === false ) {
154
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
153
+			if (class_exists($classname) === false) {
154
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
155 155
 			}
156 156
 
157
-			$object = new $classname( $context, $mapping, $object );
157
+			$object = new $classname($context, $mapping, $object);
158 158
 
159
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object );
159
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Coupon\\Import\\Csv\\Processor\\Iface', $object);
160 160
 		}
161 161
 
162 162
 		return $object;
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Catalog/Import/Csv/Base.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 * @param array $data Associative list of catalog codes and lists of CSV field indexes and their data
31 31
 	 * @return array Associative list of CSV field indexes and their converted data
32 32
 	 */
33
-	protected function convertData( array $convlist, array $data )
33
+	protected function convertData(array $convlist, array $data)
34 34
 	{
35
-		foreach( $convlist as $idx => $converter )
35
+		foreach ($convlist as $idx => $converter)
36 36
 		{
37
-			foreach( $data as $code => $list )
37
+			foreach ($data as $code => $list)
38 38
 			{
39
-				if( isset( $list[$idx] ) ) {
40
-					$data[$code][$idx] = $converter->translate( $list[$idx] );
39
+				if (isset($list[$idx])) {
40
+					$data[$code][$idx] = $converter->translate($list[$idx]);
41 41
 				}
42 42
 			}
43 43
 		}
@@ -53,36 +53,36 @@  discard block
 block discarded – undo
53 53
 	 * @param string|null Name of the cache implementation
54 54
 	 * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Cache\Iface Cache object
55 55
 	 */
56
-	protected function getCache( $type, $name = null )
56
+	protected function getCache($type, $name = null)
57 57
 	{
58 58
 		$context = $this->getContext();
59 59
 		$config = $context->getConfig();
60 60
 
61
-		if( ctype_alnum( $type ) === false )
61
+		if (ctype_alnum($type) === false)
62 62
 		{
63 63
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type : '<not a string>';
64
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
64
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
65 65
 		}
66 66
 
67
-		if( $name === null ) {
68
-			$name = $config->get( 'controller/common/catalog/import/csv/cache/' . $type . '/name', 'Standard' );
67
+		if ($name === null) {
68
+			$name = $config->get('controller/common/catalog/import/csv/cache/' . $type . '/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\\Common\\Catalog\\Import\\Csv\\Cache\\' . $type . '\\' . $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
-		$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name;
77
+		$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name;
78 78
 
79
-		if( class_exists( $classname ) === false ) {
80
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
79
+		if (class_exists($classname) === false) {
80
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
81 81
 		}
82 82
 
83
-		$object = new $classname( $context );
83
+		$object = new $classname($context);
84 84
 
85
-		\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object );
85
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Cache\\Iface', $object);
86 86
 
87 87
 		return $object;
88 88
 	}
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 * @param array $convmap List of converter names for the values at the position in the CSV file
95 95
 	 * @return array Associative list of positions and converter objects
96 96
 	 */
97
-	protected function getConverterList( array $convmap )
97
+	protected function getConverterList(array $convmap)
98 98
 	{
99 99
 		$convlist = [];
100 100
 
101
-		foreach( $convmap as $idx => $name ) {
102
-			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name );
101
+		foreach ($convmap as $idx => $name) {
102
+			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name);
103 103
 		}
104 104
 
105 105
 		return $convlist;
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 * @param integer $codePos Column position which contains the unique catalog code (starting from 0)
115 115
 	 * @return array List of arrays with catalog codes as keys and list of values from the CSV file
116 116
 	 */
117
-	protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos )
117
+	protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos)
118 118
 	{
119 119
 		$count = 0;
120 120
 		$data = [];
121 121
 
122
-		while( $content->valid() && $count++ < $maxcnt )
122
+		while ($content->valid() && $count++ < $maxcnt)
123 123
 		{
124 124
 			$row = $content->current();
125
-			$data[ $row[$codePos] ] = $row;
125
+			$data[$row[$codePos]] = $row;
126 126
 			$content->next();
127 127
 		}
128 128
 
@@ -178,21 +178,21 @@  discard block
 block discarded – undo
178 178
 	 * @param array $mapping List of domain item keys with the CSV field position as key
179 179
 	 * @return array List of associative arrays containing the chunked properties
180 180
 	 */
181
-	protected function getMappedChunk( array &$data, array $mapping )
181
+	protected function getMappedChunk(array &$data, array $mapping)
182 182
 	{
183 183
 		$idx = 0;
184 184
 		$map = [];
185 185
 
186
-		foreach( $mapping as $pos => $key )
186
+		foreach ($mapping as $pos => $key)
187 187
 		{
188
-			if( isset( $map[$idx][$key] ) ) {
188
+			if (isset($map[$idx][$key])) {
189 189
 				$idx++;
190 190
 			}
191 191
 
192
-			if( isset( $data[$pos] ) )
192
+			if (isset($data[$pos]))
193 193
 			{
194 194
 				$map[$idx][$key] = $data[$pos];
195
-				unset( $data[$pos] );
195
+				unset($data[$pos]);
196 196
 			}
197 197
 		}
198 198
 
@@ -206,37 +206,37 @@  discard block
 block discarded – undo
206 206
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
207 207
 	 * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface Processor object
208 208
 	 */
209
-	protected function getProcessors( array $mappings )
209
+	protected function getProcessors(array $mappings)
210 210
 	{
211 211
 		$context = $this->getContext();
212 212
 		$config = $context->getConfig();
213
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $context, [] );
213
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($context, []);
214 214
 
215
-		foreach( $mappings as $type => $mapping )
215
+		foreach ($mappings as $type => $mapping)
216 216
 		{
217
-			if( ctype_alnum( $type ) === false )
217
+			if (ctype_alnum($type) === false)
218 218
 			{
219 219
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type : '<not a string>';
220
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
220
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
221 221
 			}
222 222
 
223
-			$name = $config->get( 'controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard' );
223
+			$name = $config->get('controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard');
224 224
 
225
-			if( ctype_alnum( $name ) === false )
225
+			if (ctype_alnum($name) === false)
226 226
 			{
227 227
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
228
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
228
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
229 229
 			}
230 230
 
231
-			$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
231
+			$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
232 232
 
233
-			if( class_exists( $classname ) === false ) {
234
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
233
+			if (class_exists($classname) === false) {
234
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
235 235
 			}
236 236
 
237
-			$object = new $classname( $context, $mapping, $object );
237
+			$object = new $classname($context, $mapping, $object);
238 238
 
239
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object );
239
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object);
240 240
 		}
241 241
 
242 242
 		return $object;
@@ -251,23 +251,23 @@  discard block
 block discarded – undo
251 251
 	 * @param string $code Unique code of the type item
252 252
 	 * @return string Unique ID of the type item
253 253
 	 */
254
-	protected function getTypeId( $path, $domain, $code )
254
+	protected function getTypeId($path, $domain, $code)
255 255
 	{
256
-		if( !isset( self::$types[$path][$domain] ) )
256
+		if (!isset(self::$types[$path][$domain]))
257 257
 		{
258
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $path );
259
-			$key = str_replace( '/', '.', $path );
258
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $path);
259
+			$key = str_replace('/', '.', $path);
260 260
 
261 261
 			$search = $manager->createSearch();
262
-			$search->setConditions( $search->compare( '==', $key . '.domain', $domain ) );
262
+			$search->setConditions($search->compare('==', $key . '.domain', $domain));
263 263
 
264
-			foreach( $manager->searchItems( $search ) as $id => $item ) {
265
-				self::$types[$path][$domain][ $item->getCode() ] = $id;
264
+			foreach ($manager->searchItems($search) as $id => $item) {
265
+				self::$types[$path][$domain][$item->getCode()] = $id;
266 266
 			}
267 267
 		}
268 268
 
269
-		if( !isset( self::$types[$path][$domain][$code] ) ) {
270
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path ) );
269
+		if (!isset(self::$types[$path][$domain][$code])) {
270
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('No type item for "%1$s/%2$s" in "%3$s" found', $domain, $code, $path));
271 271
 		}
272 272
 
273 273
 		return self::$types[$path][$domain][$code];
Please login to merge, or discard this patch.