Completed
Pull Request — master (#12)
by
unknown
02:44
created
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.
controller/common/tests/Controller/Common/Product/Import/Csv/TraitsTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@  discard block
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop\Factory::setCache( true );
19
+		\Aimeos\MShop\Factory::setCache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22 22
 		$aimeos = \TestHelperCntl::getAimeos();
23 23
 
24
-		$this->object = new TestAbstract( $context, $aimeos );
24
+		$this->object = new TestAbstract($context, $aimeos);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		\Aimeos\MShop\Factory::setCache( false );
30
+		\Aimeos\MShop\Factory::setCache(false);
31 31
 		\Aimeos\MShop\Factory::clear();
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testGetCache()
36 36
 	{
37
-		$cache = $this->object->getCachePublic( 'attribute' );
37
+		$cache = $this->object->getCachePublic('attribute');
38 38
 
39
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache );
39
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $cache);
40 40
 	}
41 41
 
42 42
 
43 43
 	public function testGetCacheInvalidType()
44 44
 	{
45
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
46
-		$this->object->getCachePublic( '$' );
45
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
46
+		$this->object->getCachePublic('$');
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testGetCacheInvalidClass()
51 51
 	{
52
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
53
-		$this->object->getCachePublic( 'unknown' );
52
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
53
+		$this->object->getCachePublic('unknown');
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetCacheInvalidInterface()
58 58
 	{
59
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
60
-		$this->object->getCachePublic( 'attribute', 'unknown' );
59
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
60
+		$this->object->getCachePublic('attribute', 'unknown');
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetProcessors()
65 65
 	{
66
-		$processor = $this->object->getProcessorsPublic( array( 'attribute' => [] ) );
66
+		$processor = $this->object->getProcessorsPublic(array('attribute' => []));
67 67
 
68
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor );
68
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $processor);
69 69
 	}
70 70
 
71 71
 
72 72
 	public function testGetProcessorsInvalidType()
73 73
 	{
74
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
75
-		$this->object->getProcessorsPublic( array( '$' => [] ) );
74
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
75
+		$this->object->getProcessorsPublic(array('$' => []));
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testGetProcessorsInvalidClass()
80 80
 	{
81
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
82
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
81
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
82
+		$this->object->getProcessorsPublic(array('unknown' => []));
83 83
 	}
84 84
 
85 85
 
86 86
 	public function testGetProcessorsInvalidInterface()
87 87
 	{
88
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
89
-		$this->object->getProcessorsPublic( array( 'unknown' => [] ) );
88
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
89
+		$this->object->getProcessorsPublic(array('unknown' => []));
90 90
 	}
91 91
 
92 92
 
93 93
 	public function testGetTypeId()
94 94
 	{
95
-		$typeid = $this->object->getTypeIdPublic( 'attribute/type', 'product', 'color' );
95
+		$typeid = $this->object->getTypeIdPublic('attribute/type', 'product', 'color');
96 96
 
97
-		$this->assertNotEquals( null, $typeid );
97
+		$this->assertNotEquals(null, $typeid);
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testGetTypeIdUnknown()
102 102
 	{
103
-		$this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' );
104
-		$this->object->getTypeIdPublic( 'attribute/type', 'product', 'unknown' );
103
+		$this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception');
104
+		$this->object->getTypeIdPublic('attribute/type', 'product', 'unknown');
105 105
 	}
106 106
 }
107 107
 
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
 		return \TestHelperCntl::getContext();
116 116
 	}
117 117
 
118
-	public function getCachePublic( $type, $name = null )
118
+	public function getCachePublic($type, $name = null)
119 119
 	{
120
-		return $this->getCache( $type, $name );
120
+		return $this->getCache($type, $name);
121 121
 	}
122 122
 
123 123
 
124
-	public function getProcessorsPublic( array $mappings )
124
+	public function getProcessorsPublic(array $mappings)
125 125
 	{
126
-		return $this->getProcessors( $mappings );
126
+		return $this->getProcessors($mappings);
127 127
 	}
128 128
 
129 129
 
130
-	public function getTypeIdPublic( $path, $domain, $code )
130
+	public function getTypeIdPublic($path, $domain, $code)
131 131
 	{
132
-		return $this->getTypeId( $path, $domain, $code );
132
+		return $this->getTypeId($path, $domain, $code);
133 133
 	}
134 134
 }
135 135
 
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
@@ -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/jobs/src/Controller/Jobs/Subscription/Process/End/Standard.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function getName()
30 30
 	{
31
-		return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Subscription process end' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Subscription process end');
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', 'Terminates expired subscriptions' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Terminates expired subscriptions');
43 43
 	}
44 44
 
45 45
 
@@ -65,51 +65,51 @@  discard block
 block discarded – undo
65 65
 		 * @since 2018.04
66 66
 		 * @category Developer
67 67
 		 */
68
-		$names = (array) $config->get( 'controller/common/subscription/process/processors', [] );
68
+		$names = (array) $config->get('controller/common/subscription/process/processors', []);
69 69
 
70
-		$processors = $this->getProcessors( $names );
71
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' );
70
+		$processors = $this->getProcessors($names);
71
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'subscription');
72 72
 
73
-		$search = $manager->createSearch( true );
73
+		$search = $manager->createSearch(true);
74 74
 		$expr = [
75
-			$search->compare( '<', 'subscription.dateend', date( 'Y-m-d' ) ),
75
+			$search->compare('<', 'subscription.dateend', date('Y-m-d')),
76 76
 			$search->getConditions(),
77 77
 		];
78
-		$search->setConditions( $search->combine( '&&', $expr ) );
79
-		$search->setSortations( [$search->sort( '+', 'subscription.id' )] );
78
+		$search->setConditions($search->combine('&&', $expr));
79
+		$search->setSortations([$search->sort('+', 'subscription.id')]);
80 80
 
81 81
 		$start = 0;
82 82
 
83 83
 		do
