Completed
Push — master ( 0b1729...545b8f )
by Aimeos
01:57
created
src/Controller/Common/Product/Import/Csv/Cache/Attribute/Standard.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
42 42
 	 */
43
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
43
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
44 44
 	{
45
-		parent::__construct( $context );
45
+		parent::__construct($context);
46 46
 
47
-		$manager = \Aimeos\MShop::create( $context, 'attribute' );
48
-		$result = $manager->searchItems( $manager->createSearch() );
47
+		$manager = \Aimeos\MShop::create($context, 'attribute');
48
+		$result = $manager->searchItems($manager->createSearch());
49 49
 
50
-		foreach( $result as $id => $item ) {
51
-			$this->attributes[ $item->getCode() ][ $item->getType() ] = $item;
50
+		foreach ($result as $id => $item) {
51
+			$this->attributes[$item->getCode()][$item->getType()] = $item;
52 52
 		}
53 53
 	}
54 54
 
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 	 * @param string|null $type Attribute type
61 61
 	 * @return \Aimeos\MShop\Attribute\Item\Iface|null Attribute object or null if not found
62 62
 	 */
63
-	public function get( $code, $type = null )
63
+	public function get($code, $type = null)
64 64
 	{
65
-		if( isset( $this->attributes[$code] ) && isset( $this->attributes[$code][$type] ) ) {
65
+		if (isset($this->attributes[$code]) && isset($this->attributes[$code][$type])) {
66 66
 			return $this->attributes[$code][$type];
67 67
 		}
68 68
 
69
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'attribute' );
69
+		$manager = \Aimeos\MShop::create($this->getContext(), 'attribute');
70 70
 
71 71
 		$search = $manager->createSearch();
72 72
 		$expr = array(
73
-			$search->compare( '==', 'attribute.code', $code ),
74
-			$search->compare( '==', 'attribute.type', $type ),
73
+			$search->compare('==', 'attribute.code', $code),
74
+			$search->compare('==', 'attribute.type', $type),
75 75
 		);
76
-		$search->setConditions( $search->combine( '&&', $expr ) );
76
+		$search->setConditions($search->combine('&&', $expr));
77 77
 
78
-		$result = $manager->searchItems( $search );
78
+		$result = $manager->searchItems($search);
79 79
 
80
-		if( ( $item = reset( $result ) ) !== false )
80
+		if (($item = reset($result)) !== false)
81 81
 		{
82 82
 			$this->attributes[$code][$type] = $item;
83 83
 			return $item;
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param \Aimeos\MShop\Common\Item\Iface $item Attribute object
92 92
 	 */
93
-	public function set( \Aimeos\MShop\Common\Item\Iface $item )
93
+	public function set(\Aimeos\MShop\Common\Item\Iface $item)
94 94
 	{
95 95
 		$code = $item->getCode();
96 96
 
97
-		if( !isset( $this->attributes[$code] ) || !is_array( $this->attributes[$code] ) ) {
97
+		if (!isset($this->attributes[$code]) || !is_array($this->attributes[$code])) {
98 98
 			$this->attributes[$code] = [];
99 99
 		}
100 100
 
101
-		$this->attributes[$code][ $item->getType() ] = $item;
101
+		$this->attributes[$code][$item->getType()] = $item;
102 102
 	}
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Product/Import/Csv/Base.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 	 * @param array $data Associative list of product codes and lists of CSV field indexes and their data
28 28
 	 * @return array Associative list of CSV field indexes and their converted data
29 29
 	 */
30
-	protected function convertData( array $convlist, array $data )
30
+	protected function convertData(array $convlist, array $data)
31 31
 	{
32
-		foreach( $convlist as $idx => $converter )
32
+		foreach ($convlist as $idx => $converter)
33 33
 		{
34
-			foreach( $data as $code => $list )
34
+			foreach ($data as $code => $list)
35 35
 			{
36
-				if( isset( $list[$idx] ) ) {
37
-					$data[$code][$idx] = $converter->translate( $list[$idx] );
36
+				if (isset($list[$idx])) {
37
+					$data[$code][$idx] = $converter->translate($list[$idx]);
38 38
 				}
39 39
 			}
40 40
 		}
@@ -50,36 +50,36 @@  discard block
 block discarded – undo
50 50
 	 * @param string|null Name of the cache implementation
51 51
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Cache\Iface Cache object
52 52
 	 */
53
-	protected function getCache( $type, $name = null )
53
+	protected function getCache($type, $name = null)
54 54
 	{
55 55
 		$context = $this->getContext();
56 56
 		$config = $context->getConfig();
57 57
 
58
-		if( ctype_alnum( $type ) === false )
58
+		if (ctype_alnum($type) === false)
59 59
 		{
60 60
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type : '<not a string>';
61
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
61
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
62 62
 		}
63 63
 
64
-		if( $name === null ) {
65
-			$name = $config->get( 'controller/common/product/import/csv/cache/' . $type . '/name', 'Standard' );
64
+		if ($name === null) {
65
+			$name = $config->get('controller/common/product/import/csv/cache/' . $type . '/name', 'Standard');
66 66
 		}
67 67
 
68
-		if( ctype_alnum( $name ) === false )
68
+		if (ctype_alnum($name) === false)
69 69
 		{
70 70
 			$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . $type . '\\' . $name : '<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
-		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name;
74
+		$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\' . ucfirst($type) . '\\' . $name;
75 75
 
76
-		if( class_exists( $classname ) === false ) {
77
-			throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
76
+		if (class_exists($classname) === false) {
77
+			throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
78 78
 		}
79 79
 
80
-		$object = new $classname( $context );
80
+		$object = new $classname($context);
81 81
 
82
-		\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object );
82
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Cache\\Iface', $object);
83 83
 
84 84
 		return $object;
85 85
 	}
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 	 * @param array $convmap List of converter names for the values at the position in the CSV file
92 92
 	 * @return array Associative list of positions and converter objects
93 93
 	 */
94
-	protected function getConverterList( array $convmap )
94
+	protected function getConverterList(array $convmap)
95 95
 	{
96 96
 		$convlist = [];
97 97
 
98
-		foreach( $convmap as $idx => $name ) {
99
-			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter( $name );
98
+		foreach ($convmap as $idx => $name) {
99
+			$convlist[$idx] = \Aimeos\MW\Convert\Factory::createConverter($name);
100 100
 		}
101 101
 
102 102
 		return $convlist;
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @param integer $codePos Column position which contains the unique product code (starting from 0)
112 112
 	 * @return array List of arrays with product codes as keys and list of values from the CSV file
113 113
 	 */
114
-	protected function getData( \Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos )
114
+	protected function getData(\Aimeos\MW\Container\Content\Iface $content, $maxcnt, $codePos)
115 115
 	{
116 116
 		$count = 0;
117 117
 		$data = [];
118 118
 
119
-		while( $content->valid() && $count++ < $maxcnt )
119
+		while ($content->valid() && $count++ < $maxcnt)
120 120
 		{
121 121
 			$row = $content->current();
122
-			$data[ $row[$codePos] ] = $row;
122
+			$data[$row[$codePos]] = $row;
123 123
 			$content->next();
124 124
 		}
125 125
 
@@ -218,21 +218,21 @@  discard block
 block discarded – undo
218 218
 	 * @param array $mapping List of domain item keys with the CSV field position as key
219 219
 	 * @return array List of associative arrays containing the chunked properties
220 220
 	 */
221
-	protected function getMappedChunk( array &$data, array $mapping )
221
+	protected function getMappedChunk(array &$data, array $mapping)
222 222
 	{
223 223
 		$idx = 0;
224 224
 		$map = [];
225 225
 
226
-		foreach( $mapping as $pos => $key )
226
+		foreach ($mapping as $pos => $key)
227 227
 		{
228
-			if( isset( $map[$idx][$key] ) ) {
228
+			if (isset($map[$idx][$key])) {
229 229
 				$idx++;
230 230
 			}
231 231
 
232
-			if( isset( $data[$pos] ) )
232
+			if (isset($data[$pos]))
233 233
 			{
234 234
 				$map[$idx][$key] = $data[$pos];
235
-				unset( $data[$pos] );
235
+				unset($data[$pos]);
236 236
 			}
237 237
 		}
238 238
 
@@ -246,37 +246,37 @@  discard block
 block discarded – undo
246 246
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
247 247
 	 * @return \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface Processor object
248 248
 	 */
249
-	protected function getProcessors( array $mappings )
249
+	protected function getProcessors(array $mappings)
250 250
 	{
251 251
 		$context = $this->getContext();
252 252
 		$config = $context->getConfig();
253
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $context, [] );
253
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($context, []);
254 254
 
255
-		foreach( $mappings as $type => $mapping )
255
+		foreach ($mappings as $type => $mapping)
256 256
 		{
257
-			if( ctype_alnum( $type ) === false )
257
+			if (ctype_alnum($type) === false)
258 258
 			{
259 259
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type : '<not a string>';
260
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
260
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
261 261
 			}
262 262
 
263
-			$name = $config->get( 'controller/common/product/import/csv/processor/' . $type . '/name', 'Standard' );
263
+			$name = $config->get('controller/common/product/import/csv/processor/' . $type . '/name', 'Standard');
264 264
 
265
-			if( ctype_alnum( $name ) === false )
265
+			if (ctype_alnum($name) === false)
266 266
 			{
267 267
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
268
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
268
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
269 269
 			}
270 270
 
271
-			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
271
+			$classname = '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
272 272
 
273
-			if( class_exists( $classname ) === false ) {
274
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
273
+			if (class_exists($classname) === false) {
274
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
275 275
 			}
276 276
 
277
-			$object = new $classname( $context, $mapping, $object );
277
+			$object = new $classname($context, $mapping, $object);
278 278
 
279
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object );
279
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Product\\Import\\Csv\\Processor\\Iface', $object);
280 280
 		}
281 281
 
282 282
 		return $object;
@@ -290,17 +290,17 @@  discard block
 block discarded – undo
290 290
 	 * @param array $domains List of domains whose items should be fetched too
291 291
 	 * @return array Associative list of product codes as key and product items as value
292 292
 	 */
293
-	protected function getProducts( array $codes, array $domains )
293
+	protected function getProducts(array $codes, array $domains)
294 294
 	{
295 295
 		$result = [];
296
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'product' );
296
+		$manager = \Aimeos\MShop::create($this->getContext(), 'product');
297 297
 
298 298
 		$search = $manager->createSearch();
299
-		$search->setConditions( $search->compare( '==', 'product.code', $codes ) );
300
-		$search->setSlice( 0, count( $codes ) );
299
+		$search->setConditions($search->compare('==', 'product.code', $codes));
300
+		$search->setSlice(0, count($codes));
301 301
 
302
-		foreach( $manager->searchItems( $search, $domains ) as $item ) {
303
-			$result[ $item->getCode() ] = $item;
302
+		foreach ($manager->searchItems($search, $domains) as $item) {
303
+			$result[$item->getCode()] = $item;
304 304
 		}
305 305
 
306 306
 		return $result;
Please login to merge, or discard this patch.
src/Controller/Common/Subscription/Process/Processor/Cgroup/Standard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object
42 42
 	 */
43
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
43
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
44 44
 	{
45
-		parent::__construct( $context );
45
+		parent::__construct($context);
46 46
 
47 47
 		$config = $context->getConfig();
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 * @since 2018.04
58 58
 		 * @category Developer
59 59
 		 */
60
-		$this->groupIds = (array) $config->get( 'controller/common/subscription/process/processor/cgroup/groupids', [] );
60
+		$this->groupIds = (array) $config->get('controller/common/subscription/process/processor/cgroup/groupids', []);
61 61
 	}
62 62
 
63 63
 
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
68 68
 	 */
69
-	public function begin( \Aimeos\MShop\Subscription\Item\Iface $subscription )
69
+	public function begin(\Aimeos\MShop\Subscription\Item\Iface $subscription)
70 70
 	{
71
-		if( empty( $this->groupIds ) ) {
71
+		if (empty($this->groupIds)) {
72 72
 			return;
73 73
 		}
74 74
 
75 75
 		$context = $this->getContext();
76 76
 
77
-		$manager = \Aimeos\MShop::create( $context, 'customer' );
78
-		$baseManager = \Aimeos\MShop::create( $context, 'order/base' );
77
+		$manager = \Aimeos\MShop::create($context, 'customer');
78
+		$baseManager = \Aimeos\MShop::create($context, 'order/base');
79 79
 
80
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
81
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
80
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
81
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
82 82
 
83
-		$item->setGroups( array_unique( array_merge( $item->getGroups(), $this->groupIds ) ) );
84
-		$manager->saveItem( $item );
83
+		$item->setGroups(array_unique(array_merge($item->getGroups(), $this->groupIds)));
84
+		$manager->saveItem($item);
85 85
 	}
86 86
 
87 87
 
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param \Aimeos\MShop\Subscription\Item\Iface $subscription Subscription item
92 92
 	 */
93
-	public function end( \Aimeos\MShop\Subscription\Item\Iface $subscription )
93
+	public function end(\Aimeos\MShop\Subscription\Item\Iface $subscription)
94 94
 	{
95
-		if( empty( $this->groupIds ) ) {
95
+		if (empty($this->groupIds)) {
96 96
 			return;
97 97
 		}
98 98
 
99 99
 		$context = $this->getContext();
100 100
 
101
-		$manager = \Aimeos\MShop::create( $context, 'customer' );
102
-		$baseManager = \Aimeos\MShop::create( $context, 'order/base' );
101
+		$manager = \Aimeos\MShop::create($context, 'customer');
102
+		$baseManager = \Aimeos\MShop::create($context, 'order/base');
103 103
 
104
-		$baseItem = $baseManager->getItem( $subscription->getOrderBaseId() );
105
-		$item = $manager->getItem( $baseItem->getCustomerId(), ['customer/group'] );
104
+		$baseItem = $baseManager->getItem($subscription->getOrderBaseId());
105
+		$item = $manager->getItem($baseItem->getCustomerId(), ['customer/group']);
106 106
 
107
-		$item->setGroups( array_diff( $item->getGroups(), $this->groupIds ) );
108
-		$manager->saveItem( $item );
107
+		$item->setGroups(array_diff($item->getGroups(), $this->groupIds));
108
+		$manager->saveItem($item);
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
common/src/Controller/Common/Coupon/Import/Csv/Processor/Code/Standard.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,20 +40,20 @@
 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\Coupon\Item\Code\Iface $item, array $data )
43
+	public function process(\Aimeos\MShop\Coupon\Item\Code\Iface $item, array $data)
44 44
 	{
45
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' );
46
-		$map = $this->getMappedChunk( $data, $this->getMapping() );
45
+		$manager = \Aimeos\MShop::create($this->getContext(), 'coupon/code');
46
+		$map = $this->getMappedChunk($data, $this->getMapping());
47 47
 
48
-		foreach( $map as $list )
48
+		foreach ($map as $list)
49 49
 		{
50
-			if( trim( $list['coupon.code.code'] ) == '' ) {
50
+			if (trim($list['coupon.code.code']) == '') {
51 51
 				continue;
52 52
 			}
53 53
 
54
-			$item = $manager->saveItem( $item->fromArray( $list ) );
54
+			$item = $manager->saveItem($item->fromArray($list));
55 55
 		}
56 56
 
57
-		return $this->getObject()->process( $item, $data );
57
+		return $this->getObject()->process($item, $data);
58 58
 	}
59 59
 }
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::create( $this->getContext(), 'coupon/code' );
32
+		$manager = \Aimeos\MShop::create($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/tests/TestHelperCntl.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop::cache( false );
18
+		\Aimeos\MShop::cache(false);
19 19
 	}
20 20
 
21 21
 
22
-	public static function getContext( $site = 'unittest' )
22
+	public static function getContext($site = 'unittest')
23 23
 	{
24
-		if( !isset( self::$context[$site] ) ) {
25
-			self::$context[$site] = self::createContext( $site );
24
+		if (!isset(self::$context[$site])) {
25
+			self::$context[$site] = self::createContext($site);
26 26
 		}
27 27
 
28 28
 		return clone self::$context[$site];
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public static function getAimeos()
33 33
 	{
34
-		if( !isset( self::$aimeos ) )
34
+		if (!isset(self::$aimeos))
35 35
 		{
36 36
 			require_once 'Bootstrap.php';
37
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
37
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
38 38
 
39
-			$extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
40
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
39
+			$extdir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
40
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
41 41
 		}
42 42
 
43 43
 		return self::$aimeos;
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * @param string $site
49 49
 	 */
50
-	private static function createContext( $site )
50
+	private static function createContext($site)
51 51
 	{
52 52
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
53 53
 		$aimeos = self::getAimeos();
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
58 58
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
59 59
 
60
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
61
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
62
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
63
-		$ctx->setConfig( $conf );
60
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
61
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
62
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
63
+		$ctx->setConfig($conf);
64 64
 
65 65
 
66
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
67
-		$ctx->setDatabaseManager( $dbm );
66
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
67
+		$ctx->setDatabaseManager($dbm);
68 68
 
69 69
 
70
-		$logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG );
71
-		$ctx->setLogger( $logger );
70
+		$logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG);
71
+		$ctx->setLogger($logger);
72 72
 
73 73
 
74 74
 		$session = new \Aimeos\MW\Session\None();
75
-		$ctx->setSession( $session );
75
+		$ctx->setSession($session);
76 76
 
77 77
 
78
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create( $ctx );
79
-		$locale = $localeManager->bootstrap( $site, '', '', false );
80
-		$ctx->setLocale( $locale );
78
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::create($ctx);
79
+		$locale = $localeManager->bootstrap($site, '', '', false);
80
+		$ctx->setLocale($locale);
81 81
 
82 82
 
83
-		$ctx->setEditor( 'core:controller/common' );
83
+		$ctx->setEditor('core:controller/common');
84 84
 
85 85
 		return $ctx;
86 86
 	}
Please login to merge, or discard this patch.
tests/Controller/Common/Product/Import/Csv/Cache/Product/StandardTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,41 +16,41 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop::cache( true );
19
+		\Aimeos\MShop::cache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22
-		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Product\Standard( $context );
22
+		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Product\Standard($context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28
-		\Aimeos\MShop::cache( false );
28
+		\Aimeos\MShop::cache(false);
29 29
 		\Aimeos\MShop::clear();
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testGet()
34 34
 	{
35
-		$this->assertNotEquals( null, $this->object->get( 'CNC' ) );
35
+		$this->assertNotEquals(null, $this->object->get('CNC'));
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testGetUnknown()
40 40
 	{
41
-		$this->assertEquals( null, $this->object->get( 'cache-test' ) );
41
+		$this->assertEquals(null, $this->object->get('cache-test'));
42 42
 	}
43 43
 
44 44
 
45 45
 	public function testSet()
46 46
 	{
47
-		$item = \Aimeos\MShop::create( \TestHelperCntl::getContext(), 'product' )->createItem();
48
-		$item->setCode( 'cache-test' );
49
-		$item->setId( 1 );
47
+		$item = \Aimeos\MShop::create(\TestHelperCntl::getContext(), 'product')->createItem();
48
+		$item->setCode('cache-test');
49
+		$item->setId(1);
50 50
 
51
-		$this->object->set( $item );
52
-		$id = $this->object->get( 'cache-test' );
51
+		$this->object->set($item);
52
+		$id = $this->object->get('cache-test');
53 53
 
54
-		$this->assertEquals( $item->getId(), $id );
54
+		$this->assertEquals($item->getId(), $id);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
tests/Controller/Common/Product/Import/Csv/Cache/Catalog/StandardTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		\Aimeos\MShop::cache( true );
19
+		\Aimeos\MShop::cache(true);
20 20
 
21 21
 		$context = \TestHelperCntl::getContext();
22
-		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Catalog\Standard( $context );
22
+		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Catalog\Standard($context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28
-		\Aimeos\MShop::cache( false );
28
+		\Aimeos\MShop::cache(false);
29 29
 		\Aimeos\MShop::clear();
30 30
 	}
31 31
 
32 32
 
33 33
 	public function testGet()
34 34
 	{
35
-		$result = $this->object->get( 'root' );
35
+		$result = $this->object->get('root');
36 36
 
37
-		$this->assertNotEquals( null, $result );
38
-		$this->assertInternalType( 'integer', $result );
37
+		$this->assertNotEquals(null, $result);
38
+		$this->assertInternalType('integer', $result);
39 39
 	}
40 40
 
41 41
 
42 42
 	public function testGetUnknown()
43 43
 	{
44
-		$this->assertEquals( null, $this->object->get( 'cache-test' ) );
44
+		$this->assertEquals(null, $this->object->get('cache-test'));
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testSet()
49 49
 	{
50
-		$item = \Aimeos\MShop::create( \TestHelperCntl::getContext(), 'catalog' )->createItem();
51
-		$item->setCode( 'cache-test' );
52
-		$item->setId( 1 );
50
+		$item = \Aimeos\MShop::create(\TestHelperCntl::getContext(), 'catalog')->createItem();
51
+		$item->setCode('cache-test');
52
+		$item->setId(1);
53 53
 
54
-		$this->object->set( $item );
55
-		$id = $this->object->get( 'cache-test' );
54
+		$this->object->set($item);
55
+		$id = $this->object->get('cache-test');
56 56
 
57
-		$this->assertEquals( $item->getId(), $id );
57
+		$this->assertEquals($item->getId(), $id);
58 58
 	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Controller/Common/Product/Import/Csv/Processor/Product/StandardTest.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop::cache( true );
21
+		\Aimeos\MShop::cache(true);
22 22
 
23 23
 		$this->context = \TestHelperCntl::getContext();
24
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
24
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
25 25
 
26
-		$manager = \Aimeos\MShop::create( $this->context, 'product' );
26
+		$manager = \Aimeos\MShop::create($this->context, 'product');
27 27
 		$search = $manager->createSearch();
28
-		$search->setConditions( $search->compare( '==', 'product.code', ['CNC', 'CNE'] ) );
28
+		$search->setConditions($search->compare('==', 'product.code', ['CNC', 'CNE']));
29 29
 
30 30
 		$this->products = [];
31
-		foreach( $manager->searchItems( $search ) as $id => $item ) {
31
+		foreach ($manager->searchItems($search) as $id => $item) {
32 32
 			$this->products[$item->getCode()] = $id;
33 33
 		}
34 34
 	}
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 	protected function tearDown()
38 38
 	{
39
-		\Aimeos\MShop::cache( false );
39
+		\Aimeos\MShop::cache(false);
40 40
 		\Aimeos\MShop::clear();
41 41
 	}
42 42
 
@@ -57,23 +57,23 @@  discard block
 block discarded – undo
57 57
 			3 => 'CNE',
58 58
 		);
59 59
 
60
-		$product = $this->create( 'job_csv_test' );
60
+		$product = $this->create('job_csv_test');
61 61
 
62
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
63
-		$object->process( $product, $data );
62
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
63
+		$object->process($product, $data);
64 64
 
65 65
 
66
-		$listItems1 = $product->getListItems( 'product', 'default' );
67
-		$listItems2 = $product->getListItems( 'product', 'suggestion' );
66
+		$listItems1 = $product->getListItems('product', 'default');
67
+		$listItems2 = $product->getListItems('product', 'suggestion');
68 68
 
69
-		$this->assertEquals( 1, count( $listItems1 ) );
70
-		$this->assertEquals( 1, count( $listItems2 ) );
69
+		$this->assertEquals(1, count($listItems1));
70
+		$this->assertEquals(1, count($listItems2));
71 71
 
72
-		$this->assertEquals( 1, reset( $listItems1 )->getStatus() );
73
-		$this->assertEquals( 1, reset( $listItems2 )->getStatus() );
72
+		$this->assertEquals(1, reset($listItems1)->getStatus());
73
+		$this->assertEquals(1, reset($listItems2)->getStatus());
74 74
 
75
-		$this->assertEquals( $this->products['CNC'], reset( $listItems1 )->getRefId() );
76
-		$this->assertEquals( $this->products['CNE'], reset( $listItems2 )->getRefId() );
75
+		$this->assertEquals($this->products['CNC'], reset($listItems1)->getRefId());
76
+		$this->assertEquals($this->products['CNE'], reset($listItems2)->getRefId());
77 77
 	}
78 78
 
79 79
 
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 			1 => "CNC\nCNE",
90 90
 		);
91 91
 
92
-		$product = $this->create( 'job_csv_test' );
92
+		$product = $this->create('job_csv_test');
93 93
 
94
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
95
-		$object->process( $product, $data );
94
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
95
+		$object->process($product, $data);
96 96
 
97 97
 
98 98
 		$pos = 0;
99 99
 		$listItems = $product->getListItems();
100
-		$prodIds = array( $this->products['CNC'], $this->products['CNE'] );
100
+		$prodIds = array($this->products['CNC'], $this->products['CNE']);
101 101
 
102
-		$this->assertEquals( 2, count( $listItems ) );
102
+		$this->assertEquals(2, count($listItems));
103 103
 
104
-		foreach( $listItems as $listItem )
104
+		foreach ($listItems as $listItem)
105 105
 		{
106
-			$this->assertEquals( 1, $listItem->getStatus() );
107
-			$this->assertEquals( 'product', $listItem->getDomain() );
108
-			$this->assertEquals( 'default', $listItem->getType() );
109
-			$this->assertEquals( $prodIds[$pos], $listItem->getRefId() );
106
+			$this->assertEquals(1, $listItem->getStatus());
107
+			$this->assertEquals('product', $listItem->getDomain());
108
+			$this->assertEquals('default', $listItem->getType());
109
+			$this->assertEquals($prodIds[$pos], $listItem->getRefId());
110 110
 			$pos++;
111 111
 		}
112 112
 	}
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 			1 => 'CNE',
130 130
 		);
131 131
 
132
-		$product = $this->create( 'job_csv_test' );
132
+		$product = $this->create('job_csv_test');
133 133
 
134
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
135
-		$object->process( $product, $data );
136
-		$object->process( $product, $dataUpdate );
134
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
135
+		$object->process($product, $data);
136
+		$object->process($product, $dataUpdate);
137 137
 
138 138
 
139 139
 		$listItems = $product->getListItems();
140
-		$listItem = reset( $listItems );
140
+		$listItem = reset($listItems);
141 141
 
142
-		$this->assertEquals( 1, count( $listItems ) );
143
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
142
+		$this->assertEquals(1, count($listItems));
143
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
144 144
 
145
-		$this->assertEquals( $this->products['CNE'], $listItem->getRefId() );
145
+		$this->assertEquals($this->products['CNE'], $listItem->getRefId());
146 146
 	}
147 147
 
148 148
 
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 			1 => 'CNC',
159 159
 		);
160 160
 
161
-		$product = $this->create( 'job_csv_test' );
161
+		$product = $this->create('job_csv_test');
162 162
 
163
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
164
-		$object->process( $product, $data );
163
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
164
+		$object->process($product, $data);
165 165
 
166
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, [], $this->endpoint );
167
-		$object->process( $product, [] );
166
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, [], $this->endpoint);
167
+		$object->process($product, []);
168 168
 
169 169
 
170
-		$this->assertEquals( 0, count( $product->getListItems() ) );
170
+		$this->assertEquals(0, count($product->getListItems()));
171 171
 	}
172 172
 
173 173
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 			3 => 'CNE',
188 188
 		);
189 189
 
190
-		$product = $this->create( 'job_csv_test' );
190
+		$product = $this->create('job_csv_test');
191 191
 
192
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
193
-		$object->process( $product, $data );
192
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
193
+		$object->process($product, $data);
194 194
 
195 195
 
196 196
 		$listItems = $product->getListItems();
197 197
 
198
-		$this->assertEquals( 1, count( $listItems ) );
198
+		$this->assertEquals(1, count($listItems));
199 199
 	}
200 200
 
201 201
 
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 			3 => 'CNE',
216 216
 		);
217 217
 
218
-		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/product/listtypes', array( 'default' ) );
218
+		$this->context->getConfig()->set('controller/common/product/import/csv/processor/product/listtypes', array('default'));
219 219
 
220
-		$product = $this->create( 'job_csv_test' );
220
+		$product = $this->create('job_csv_test');
221 221
 
222
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard( $this->context, $mapping, $this->endpoint );
222
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Product\Standard($this->context, $mapping, $this->endpoint);
223 223
 
224
-		$this->setExpectedException( '\Aimeos\Controller\Common\Exception' );
225
-		$object->process( $product, $data );
224
+		$this->setExpectedException('\Aimeos\Controller\Common\Exception');
225
+		$object->process($product, $data);
226 226
 	}
227 227
 
228 228
 
229 229
 	/**
230 230
 	 * @param string $code
231 231
 	 */
232
-	protected function create( $code )
232
+	protected function create($code)
233 233
 	{
234
-		$manager = \Aimeos\MShop\Product\Manager\Factory::create( $this->context );
235
-		return $manager->createItem()->setCode( $code );
234
+		$manager = \Aimeos\MShop\Product\Manager\Factory::create($this->context);
235
+		return $manager->createItem()->setCode($code);
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.