84 84
 		{
85
-			$search->setSlice( $start, 100 );
86
-			$items = $manager->searchItems( $search );
85
+			$search->setSlice($start, 100);
86
+			$items = $manager->searchItems($search);
87 87
 
88
-			foreach( $items as $item )
88
+			foreach ($items as $item)
89 89
 			{
90 90
 				try
91 91
 				{
92
-					foreach( $processors as $processor ) {
93
-						$processor->end( $item );
92
+					foreach ($processors as $processor) {
93
+						$processor->end($item);
94 94
 					}
95 95
 
96
-					if( ( $reason = $item->getReason() ) === null ) {
96
+					if (($reason = $item->getReason()) === null) {
97 97
 						$reason = \Aimeos\MShop\Subscription\Item\Iface::REASON_END;
98 98
 					}
99 99
 
100
-					$manager->saveItem( $item->setReason( $reason )->setStatus( 0 ) );
100
+					$manager->saveItem($item->setReason($reason)->setStatus(0));
101 101
 				}
102
-				catch( \Exception $e )
102
+				catch (\Exception $e)
103 103
 				{
104 104
 					$msg = 'Unable to process subscription with ID "%1$S": %2$s';
105
-					$logger->log( sprintf( $msg, $item->getId(), $e->getMessage() ) );
106
-					$logger->log( $e->getTraceAsString() );
105
+					$logger->log(sprintf($msg, $item->getId(), $e->getMessage()));
106
+					$logger->log($e->getTraceAsString());
107 107
 				}
108 108
 			}
109 109
 
110
-			$count = count( $items );
110
+			$count = count($items);
111 111
 			$start += $count;
112 112
 		}
113
-		while( $count === $search->getSliceSize() );
113
+		while ($count === $search->getSliceSize());
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
jobs/tests/Controller/Jobs/Subscription/Process/Begin/StanardTest.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,49 +20,49 @@  discard block
 block discarded – undo
20 20
 		$aimeos = \TestHelperJobs::getAimeos();
21 21
 		$this->context = \TestHelperJobs::getContext();
22 22
 
23
-		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard( $this->context, $aimeos );
23
+		$this->object = new \Aimeos\Controller\Jobs\Subscription\Process\Begin\Standard($this->context, $aimeos);
24 24
 
25
-		\Aimeos\MShop\Factory::setCache( true );
25
+		\Aimeos\MShop\Factory::setCache(true);
26 26
 	}
27 27
 
28 28
 
29 29
 	protected function tearDown()
30 30
 	{
31
-		\Aimeos\MShop\Factory::setCache( false );
31
+		\Aimeos\MShop\Factory::setCache(false);
32 32
 		\Aimeos\MShop\Factory::clear();
33 33
 
34
-		unset( $this->object, $this->context );
34
+		unset($this->object, $this->context);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testGetName()
39 39
 	{
40
-		$this->assertEquals( 'Subscription process start', $this->object->getName() );
40
+		$this->assertEquals('Subscription process start', $this->object->getName());
41 41
 	}
42 42
 
43 43
 
44 44
 	public function testGetDescription()
45 45
 	{
46
-		$this->assertEquals( 'Process subscriptions initially', $this->object->getDescription() );
46
+		$this->assertEquals('Process subscriptions initially', $this->object->getDescription());
47 47
 	}
48 48
 
49 49
 
50 50
 	public function testRun()
51 51
 	{
52
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
52
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
53 53
 		$item = $this->getSubscription();
54 54
 
55
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
56
-			->setConstructorArgs( [$this->context] )
57
-			->setMethods( ['searchItems', 'saveItem'] )
55
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
56
+			->setConstructorArgs([$this->context])
57
+			->setMethods(['searchItems', 'saveItem'])
58 58
 			->getMock();
59 59
 
60
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
60
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
61 61
 
62
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
63
-			->will( $this->returnValue( [$item] ) );
62
+		$managerStub->expects($this->once())->method('searchItems')
63
+			->will($this->returnValue([$item]));
64 64
 
65
-		$managerStub->expects( $this->once() )->method( 'saveItem' );
65
+		$managerStub->expects($this->once())->method('saveItem');
66 66
 
67 67
 		$this->object->run();
68 68
 	}
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 
71 71
 	public function testRunException()
72 72
 	{
73
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processors', ['cgroup'] );
74
-		$this->context->getConfig()->set( 'controller/common/subscription/process/processor/cgroup/groupids', ['1'] );
73
+		$this->context->getConfig()->set('controller/common/subscription/process/processors', ['cgroup']);
74
+		$this->context->getConfig()->set('controller/common/subscription/process/processor/cgroup/groupids', ['1']);
75 75
 
76
-		$managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' )
77
-			->setConstructorArgs( [$this->context] )
78
-			->setMethods( ['searchItems', 'saveItem'] )
76
+		$managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard')
77
+			->setConstructorArgs([$this->context])
78
+			->setMethods(['searchItems', 'saveItem'])
79 79
 			->getMock();
80 80
 
81
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $managerStub );
81
+		\Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $managerStub);
82 82
 
83
-		$managerStub->expects( $this->once() )->method( 'searchItems' )
84
-			->will( $this->returnValue( [$managerStub->createItem()] ) );
83
+		$managerStub->expects($this->once())->method('searchItems')
84
+			->will($this->returnValue([$managerStub->createItem()]));
85 85
 
86
-		$managerStub->expects( $this->once() )->method( 'saveItem' )
87
-			->will( $this->throwException( new \Exception() ) );
86
+		$managerStub->expects($this->once())->method('saveItem')
87
+			->will($this->throwException(new \Exception()));
88 88
 
89 89
 		$this->object->run();
90 90
 	}
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 
93 93
 	protected function getSubscription()
94 94
 	{
95
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' );
95
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription');
96 96
 
97 97
 		$search = $manager->createSearch();
98
-		$search->setConditions( $search->compare( '==', 'subscription.dateend', '2010-01-01' ) );
98
+		$search->setConditions($search->compare('==', 'subscription.dateend', '2010-01-01'));
99 99
 
100
-		$items = $manager->searchItems( $search );
100
+		$items = $manager->searchItems($search);
101 101
 
102
-		if( ( $item = reset( $items ) ) !== false ) {
102
+		if (($item = reset($items)) !== false) {
103 103
 			return $item;
104 104
 		}
105 105
 
106
-		throw new \Exception( 'No subscription item found' );
106
+		throw new \Exception('No subscription item found');
107 107
 	}
108 108
 }
Please login to merge, or discard this patch.
tests/Controller/Common/Catalog/Import/Csv/Processor/Text/StandardTest.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -49,31 +49,31 @@  discard block
 block discarded – undo
49 49
 			4 => 1,
50 50
 		);
51 51
 
52
-		$catalog = $this->create( 'job_csv_test' );
52
+		$catalog = $this->create('job_csv_test');
53 53
 
54
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
55
-		$object->process( $catalog, $data );
54
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
55
+		$object->process($catalog, $data);
56 56
 
57 57
 
58 58
 		$listItems = $catalog->getListItems();
59
-		$listItem = reset( $listItems );
59
+		$listItem = reset($listItems);
60 60
 
61
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
62
-		$this->assertEquals( 1, count( $listItems ) );
61
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
62
+		$this->assertEquals(1, count($listItems));
63 63
 
64
-		$this->assertEquals( 1, $listItem->getStatus() );
65
-		$this->assertEquals( 0, $listItem->getPosition() );
66
-		$this->assertEquals( 'text', $listItem->getDomain() );
67
-		$this->assertEquals( 'default', $listItem->getType() );
64
+		$this->assertEquals(1, $listItem->getStatus());
65
+		$this->assertEquals(0, $listItem->getPosition());
66
+		$this->assertEquals('text', $listItem->getDomain());
67
+		$this->assertEquals('default', $listItem->getType());
68 68
 
69 69
 		$refItem = $listItem->getRefItem();
70 70
 
71
-		$this->assertEquals( 1, $refItem->getStatus() );
72
-		$this->assertEquals( 'name', $refItem->getType() );
73
-		$this->assertEquals( 'test text', $refItem->getLabel() );
74
-		$this->assertEquals( 'Job CSV test', $refItem->getContent() );
75
-		$this->assertEquals( 'de', $refItem->getLanguageId() );
76
-		$this->assertEquals( 1, $refItem->getStatus() );
71
+		$this->assertEquals(1, $refItem->getStatus());
72
+		$this->assertEquals('name', $refItem->getType());
73
+		$this->assertEquals('test text', $refItem->getLabel());
74
+		$this->assertEquals('Job CSV test', $refItem->getContent());
75
+		$this->assertEquals('de', $refItem->getLanguageId());
76
+		$this->assertEquals(1, $refItem->getStatus());
77 77
 	}
78 78
 
79 79
 
@@ -101,27 +101,27 @@  discard block
 block discarded – undo
101 101
 			7 => 'Long: Job CSV test 2',
102 102
 		);
103 103
 
104
-		$catalog = $this->create( 'job_csv_test' );
104
+		$catalog = $this->create('job_csv_test');
105 105
 
106
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
107
-		$object->process( $catalog, $data );
106
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
107
+		$object->process($catalog, $data);
108 108
 
109 109
 
110 110
 		$pos = 0;
111 111
 		$listItems = $catalog->getListItems();
112 112
 		$expected = array(
113
-			0 => array( 'name', 'Job CSV test' ),
114
-			1 => array( 'short', 'Short: Job CSV test' ),
115
-			2 => array( 'long', 'Long: Job CSV test' ),
116
-			3 => array( 'long', 'Long: Job CSV test 2' ),
113
+			0 => array('name', 'Job CSV test'),
114
+			1 => array('short', 'Short: Job CSV test'),
115
+			2 => array('long', 'Long: Job CSV test'),
116
+			3 => array('long', 'Long: Job CSV test 2'),
117 117
 		);
118 118
 
119
-		$this->assertEquals( 4, count( $listItems ) );
119
+		$this->assertEquals(4, count($listItems));
120 120
 
121
-		foreach( $listItems as $listItem )
121
+		foreach ($listItems as $listItem)
122 122
 		{
123
-			$this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() );
124
-			$this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() );
123
+			$this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType());
124
+			$this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent());
125 125
 			$pos++;
126 126
 		}
127 127
 	}
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 			1 => 'Short: Job CSV test',
145 145
 		);
146 146
 
147
-		$catalog = $this->create( 'job_csv_test' );
147
+		$catalog = $this->create('job_csv_test');
148 148
 
149
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
150
-		$object->process( $catalog, $data );
151
-		$object->process( $catalog, $dataUpdate );
149
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
150
+		$object->process($catalog, $data);
151
+		$object->process($catalog, $dataUpdate);
152 152
 
153 153
 
154 154
 		$listItems = $catalog->getListItems();
155
-		$listItem = reset( $listItems );
155
+		$listItem = reset($listItems);
156 156
 
157
-		$this->assertEquals( 1, count( $listItems ) );
158
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
157
+		$this->assertEquals(1, count($listItems));
158
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
159 159
 
160
-		$this->assertEquals( 'short', $listItem->getRefItem()->getType() );
161
-		$this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() );
160
+		$this->assertEquals('short', $listItem->getRefItem()->getType());
161
+		$this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent());
162 162
 	}
163 163
 
164 164
 
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 			1 => 'Job CSV test',
175 175
 		);
176 176
 
177
-		$catalog = $this->create( 'job_csv_test' );
177
+		$catalog = $this->create('job_csv_test');
178 178
 
179
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
180
-		$object->process( $catalog, $data );
179
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
180
+		$object->process($catalog, $data);
181 181
 
182
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint );
183
-		$object->process( $catalog, [] );
182
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint);
183
+		$object->process($catalog, []);
184 184
 
185 185
 
186 186
 		$listItems = $catalog->getListItems();
187 187
 
188
-		$this->assertEquals( 0, count( $listItems ) );
188
+		$this->assertEquals(0, count($listItems));
189 189
 	}
190 190
 
191 191
 
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 			3 => '',
206 206
 		);
207 207
 
208
-		$catalog = $this->create( 'job_csv_test' );
208
+		$catalog = $this->create('job_csv_test');
209 209
 
210
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
211
-		$object->process( $catalog, $data );
210
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
211
+		$object->process($catalog, $data);
212 212
 
213 213
 
214 214
 		$listItems = $catalog->getListItems();
215 215
 
216
-		$this->assertEquals( 1, count( $listItems ) );
216
+		$this->assertEquals(1, count($listItems));
217 217
 	}
218 218
 
219 219
 
@@ -237,35 +237,35 @@  discard block
 block discarded – undo
237 237
 			5 => 'default',
238 238
 		);
239 239
 
240
-		$this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/text/listtypes', array( 'default' ) );
240
+		$this->context->getConfig()->set('controller/common/catalog/import/csv/processor/text/listtypes', array('default'));
241 241
 
242
-		$catalog = $this->create( 'job_csv_test' );
242
+		$catalog = $this->create('job_csv_test');
243 243
 
244
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
245
-		$object->process( $catalog, $data );
244
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
245
+		$object->process($catalog, $data);
246 246
 
247 247
 
248 248
 		$listItems = $catalog->getListItems();
249
-		$listItem = reset( $listItems );
249
+		$listItem = reset($listItems);
250 250
 
251
-		$this->assertEquals( 1, count( $listItems ) );
252
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
251
+		$this->assertEquals(1, count($listItems));
252
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
253 253
 
254
-		$this->assertEquals( 'default', $listItem->getType() );
255
-		$this->assertEquals( 'short', $listItem->getRefItem()->getType() );
256
-		$this->assertEquals( 'test short', $listItem->getRefItem()->getContent() );
254
+		$this->assertEquals('default', $listItem->getType());
255
+		$this->assertEquals('short', $listItem->getRefItem()->getType());
256
+		$this->assertEquals('test short', $listItem->getRefItem()->getContent());
257 257
 	}
258 258
 
259 259
 
260 260
 	/**
261 261
 	 * @param string $code
262 262
 	 */
263
-	protected function create( $code )
263
+	protected function create($code)
264 264
 	{
265
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context );
265
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
266 266
 
267 267
 		$item = $manager->createItem();
268
-		$item->setCode( $code );
268
+		$item->setCode($code);
269 269
 
270 270
 		return $item;
271 271
 	}
Please login to merge, or discard this patch.
tests/Controller/Common/Catalog/Import/Csv/Processor/Media/StandardTest.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
 			5 => 1,
52 52
 		);
53 53
 
54
-		$catalog = $this->create( 'job_csv_test' );
54
+		$catalog = $this->create('job_csv_test');
55 55
 
56
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
57
-		$object->process( $catalog, $data );
56
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
57
+		$object->process($catalog, $data);
58 58
 
59 59
 
60 60
 		$listItems = $catalog->getListItems();
61
-		$listItem = reset( $listItems );
61
+		$listItem = reset($listItems);
62 62
 
63
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
64
-		$this->assertEquals( 1, count( $listItems ) );
63
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
64
+		$this->assertEquals(1, count($listItems));
65 65
 
66
-		$this->assertEquals( 1, $listItem->getStatus() );
67
-		$this->assertEquals( 0, $listItem->getPosition() );
68
-		$this->assertEquals( 'media', $listItem->getDomain() );
69
-		$this->assertEquals( 'default', $listItem->getType() );
66
+		$this->assertEquals(1, $listItem->getStatus());
67
+		$this->assertEquals(0, $listItem->getPosition());
68
+		$this->assertEquals('media', $listItem->getDomain());
69
+		$this->assertEquals('default', $listItem->getType());
70 70
 
71 71
 		$refItem = $listItem->getRefItem();
72 72
 
73
-		$this->assertEquals( 1, $refItem->getStatus() );
74
-		$this->assertEquals( 'default', $refItem->getType() );
75
-		$this->assertEquals( 'test image', $refItem->getLabel() );
76
-		$this->assertEquals( 'image/jpeg', $refItem->getMimetype() );
77
-		$this->assertEquals( 'path/to/preview', $refItem->getPreview() );
78
-		$this->assertEquals( 'path/to/file', $refItem->getUrl() );
79
-		$this->assertEquals( 'de', $refItem->getLanguageId() );
73
+		$this->assertEquals(1, $refItem->getStatus());
74
+		$this->assertEquals('default', $refItem->getType());
75
+		$this->assertEquals('test image', $refItem->getLabel());
76
+		$this->assertEquals('image/jpeg', $refItem->getMimetype());
77
+		$this->assertEquals('path/to/preview', $refItem->getPreview());
78
+		$this->assertEquals('path/to/file', $refItem->getUrl());
79
+		$this->assertEquals('de', $refItem->getLanguageId());
80 80
 	}
81 81
 
82 82
 
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 			0 => "path/to/0\npath/to/1\npath/to/2\npath/to/3",
91 91
 		);
92 92
 
93
-		$catalog = $this->create( 'job_csv_test' );
93
+		$catalog = $this->create('job_csv_test');
94 94
 
95
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
96
-		$object->process( $catalog, $data );
95
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
96
+		$object->process($catalog, $data);
97 97
 
98 98
 
99 99
 		$pos = 0;
100 100
 		$listItems = $catalog->getListItems();
101
-		$expected = array( 'path/to/0', 'path/to/1', 'path/to/2', 'path/to/3' );
101
+		$expected = array('path/to/0', 'path/to/1', 'path/to/2', 'path/to/3');
102 102
 
103
-		$this->assertEquals( 4, count( $listItems ) );
103
+		$this->assertEquals(4, count($listItems));
104 104
 
105
-		foreach( $listItems as $listItem )
105
+		foreach ($listItems as $listItem)
106 106
 		{
107
-			$this->assertEquals( $expected[$pos], $listItem->getRefItem()->getUrl() );
107
+			$this->assertEquals($expected[$pos], $listItem->getRefItem()->getUrl());
108 108
 			$pos++;
109 109
 		}
110 110
 	}
@@ -126,20 +126,20 @@  discard block
 block discarded – undo
126 126
 			3 => 'path/to/3',
127 127
 		);
128 128
 
129
-		$catalog = $this->create( 'job_csv_test' );
129
+		$catalog = $this->create('job_csv_test');
130 130
 
131
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
132
-		$object->process( $catalog, $data );
131
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
132
+		$object->process($catalog, $data);
133 133
 
134 134
 
135 135
 		$pos = 0;
136 136
 		$listItems = $catalog->getListItems();
137 137
 
138
-		$this->assertEquals( 4, count( $listItems ) );
138
+		$this->assertEquals(4, count($listItems));
139 139
 
140
-		foreach( $listItems as $listItem )
140
+		foreach ($listItems as $listItem)
141 141
 		{
142
-			$this->assertEquals( $data[$pos], $listItem->getRefItem()->getUrl() );
142
+			$this->assertEquals($data[$pos], $listItem->getRefItem()->getUrl());
143 143
 			$pos++;
144 144
 		}
145 145
 	}
@@ -162,21 +162,21 @@  discard block
 block discarded – undo
162 162
 			1 => '',
163 163
 		);
164 164
 
165
-		$catalog = $this->create( 'job_csv_test' );
165
+		$catalog = $this->create('job_csv_test');
166 166
 
167
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
168
-		$object->process( $catalog, $data );
169
-		$object->process( $catalog, $dataUpdate );
167
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
168
+		$object->process($catalog, $data);
169
+		$object->process($catalog, $dataUpdate);
170 170
 
171 171
 
172 172
 		$listItems = $catalog->getListItems();
173
-		$listItem = reset( $listItems );
173
+		$listItem = reset($listItems);
174 174
 
175
-		$this->assertEquals( 1, count( $listItems ) );
176
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
175
+		$this->assertEquals(1, count($listItems));
176
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
177 177
 
178
-		$this->assertEquals( 'path/to/new', $listItem->getRefItem()->getUrl() );
179
-		$this->assertEquals( null, $listItem->getRefItem()->getLanguageId() );
178
+		$this->assertEquals('path/to/new', $listItem->getRefItem()->getUrl());
179
+		$this->assertEquals(null, $listItem->getRefItem()->getLanguageId());
180 180
 	}
181 181
 
182 182
 
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
 			0 => '/path/to/file',
191 191
 		);
192 192
 
193
-		$catalog = $this->create( 'job_csv_test' );
193
+		$catalog = $this->create('job_csv_test');
194 194
 
195
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
196
-		$object->process( $catalog, $data );
195
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
196
+		$object->process($catalog, $data);
197 197
 
198
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, [], $this->endpoint );
199
-		$object->process( $catalog, [] );
198
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, [], $this->endpoint);
199
+		$object->process($catalog, []);
200 200
 
201 201
 
202 202
 		$listItems = $catalog->getListItems();
203 203
 
204
-		$this->assertEquals( 0, count( $listItems ) );
204
+		$this->assertEquals(0, count($listItems));
205 205
 	}
206 206
 
207 207
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 			1 => '',
218 218
 		);
219 219
 
220
-		$catalog = $this->create( 'job_csv_test' );
220
+		$catalog = $this->create('job_csv_test');
221 221
 
222
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
223
-		$object->process( $catalog, $data );
222
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
223
+		$object->process($catalog, $data);
224 224
 
225 225
 
226 226
 		$listItems = $catalog->getListItems();
227 227
 
228
-		$this->assertEquals( 1, count( $listItems ) );
228
+		$this->assertEquals(1, count($listItems));
229 229
 	}
230 230
 
231 231
 
@@ -245,34 +245,34 @@  discard block
 block discarded – undo
245 245
 			3 => 'default',
246 246
 		);
247 247
 
248
-		$this->context->getConfig()->set( 'controller/common/catalog/import/csv/processor/media/listtypes', array( 'default' ) );
248
+		$this->context->getConfig()->set('controller/common/catalog/import/csv/processor/media/listtypes', array('default'));
249 249
 
250
-		$catalog = $this->create( 'job_csv_test' );
250
+		$catalog = $this->create('job_csv_test');
251 251
 
252
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard( $this->context, $mapping, $this->endpoint );
253
-		$object->process( $catalog, $data );
252
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Media\Standard($this->context, $mapping, $this->endpoint);
253
+		$object->process($catalog, $data);
254 254
 
255 255
 
256 256
 		$listItems = $catalog->getListItems();
257
-		$listItem = reset( $listItems );
257
+		$listItem = reset($listItems);
258 258
 
259
-		$this->assertEquals( 1, count( $listItems ) );
260
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
259
+		$this->assertEquals(1, count($listItems));
260
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
261 261
 
262
-		$this->assertEquals( 'default', $listItem->getType() );
263
-		$this->assertEquals( 'path/to/file2', $listItem->getRefItem()->getUrl() );
262
+		$this->assertEquals('default', $listItem->getType());
263
+		$this->assertEquals('path/to/file2', $listItem->getRefItem()->getUrl());
264 264
 	}
265 265
 
266 266
 
267 267
 	/**
268 268
 	 * @param string $code
269 269
 	 */
270
-	protected function create( $code )
270
+	protected function create($code)
271 271
 	{
272
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context );
272
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
273 273
 
274 274
 		$item = $manager->createItem();
275
-		$item->setCode( $code );
275
+		$item->setCode($code);
276 276
 
277 277
 		return $item;
278 278
 	}
Please login to merge, or discard this patch.
controller/jobs/src/Controller/Jobs/Catalog/Import/Csv/Standard.php 1 patch
Spacing   +89 added lines, -89 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', 'Catalog import CSV' );
31
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Catalog 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 categories from CSV files' );
42
+		return $this->getContext()->getI18n()->dt('controller/jobs', 'Imports new and updates existing categories 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( 'media', 'text' );
57
+		$domains = array('media', 'text');
58 58
 		$mappings = $this->getDefaultMapping();
59 59
 
60 60
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		 * @see controller/common/catalog/import/csv/converter
75 75
 		 * @see controller/common/catalog/import/csv/max-size
76 76
 		 */
77
-		$domains = $config->get( 'controller/common/catalog/import/csv/domains', $domains );
77
+		$domains = $config->get('controller/common/catalog/import/csv/domains', $domains);
78 78
 
79 79
 		/** controller/jobs/catalog/import/csv/domains
80 80
 		 * List of item domain names that should be retrieved along with the catalog items
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 * @see controller/jobs/catalog/import/csv/backup
95 95
 		 * @see controller/common/catalog/import/csv/max-size
96 96
 		 */
97
-		$domains = $config->get( 'controller/jobs/catalog/import/csv/domains', $domains );
97
+		$domains = $config->get('controller/jobs/catalog/import/csv/domains', $domains);
98 98
 
99 99
 
100 100
 		/** controller/common/catalog/import/csv/mapping
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		 * @see controller/common/catalog/import/csv/converter
123 123
 		 * @see controller/common/catalog/import/csv/max-size
124 124
 		 */
125
-		$mappings = $config->get( 'controller/common/catalog/import/csv/mapping', $mappings );
125
+		$mappings = $config->get('controller/common/catalog/import/csv/mapping', $mappings);
126 126
 
127 127
 		/** controller/jobs/catalog/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/catalog/import/csv/backup
143 143
 		 * @see controller/common/catalog/import/csv/max-size
144 144
 		 */
145
-		$mappings = $config->get( 'controller/jobs/catalog/import/csv/mapping', $mappings );
145
+		$mappings = $config->get('controller/jobs/catalog/import/csv/mapping', $mappings);
146 146
 
147 147
 
148 148
 		/** controller/common/catalog/import/csv/converter
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		 * @see controller/common/catalog/import/csv/mapping
185 185
 		 * @see controller/common/catalog/import/csv/max-size
186 186
 		 */
187
-		$converters = $config->get( 'controller/common/catalog/import/csv/converter', [] );
187
+		$converters = $config->get('controller/common/catalog/import/csv/converter', []);
188 188
 
189 189
 		/** controller/jobs/catalog/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/catalog/import/csv/backup
205 205
 		 * @see controller/common/catalog/import/csv/max-size
206 206
 		 */
207
-		$converters = $config->get( 'controller/jobs/catalog/import/csv/converter', $converters );
207
+		$converters = $config->get('controller/jobs/catalog/import/csv/converter', $converters);
208 208
 
209 209
 
210 210
 		/** controller/common/catalog/import/csv/max-size
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		 * @see controller/common/catalog/import/csv/mapping
225 225
 		 * @see controller/common/catalog/import/csv/converter
226 226
 		 */
227
-		$maxcnt = (int) $config->get( 'controller/common/catalog/import/csv/max-size', 1000 );
227
+		$maxcnt = (int) $config->get('controller/common/catalog/import/csv/max-size', 1000);
228 228
 
229 229
 
230 230
 		/** controller/jobs/catalog/import/csv/skip-lines
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		 * @see controller/jobs/catalog/import/csv/backup
247 247
 		 * @see controller/common/catalog/import/csv/max-size
248 248
 		 */
249
-		$skiplines = (int) $config->get( 'controller/jobs/catalog/import/csv/skip-lines', 0 );
249
+		$skiplines = (int) $config->get('controller/jobs/catalog/import/csv/skip-lines', 0);
250 250
 
251 251
 
252 252
 		/** controller/jobs/catalog/import/csv/strict
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		 * @see controller/jobs/catalog/import/csv/backup
271 271
 		 * @see controller/common/catalog/import/csv/max-size
272 272
 		 */
273
-		$strict = (bool) $config->get( 'controller/jobs/catalog/import/csv/strict', true );
273
+		$strict = (bool) $config->get('controller/jobs/catalog/import/csv/strict', true);
274 274
 
275 275
 
276 276
 		/** controller/jobs/catalog/import/csv/backup
@@ -303,75 +303,75 @@  discard block
 block discarded – undo
303 303
 		 * @see controller/jobs/catalog/import/csv/strict
304 304
 		 * @see controller/common/catalog/import/csv/max-size
305 305
 		 */
306
-		$backup = $config->get( 'controller/jobs/catalog/import/csv/backup' );
306
+		$backup = $config->get('controller/jobs/catalog/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 );
323
-			$catalogMap = $this->getCatalogMap( $domains );
320
+			$codePos = $this->getCodePosition($mappings['item']);
321
+			$convlist = $this->getConverterList($converters);
322
+			$processor = $this->getProcessors($procMappings);
323
+			$catalogMap = $this->getCatalogMap($domains);
324 324
 			$container = $this->getContainer();
325 325
 			$path = $container->getName();
326 326
 
327 327
 
328
-			$msg = sprintf( 'Started catalog import from "%1$s" (%2$s)', $path, __CLASS__ );
329
-			$logger->log( $msg, \Aimeos\MW\Logger\Base::NOTICE );
328
+			$msg = sprintf('Started catalog import from "%1$s" (%2$s)', $path, __CLASS__);
329
+			$logger->log($msg, \Aimeos\MW\Logger\Base::NOTICE);
330 330
 
331
-			foreach( $container as $content )
331
+			foreach ($container as $content)
332 332
 			{
333 333
 				$name = $content->getName();
334 334
 
335
-				for( $i = 0; $i < $skiplines; $i++ ) {
335
+				for ($i = 0; $i < $skiplines; $i++) {
336 336
 					$content->next();
337 337
 				}
338 338
 
339
-				while( ( $data = $this->getData( $content, $maxcnt, $codePos ) ) !== [] )
339
+				while (($data = $this->getData($content, $maxcnt, $codePos)) !== [])
340 340
 				{
341
-					$data = $this->convertData( $convlist, $data );
342
-					$errcnt = $this->import( $catalogMap, $data, $mappings['item'], $processor, $strict );
343
-					$chunkcnt = count( $data );
341
+					$data = $this->convertData($convlist, $data);
342
+					$errcnt = $this->import($catalogMap, $data, $mappings['item'], $processor, $strict);
343
+					$chunkcnt = count($data);
344 344
 
345 345
 					$msg = 'Imported catalog lines from "%1$s": %2$d/%3$d (%4$s)';
346
-					$logger->log( sprintf( $msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
346
+					$logger->log(sprintf($msg, $name, $chunkcnt - $errcnt, $chunkcnt, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
347 347
 
348 348
 					$errors += $errcnt;
349 349
 					$total += $chunkcnt;
350
-					unset( $data );
350
+					unset($data);
351 351
 				}
352 352
 			}
353 353
 
354 354
 			$container->close();
355 355
 		}
356
-		catch( \Exception $e )
356
+		catch (\Exception $e)
357 357
 		{
358
-			$logger->log( 'Catalog import error: ' . $e->getMessage() );
359
-			$logger->log( $e->getTraceAsString() );
358
+			$logger->log('Catalog import error: ' . $e->getMessage());
359
+			$logger->log($e->getTraceAsString());
360 360
 
361
-			throw new \Aimeos\Controller\Jobs\Exception( $e->getMessage() );
361
+			throw new \Aimeos\Controller\Jobs\Exception($e->getMessage());
362 362
 		}
363 363
 
364 364
 		$msg = 'Finished catalog import from "%1$s": %2$d successful, %3$s errors, %4$s total (%5$s)';
365
-		$logger->log( sprintf( $msg, $path, $total - $errors, $errors, $total, __CLASS__ ), \Aimeos\MW\Logger\Base::NOTICE );
365
+		$logger->log(sprintf($msg, $path, $total - $errors, $errors, $total, __CLASS__), \Aimeos\MW\Logger\Base::NOTICE);
366 366
 
367
-		if( $errors > 0 )
367
+		if ($errors > 0)
368 368
 		{
369
-			$msg = sprintf( 'Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total );
370
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
369
+			$msg = sprintf('Invalid catalog lines in "%1$s": %2$d/%3$d', $path, $errors, $total);
370
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
371 371
 		}
372 372
 
373
-		if( !empty( $backup ) && @rename( $path, strftime( $backup ) ) === false ) {
374
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Unable to move imported file' ) );
373
+		if (!empty($backup) && @rename($path, strftime($backup)) === false) {
374
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Unable to move imported file'));
375 375
 		}
376 376
 	}
377 377
 
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 	 * @return integer Position of the "catalog.code" column
384 384
 	 * @throws \Aimeos\Controller\Jobs\Exception If no mapping for "catalog.code" is found
385 385
 	 */
386
-	protected function getCodePosition( array $mapping )
386
+	protected function getCodePosition(array $mapping)
387 387
 	{
388
-		foreach( $mapping as $pos => $key )
388
+		foreach ($mapping as $pos => $key)
389 389
 		{
390
-			if( $key === 'catalog.code' ) {
390
+			if ($key === 'catalog.code') {
391 391
 				return $pos;
392 392
 			}
393 393
 		}
394 394
 
395
-		throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'No "catalog.code" column in CSV mapping found' ) );
395
+		throw new \Aimeos\Controller\Jobs\Exception(sprintf('No "catalog.code" column in CSV mapping found'));
396 396
 	}
397 397
 
398 398
 
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		 * @see controller/jobs/catalog/import/csv/container/content
428 428
 		 * @see controller/jobs/catalog/import/csv/container/options
429 429
 		 */
430
-		$location = $config->get( 'controller/jobs/catalog/import/csv/location' );
430
+		$location = $config->get('controller/jobs/catalog/import/csv/location');
431 431
 
432 432
 		/** controller/jobs/catalog/import/csv/container/type
433 433
 		 * Nave of the container type to read the data from
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		 * @see controller/jobs/catalog/import/csv/container/content
451 451
 		 * @see controller/jobs/catalog/import/csv/container/options
452 452
 		 */
453
-		$container = $config->get( 'controller/jobs/catalog/import/csv/container/type', 'Directory' );
453
+		$container = $config->get('controller/jobs/catalog/import/csv/container/type', 'Directory');
454 454
 
455 455
 		/** controller/jobs/catalog/import/csv/container/content
456 456
 		 * Name of the content type inside the container to read the data from
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 		 * @see controller/jobs/catalog/import/csv/container/type
472 472
 		 * @see controller/jobs/catalog/import/csv/container/options
473 473
 		 */
474
-		$content = $config->get( 'controller/jobs/catalog/import/csv/container/content', 'CSV' );
474
+		$content = $config->get('controller/jobs/catalog/import/csv/container/content', 'CSV');
475 475
 
476 476
 		/** controller/jobs/catalog/import/csv/container/options
477 477
 		 * List of file container options for the catalog import files
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 		 * @see controller/jobs/catalog/import/csv/container/content
490 490
 		 * @see controller/jobs/catalog/import/csv/container/type
491 491
 		 */
492
-		$options = $config->get( 'controller/jobs/catalog/import/csv/container/options', [] );
492
+		$options = $config->get('controller/jobs/catalog/import/csv/container/options', []);
493 493
 
494
-		if( $location === null )
494
+		if ($location === null)
495 495
 		{
496
-			$msg = sprintf( 'Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location' );
497
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
496
+			$msg = sprintf('Required configuration for "%1$s" is missing', 'controller/jobs/catalog/import/csv/location');
497
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
498 498
 		}
499 499
 
500
-		return \Aimeos\MW\Container\Factory::getContainer( $location, $container, $content, $options );
500
+		return \Aimeos\MW\Container\Factory::getContainer($location, $container, $content, $options);
501 501
 	}
502 502
 
503 503
 
@@ -507,13 +507,13 @@  discard block
 block discarded – undo
507 507
 	 * @param array $domains List of domain names whose items should be fetched too
508 508
 	 * @return array Associative list of catalog codes as keys and items implementing \Aimeos\MShop\Catalog\Item\Iface as values
509 509
 	 */
510
-	protected function getCatalogMap( array $domains )
510
+	protected function getCatalogMap(array $domains)
511 511
 	{
512 512
 		$map = [];
513
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' );
514
-		$search = $manager->createSearch()->setSlice( 0, 0x7fffffff );
513
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
514
+		$search = $manager->createSearch()->setSlice(0, 0x7fffffff);
515 515
 
516
-		foreach( $manager->searchItems( $search, $domains ) as $item ) {
516
+		foreach ($manager->searchItems($search, $domains) as $item) {
517 517
 			$map[$item->getCode()] = $item;
518 518
 		}
519 519
 
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
 	 * @param string $code Catalog item code of the parent category
530 530
 	 * @return string|null ID of the parent category or null for top level nodes
531 531
 	 */
532
-	protected function getParentId( array $catalogMap, array $map, $code )
532
+	protected function getParentId(array $catalogMap, array $map, $code)
533 533
 	{
534
-		if( !isset( $map['catalog.parent'] ) )
534
+		if (!isset($map['catalog.parent']))
535 535
 		{
536
-			$msg = sprintf( 'Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code );
537
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
536
+			$msg = sprintf('Required column "%1$s" not found for code "%2$s"', 'catalog.parent', $code);
537
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
538 538
 		}
539 539
 
540
-		$parent = trim( $map['catalog.parent'] );
540
+		$parent = trim($map['catalog.parent']);
541 541
 
542
-		if( $parent != '' && !isset( $catalogMap[$parent] ) )
542
+		if ($parent != '' && !isset($catalogMap[$parent]))
543 543
 		{
544
-			$msg = sprintf( 'Parent node for code "%1$s" not found', $parent );
545
-			throw new \Aimeos\Controller\Jobs\Exception( $msg );
544
+			$msg = sprintf('Parent node for code "%1$s" not found', $parent);
545
+			throw new \Aimeos\Controller\Jobs\Exception($msg);
546 546
 		}
547 547
 
548
-		return ( $parent != '' ? $catalogMap[$parent]->getId() : null );
548
+		return ($parent != '' ? $catalogMap[$parent]->getId() : null);
549 549
 	}
550 550
 
551 551
 
@@ -560,65 +560,65 @@  discard block
 block discarded – undo
560 560
 	 * @return integer Number of catalogs that couldn't be imported
561 561
 	 * @throws \Aimeos\Controller\Jobs\Exception
562 562
 	 */
563
-	protected function import( array &$catalogMap, array $data, array $mapping,
564
-		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict )
563
+	protected function import(array &$catalogMap, array $data, array $mapping,
564
+		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $processor, $strict)
565 565
 	{
566 566
 		$errors = 0;
567 567
 		$context = $this->getContext();
568
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' );
568
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'catalog');
569 569
 
570
-		foreach( $data as $code => $list )
570
+		foreach ($data as $code => $list)
571 571
 		{
572 572
 			$manager->begin();
573 573
 
574 574
 			try
575 575
 			{
576
-				$code = trim( $code );
576
+				$code = trim($code);
577 577
 
578
-				if( isset( $catalogMap[$code] )  ) {
578
+				if (isset($catalogMap[$code])) {
579 579
 					$catalogItem = $catalogMap[$code];
580 580
 				} else {
581 581
 					$catalogItem = $manager->createItem();
582 582
 				}
583 583
 
584
-				$map = $this->getMappedChunk( $list, $mapping );
584
+				$map = $this->getMappedChunk($list, $mapping);
585 585
 
586
-				if( isset( $map[0] ) )
586
+				if (isset($map[0]))
587 587
 				{
588 588
 					$map = $map[0]; // there can only be one chunk for the base catalog data
589
-					$parentid = $this->getParentId( $catalogMap, $map, $code );
590
-					$catalogItem->fromArray( $this->addItemDefaults( $map ) );
589
+					$parentid = $this->getParentId($catalogMap, $map, $code);
590
+					$catalogItem->fromArray($this->addItemDefaults($map));
591 591
 
592
-					if( isset( $catalogMap[$code] ) )
592
+					if (isset($catalogMap[$code]))
593 593
 					{
594
-						$manager->moveItem( $catalogItem->getId(), $catalogItem->getParentId(), $parentid );
595
-						$catalogItem = $manager->saveItem( $catalogItem );
594
+						$manager->moveItem($catalogItem->getId(), $catalogItem->getParentId(), $parentid);
595
+						$catalogItem = $manager->saveItem($catalogItem);
596 596
 					}
597 597
 					else
598 598
 					{
599
-						$catalogItem = $manager->insertItem( $catalogItem, $parentid );
599
+						$catalogItem = $manager->insertItem($catalogItem, $parentid);
600 600
 					}
601 601
 
602
-					$list = $processor->process( $catalogItem, $list );
602
+					$list = $processor->process($catalogItem, $list);
603 603
 					$catalogMap[$code] = $catalogItem;
604 604
 
605
-					$manager->saveItem( $catalogItem );
605
+					$manager->saveItem($catalogItem);
606 606
 				}
607 607
 
608 608
 				$manager->commit();
609 609
 			}
610
-			catch( \Exception $e )
610
+			catch (\Exception $e)
611 611
 			{
612 612
 				$manager->rollback();
613 613
 
614
-				$msg = sprintf( 'Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage() );
615
-				$context->getLogger()->log( $msg );
614
+				$msg = sprintf('Unable to import catalog with code "%1$s": %2$s', $code, $e->getMessage());
615
+				$context->getLogger()->log($msg);
616 616
 
617 617
 				$errors++;
618 618
 			}
619 619
 
620
-			if( $strict && !empty( $list ) ) {
621
-				$context->getLogger()->log( 'Not imported: ' . print_r( $list, true ) );
620
+			if ($strict && !empty($list)) {
621
+				$context->getLogger()->log('Not imported: ' . print_r($list, true));
622 622
 			}
623 623
 		}
624 624
 
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 	 * @param array $list Associative list of domain item keys and their values, e.g. "catalog.status" => 1
633 633
 	 * @return array Given associative list enriched by default values if they were not already set
634 634
 	 */
635
-	protected function addItemDefaults( array $list )
635
+	protected function addItemDefaults(array $list)
636 636
 	{
637
-		if( !isset( $list['catalog.status'] ) ) {
637
+		if (!isset($list['catalog.status'])) {
638 638
 			$list['catalog.status'] = 1;
639 639
 		}
640 640
 
Please login to merge, or discard this patch.
common/src/Controller/Common/Catalog/Import/Csv/Processor/Text/Standard.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
43 43
 	 * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor
44 44
 	 */
45
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
-			\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null )
45
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
46
+			\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null)
47 47
 	{
48
-		parent::__construct( $context, $mapping, $object );
48
+		parent::__construct($context, $mapping, $object);
49 49
 
50 50
 		/** controller/common/catalog/import/csv/processor/text/listtypes
51 51
 		 * Names of the catalog list types for texts that are updated or removed
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 * @see controller/common/catalog/import/csv/processor/price/listtypes
67 67
 		 * @see controller/common/catalog/import/csv/processor/catalog/listtypes
68 68
 		 */
69
-		$this->listTypes = $context->getConfig()->get( 'controller/common/catalog/import/csv/processor/text/listtypes' );
69
+		$this->listTypes = $context->getConfig()->get('controller/common/catalog/import/csv/processor/text/listtypes');
70 70
 	}
71 71
 
72 72
 
@@ -77,53 +77,53 @@  discard block
 block discarded – undo
77 77
 	 * @param array $data List of CSV fields with position as key and data as value
78 78
 	 * @return array List of data which hasn't been imported
79 79
 	 */
80
-	public function process( \Aimeos\MShop\Catalog\Item\Iface $catalog, array $data )
80
+	public function process(\Aimeos\MShop\Catalog\Item\Iface $catalog, array $data)
81 81
 	{
82
-		$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
83
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text' );
82
+		$listManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
83
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text');
84 84
 
85 85
 		$listMap = [];
86
-		$map = $this->getMappedChunk( $data, $this->getMapping() );
87
-		$listItems = $catalog->getListItems( 'text', $this->listTypes );
86
+		$map = $this->getMappedChunk($data, $this->getMapping());
87
+		$listItems = $catalog->getListItems('text', $this->listTypes);
88 88
 
89
-		foreach( $listItems as $listItem )
89
+		foreach ($listItems as $listItem)
90 90
 		{
91
-			if( ( $refItem = $listItem->getRefItem() ) !== null ) {
92
-				$listMap[ $refItem->getContent() ][ $refItem->getType() ][ $listItem->getType() ] = $listItem;
91
+			if (($refItem = $listItem->getRefItem()) !== null) {
92
+				$listMap[$refItem->getContent()][$refItem->getType()][$listItem->getType()] = $listItem;
93 93
 			}
94 94
 		}
95 95
 
96
-		foreach( $map as $pos => $list )
96
+		foreach ($map as $pos => $list)
97 97
 		{
98
-			if( $this->checkEntry( $list ) === false ) {
98
+			if ($this->checkEntry($list) === false) {
99 99
 				continue;
100 100
 			}
101 101
 
102
-			$content = trim( $list['text.content'] );
103
-			$type = trim( isset( $list['text.type'] ) ? $list['text.type'] : 'name' );
104
-			$typecode = trim( isset( $list['catalog.lists.type'] ) ? $list['catalog.lists.type'] : 'default' );
102
+			$content = trim($list['text.content']);
103
+			$type = trim(isset($list['text.type']) ? $list['text.type'] : 'name');
104
+			$typecode = trim(isset($list['catalog.lists.type']) ? $list['catalog.lists.type'] : 'default');
105 105
 
106
-			if( isset( $listMap[$content][$type][$typecode] ) )
106
+			if (isset($listMap[$content][$type][$typecode]))
107 107
 			{
108 108
 				$listItem = $listMap[$content][$type][$typecode];
109 109
 				$refItem = $listItem->getRefItem();
110
-				unset( $listItems[ $listItem->getId() ] );
110
+				unset($listItems[$listItem->getId()]);
111 111
 			}
112 112
 			else
113 113
 			{
114
-				$listItem = $listManager->createItem( $typecode, 'text' );
115
-				$refItem = $manager->createItem( $type, 'catalog' );
114
+				$listItem = $listManager->createItem($typecode, 'text');
115
+				$refItem = $manager->createItem($type, 'catalog');
116 116
 			}
117 117
 
118
-			$refItem->fromArray( $this->addItemDefaults( $list ) );
119
-			$listItem->fromArray( $this->addListItemDefaults( $list, $pos ) );
118
+			$refItem->fromArray($this->addItemDefaults($list));
119
+			$listItem->fromArray($this->addListItemDefaults($list, $pos));
120 120
 
121
-			$catalog->addListItem( 'text', $listItem, $refItem );
121
+			$catalog->addListItem('text', $listItem, $refItem);
122 122
 		}
123 123
 
124
-		$catalog->deleteListItems( $listItems, true );
124
+		$catalog->deleteListItems($listItems, true);
125 125
 
126
-		return $this->getObject()->process( $catalog, $data );
126
+		return $this->getObject()->process($catalog, $data);
127 127
 	}
128 128
 
129 129
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @param array $list Associative list of domain item keys and their values, e.g. "text.status" => 1
134 134
 	 * @return array Given associative list enriched by default values if they were not already set
135 135
 	 */
136
-	protected function addItemDefaults( array $list )
136
+	protected function addItemDefaults(array $list)
137 137
 	{
138
-		if( !isset( $list['text.label'] ) ) {
139
-			$list['text.label'] = mb_strcut( trim( $list['text.content'] ), 0, 255 );
138
+		if (!isset($list['text.label'])) {
139
+			$list['text.label'] = mb_strcut(trim($list['text.content']), 0, 255);
140 140
 		}
141 141
 
142
-		if( !isset( $list['text.status'] ) ) {
142
+		if (!isset($list['text.status'])) {
143 143
 			$list['text.status'] = 1;
144 144
 		}
145 145
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 * @param array $list Associative list of key/value pairs from the mapping
154 154
 	 * @return boolean True if valid, false if not
155 155
 	 */
156
-	protected function checkEntry( array $list )
156
+	protected function checkEntry(array $list)
157 157
 	{
158
-		if( !isset( $list['text.content'] ) || trim( $list['text.content'] ) === '' || isset( $list['catalog.lists.type'] )
159
-			&& $this->listTypes !== null && !in_array( trim( $list['catalog.lists.type'] ), (array) $this->listTypes )
158
+		if (!isset($list['text.content']) || trim($list['text.content']) === '' || isset($list['catalog.lists.type'])
159
+			&& $this->listTypes !== null && !in_array(trim($list['catalog.lists.type']), (array) $this->listTypes)
160 160
 		) {
161 161
 			return false;
162 162
 		}
Please login to merge, or discard this patch.