Completed
Push — master ( 475749...c0b163 )
by Aimeos
02:12
created
tests/Controller/Common/Product/Import/Csv/Processor/Stock/StandardTest.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 			1 => '2000-01-01 00:00:00',
44 44
 		);
45 45
 
46
-		$product = $this->create( 'job_csv_test' );
46
+		$product = $this->create('job_csv_test');
47 47
 
48
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint );
49
-		$object->process( $product, $data );
48
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint);
49
+		$object->process($product, $data);
50 50
 
51
-		$items = $this->getStockItems( $product->getCode() );
52
-		$this->delete( $product );
51
+		$items = $this->getStockItems($product->getCode());
52
+		$this->delete($product);
53 53
 
54 54
 
55
-		$this->assertEquals( 1, count( $items ) );
55
+		$this->assertEquals(1, count($items));
56 56
 
57
-		foreach( $items as $item )
57
+		foreach ($items as $item)
58 58
 		{
59
-			$this->assertEquals( 100, $item->getStocklevel() );
60
-			$this->assertEquals( '2000-01-01 00:00:00', $item->getDateBack() );
59
+			$this->assertEquals(100, $item->getStocklevel());
60
+			$this->assertEquals('2000-01-01 00:00:00', $item->getDateBack());
61 61
 		}
62 62
 	}
63 63
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 			3 => '200',
79 79
 		);
80 80
 
81
-		$product = $this->create( 'job_csv_test' );
81
+		$product = $this->create('job_csv_test');
82 82
 
83
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint );
84
-		$object->process( $product, $data );
83
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint);
84
+		$object->process($product, $data);
85 85
 
86
-		$items = $this->getStockItems( $product->getCode() );
87
-		$this->delete( $product );
86
+		$items = $this->getStockItems($product->getCode());
87
+		$this->delete($product);
88 88
 
89 89
 
90
-		$this->assertEquals( 2, count( $items ) );
90
+		$this->assertEquals(2, count($items));
91 91
 
92
-		foreach( $items as $item ) {
93
-			$this->assertEquals( 200, $item->getStocklevel() );
92
+		foreach ($items as $item) {
93
+			$this->assertEquals(200, $item->getStocklevel());
94 94
 		}
95 95
 	}
96 96
 
@@ -109,21 +109,21 @@  discard block
 block discarded – undo
109 109
 			0 => '20',
110 110
 		);
111 111
 
112
-		$product = $this->create( 'job_csv_test' );
112
+		$product = $this->create('job_csv_test');
113 113
 
114
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint );
114
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint);
115 115
 
116
-		$object->process( $product, $data );
117
-		$object->process( $product, $dataUpdate );
116
+		$object->process($product, $data);
117
+		$object->process($product, $dataUpdate);
118 118
 
119
-		$items = $this->getStockItems( $product->getCode() );
120
-		$this->delete( $product );
119
+		$items = $this->getStockItems($product->getCode());
120
+		$this->delete($product);
121 121
 
122 122
 
123
-		$item = reset( $items );
123
+		$item = reset($items);
124 124
 
125
-		$this->assertEquals( 1, count( $items ) );
126
-		$this->assertEquals( 20, $item->getStocklevel() );
125
+		$this->assertEquals(1, count($items));
126
+		$this->assertEquals(20, $item->getStocklevel());
127 127
 	}
128 128
 
129 129
 
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 			0 => 50,
138 138
 		);
139 139
 
140
-		$product = $this->create( 'job_csv_test' );
140
+		$product = $this->create('job_csv_test');
141 141
 
142
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint );
143
-		$object->process( $product, $data );
142
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint);
143
+		$object->process($product, $data);
144 144
 
145
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, [], $this->endpoint );
146
-		$object->process( $product, [] );
145
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, [], $this->endpoint);
146
+		$object->process($product, []);
147 147
 
148
-		$items = $this->getStockItems( $product->getCode() );
149
-		$this->delete( $product );
148
+		$items = $this->getStockItems($product->getCode());
149
+		$this->delete($product);
150 150
 
151 151
 
152
-		$this->assertEquals( 0, count( $items ) );
152
+		$this->assertEquals(0, count($items));
153 153
 	}
154 154
 
155 155
 
@@ -167,20 +167,20 @@  discard block
 block discarded – undo
167 167
 			2 => '',
168 168
 		);
169 169
 
170
-		$product = $this->create( 'job_csv_test' );
170
+		$product = $this->create('job_csv_test');
171 171
 
172
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard( $this->context, $mapping, $this->endpoint );
173
-		$object->process( $product, $data );
172
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Stock\Standard($this->context, $mapping, $this->endpoint);
173
+		$object->process($product, $data);
174 174
 
175
-		$items = $this->getStockItems( $product->getCode() );
176
-		$this->delete( $product );
175
+		$items = $this->getStockItems($product->getCode());
176
+		$this->delete($product);
177 177
 
178
-		$this->assertEquals( 1, count( $items ) );
178
+		$this->assertEquals(1, count($items));
179 179
 
180
-		foreach( $items as $item )
180
+		foreach ($items as $item)
181 181
 		{
182
-			$this->assertEquals( null, $item->getStocklevel() );
183
-			$this->assertEquals( null, $item->getDateBack() );
182
+			$this->assertEquals(null, $item->getStocklevel());
183
+			$this->assertEquals(null, $item->getDateBack());
184 184
 		}
185 185
 	}
186 186
 
@@ -188,32 +188,32 @@  discard block
 block discarded – undo
188 188
 	/**
189 189
 	 * @param string $code
190 190
 	 */
191
-	protected function create( $code )
191
+	protected function create($code)
192 192
 	{
193
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
193
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
194 194
 
195 195
 		$item = $manager->createItem();
196
-		$item->setType( 'default' );
197
-		$item->setCode( $code );
196
+		$item->setType('default');
197
+		$item->setCode($code);
198 198
 
199
-		return $manager->saveItem( $item );
199
+		return $manager->saveItem($item);
200 200
 	}
201 201
 
202 202
 
203
-	protected function delete( \Aimeos\MShop\Product\Item\Iface $product )
203
+	protected function delete(\Aimeos\MShop\Product\Item\Iface $product)
204 204
 	{
205
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
206
-		$manager->deleteItem( $product->getId() );
205
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
206
+		$manager->deleteItem($product->getId());
207 207
 	}
208 208
 
209 209
 
210
-	protected function getStockItems( $code )
210
+	protected function getStockItems($code)
211 211
 	{
212
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'stock' );
212
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'stock');
213 213
 
214 214
 		$search = $manager->createSearch();
215
-		$search->setConditions( $search->compare( '==', 'stock.productcode', $code ) );
215
+		$search->setConditions($search->compare('==', 'stock.productcode', $code));
216 216
 
217
-		return $manager->searchItems( $search );
217
+		return $manager->searchItems($search);
218 218
 	}
219 219
 }
220 220
\ 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\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(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\Factory::createManager( $this->context, 'product' );
26
+		$manager = \Aimeos\MShop\Factory::createManager($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\Factory::setCache( false );
39
+		\Aimeos\MShop\Factory::setCache(false);
40 40
 		\Aimeos\MShop\Factory::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::createManager( $this->context );
235
-		return $manager->createItem()->setCode( $code );
234
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
235
+		return $manager->createItem()->setCode($code);
236 236
 	}
237 237
 }
Please login to merge, or discard this patch.
Controller/Common/Product/Import/Csv/Processor/Attribute/StandardTest.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -57,29 +57,29 @@  discard block
 block discarded – undo
57 57
 			8 => 'variant',
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\Attribute\Standard( $this->context, $mapping, $this->endpoint );
63
-		$object->process( $product, $data );
62
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, $mapping, $this->endpoint);
63
+		$object->process($product, $data);
64 64
 
65 65
 
66 66
 		$pos = 0;
67 67
 		$listItems = $product->getListItems();
68 68
 		$expected = array(
69
-			array( 'variant', 'length', '30' ),
70
-			array( 'variant', 'width', '29' ),
71
-			array( 'variant', 'color', 'white' ),
69
+			array('variant', 'length', '30'),
70
+			array('variant', 'width', '29'),
71
+			array('variant', 'color', 'white'),
72 72
 		);
73 73
 
74
-		$this->assertEquals( 3, count( $listItems ) );
74
+		$this->assertEquals(3, count($listItems));
75 75
 
76
-		foreach( $listItems as $listItem )
76
+		foreach ($listItems as $listItem)
77 77
 		{
78
-			$this->assertEquals( 1, $listItem->getStatus() );
79
-			$this->assertEquals( 'attribute', $listItem->getDomain() );
80
-			$this->assertEquals( $expected[$pos][0], $listItem->getType() );
81
-			$this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getType() );
82
-			$this->assertEquals( $expected[$pos][2], $listItem->getRefItem()->getCode() );
78
+			$this->assertEquals(1, $listItem->getStatus());
79
+			$this->assertEquals('attribute', $listItem->getDomain());
80
+			$this->assertEquals($expected[$pos][0], $listItem->getType());
81
+			$this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getType());
82
+			$this->assertEquals($expected[$pos][2], $listItem->getRefItem()->getCode());
83 83
 			$pos++;
84 84
 		}
85 85
 	}
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
 			2 => 'variant',
100 100
 		);
101 101
 
102
-		$product = $this->create( 'job_csv_test' );
102
+		$product = $this->create('job_csv_test');
103 103
 
104
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard( $this->context, $mapping, $this->endpoint );
105
-		$object->process( $product, $data );
104
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Catalog\Standard($this->context, $mapping, $this->endpoint);
105
+		$object->process($product, $data);
106 106
 
107 107
 
108 108
 		$pos = 0;
109
-		$codes = array( 'white', 'black', 'aimeos' );
109
+		$codes = array('white', 'black', 'aimeos');
110 110
 
111
-		foreach( $product->getListItems() as $listItems )
111
+		foreach ($product->getListItems() as $listItems)
112 112
 		{
113
-			$this->assertEquals( 3, count( $listItems ) );
113
+			$this->assertEquals(3, count($listItems));
114 114
 
115
-			foreach( $listItems as $listItem )
115
+			foreach ($listItems as $listItem)
116 116
 			{
117
-				$this->assertEquals( 1, $listItem->getStatus() );
118
-				$this->assertEquals( 'attribute', $listItem->getDomain() );
119
-				$this->assertEquals( 'variant', $listItem->getType() );
120
-				$this->assertEquals( $codes[$pos], $listItem->getRefItem()->getCode() );
117
+				$this->assertEquals(1, $listItem->getStatus());
118
+				$this->assertEquals('attribute', $listItem->getDomain());
119
+				$this->assertEquals('variant', $listItem->getType());
120
+				$this->assertEquals($codes[$pos], $listItem->getRefItem()->getCode());
121 121
 				$pos++;
122 122
 			}
123 123
 		}
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 			1 => '29',
142 142
 		);
143 143
 
144
-		$product = $this->create( 'job_csv_test' );
144
+		$product = $this->create('job_csv_test');
145 145
 
146
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard( $this->context, $mapping, $this->endpoint );
147
-		$object->process( $product, $data );
148
-		$object->process( $product, $dataUpdate );
146
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, $mapping, $this->endpoint);
147
+		$object->process($product, $data);
148
+		$object->process($product, $dataUpdate);
149 149
 
150 150
 
151 151
 		$listItems = $product->getListItems();
152
-		$listItem = reset( $listItems );
152
+		$listItem = reset($listItems);
153 153
 
154
-		$this->assertEquals( 1, count( $listItems ) );
155
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
154
+		$this->assertEquals(1, count($listItems));
155
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
156 156
 
157
-		$this->assertEquals( 'width', $listItem->getRefItem()->getType() );
158
-		$this->assertEquals( '29', $listItem->getRefItem()->getCode() );
157
+		$this->assertEquals('width', $listItem->getRefItem()->getType());
158
+		$this->assertEquals('29', $listItem->getRefItem()->getCode());
159 159
 	}
160 160
 
161 161
 
@@ -171,18 +171,18 @@  discard block
 block discarded – undo
171 171
 			1 => '30',
172 172
 		);
173 173
 
174
-		$product = $this->create( 'job_csv_test' );
174
+		$product = $this->create('job_csv_test');
175 175
 
176
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard( $this->context, $mapping, $this->endpoint );
177
-		$object->process( $product, $data );
176
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, $mapping, $this->endpoint);
177
+		$object->process($product, $data);
178 178
 
179
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard( $this->context, [], $this->endpoint );
180
-		$object->process( $product, [] );
179
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, [], $this->endpoint);
180
+		$object->process($product, []);
181 181
 
182 182
 
183 183
 		$listItems = $product->getListItems();
184 184
 
185
-		$this->assertEquals( 0, count( $listItems ) );
185
+		$this->assertEquals(0, count($listItems));
186 186
 	}
187 187
 
188 188
 
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
 			3 => '30',
203 203
 		);
204 204
 
205
-		$product = $this->create( 'job_csv_test' );
205
+		$product = $this->create('job_csv_test');
206 206
 
207
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard( $this->context, $mapping, $this->endpoint );
208
-		$object->process( $product, $data );
207
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, $mapping, $this->endpoint);
208
+		$object->process($product, $data);
209 209
 
210 210
 
211 211
 		$listItems = $product->getListItems();
212 212
 
213
-		$this->assertEquals( 1, count( $listItems ) );
213
+		$this->assertEquals(1, count($listItems));
214 214
 	}
215 215
 
216 216
 
@@ -234,23 +234,23 @@  discard block
 block discarded – undo
234 234
 			5 => 'default',
235 235
 		);
236 236
 
237
-		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/attribute/listtypes', array( 'default' ) );
237
+		$this->context->getConfig()->set('controller/common/product/import/csv/processor/attribute/listtypes', array('default'));
238 238
 
239
-		$product = $this->create( 'job_csv_test' );
239
+		$product = $this->create('job_csv_test');
240 240
 
241
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard( $this->context, $mapping, $this->endpoint );
241
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Attribute\Standard($this->context, $mapping, $this->endpoint);
242 242
 
243
-		$this->setExpectedException( '\Aimeos\Controller\Common\Exception' );
244
-		$object->process( $product, $data );
243
+		$this->setExpectedException('\Aimeos\Controller\Common\Exception');
244
+		$object->process($product, $data);
245 245
 	}
246 246
 
247 247
 
248 248
 	/**
249 249
 	 * @param string $code
250 250
 	 */
251
-	protected function create( $code )
251
+	protected function create($code)
252 252
 	{
253
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
254
-		return $manager->createItem()->setCode( $code );
253
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
254
+		return $manager->createItem()->setCode($code);
255 255
 	}
256 256
 }
257 257
\ No newline at end of file
Please login to merge, or discard this patch.
tests/Controller/Common/Product/Import/Csv/Processor/Text/StandardTest.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -49,30 +49,30 @@  discard block
 block discarded – undo
49 49
 			4 => 1,
50 50
 		);
51 51
 
52
-		$product = $this->create( 'job_csv_test' );
52
+		$product = $this->create('job_csv_test');
53 53
 
54
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
55
-		$object->process( $product, $data );
54
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
55
+		$object->process($product, $data);
56 56
 
57 57
 
58 58
 		$listItems = $product->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( 'default', $listItem->getType() );
64
+		$this->assertEquals(1, $listItem->getStatus());
65
+		$this->assertEquals(0, $listItem->getPosition());
66
+		$this->assertEquals('default', $listItem->getType());
67 67
 
68 68
 		$refItem = $listItem->getRefItem();
69 69
 
70
-		$this->assertEquals( 1, $refItem->getStatus() );
71
-		$this->assertEquals( 'name', $refItem->getType() );
72
-		$this->assertEquals( 'test text', $refItem->getLabel() );
73
-		$this->assertEquals( 'Job CSV test', $refItem->getContent() );
74
-		$this->assertEquals( 'de', $refItem->getLanguageId() );
75
-		$this->assertEquals( 1, $refItem->getStatus() );
70
+		$this->assertEquals(1, $refItem->getStatus());
71
+		$this->assertEquals('name', $refItem->getType());
72
+		$this->assertEquals('test text', $refItem->getLabel());
73
+		$this->assertEquals('Job CSV test', $refItem->getContent());
74
+		$this->assertEquals('de', $refItem->getLanguageId());
75
+		$this->assertEquals(1, $refItem->getStatus());
76 76
 	}
77 77
 
78 78
 
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
 			7 => 'Long: Job CSV test 2',
101 101
 		);
102 102
 
103
-		$product = $this->create( 'job_csv_test' );
103
+		$product = $this->create('job_csv_test');
104 104
 
105
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
106
-		$object->process( $product, $data );
105
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
106
+		$object->process($product, $data);
107 107
 
108 108
 
109 109
 		$pos = 0;
110 110
 		$listItems = $product->getListItems();
111 111
 		$expected = array(
112
-			0 => array( 'name', 'Job CSV test' ),
113
-			1 => array( 'short', 'Short: Job CSV test' ),
114
-			2 => array( 'long', 'Long: Job CSV test' ),
115
-			3 => array( 'long', 'Long: Job CSV test 2' ),
112
+			0 => array('name', 'Job CSV test'),
113
+			1 => array('short', 'Short: Job CSV test'),
114
+			2 => array('long', 'Long: Job CSV test'),
115
+			3 => array('long', 'Long: Job CSV test 2'),
116 116
 		);
117 117
 
118
-		$this->assertEquals( 4, count( $listItems ) );
118
+		$this->assertEquals(4, count($listItems));
119 119
 
120
-		foreach( $listItems as $listItem )
120
+		foreach ($listItems as $listItem)
121 121
 		{
122
-			$this->assertEquals( $expected[$pos][0], $listItem->getRefItem()->getType() );
123
-			$this->assertEquals( $expected[$pos][1], $listItem->getRefItem()->getContent() );
122
+			$this->assertEquals($expected[$pos][0], $listItem->getRefItem()->getType());
123
+			$this->assertEquals($expected[$pos][1], $listItem->getRefItem()->getContent());
124 124
 			$pos++;
125 125
 		}
126 126
 	}
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
 			1 => 'Short: Job CSV test',
144 144
 		);
145 145
 
146
-		$product = $this->create( 'job_csv_test' );
146
+		$product = $this->create('job_csv_test');
147 147
 
148
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
149
-		$object->process( $product, $data );
150
-		$object->process( $product, $dataUpdate );
148
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
149
+		$object->process($product, $data);
150
+		$object->process($product, $dataUpdate);
151 151
 
152 152
 
153 153
 		$listItems = $product->getListItems();
154
-		$listItem = reset( $listItems );
154
+		$listItem = reset($listItems);
155 155
 
156
-		$this->assertEquals( 1, count( $listItems ) );
157
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
156
+		$this->assertEquals(1, count($listItems));
157
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
158 158
 
159
-		$this->assertEquals( 'short', $listItem->getRefItem()->getType() );
160
-		$this->assertEquals( 'Short: Job CSV test', $listItem->getRefItem()->getContent() );
159
+		$this->assertEquals('short', $listItem->getRefItem()->getType());
160
+		$this->assertEquals('Short: Job CSV test', $listItem->getRefItem()->getContent());
161 161
 	}
162 162
 
163 163
 
@@ -173,18 +173,18 @@  discard block
 block discarded – undo
173 173
 			1 => 'Job CSV test',
174 174
 		);
175 175
 
176
-		$product = $this->create( 'job_csv_test' );
176
+		$product = $this->create('job_csv_test');
177 177
 
178
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
179
-		$object->process( $product, $data );
178
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
179
+		$object->process($product, $data);
180 180
 
181
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, [], $this->endpoint );
182
-		$object->process( $product, [] );
181
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, [], $this->endpoint);
182
+		$object->process($product, []);
183 183
 
184 184
 
185 185
 		$listItems = $product->getListItems();
186 186
 
187
-		$this->assertEquals( 0, count( $listItems ) );
187
+		$this->assertEquals(0, count($listItems));
188 188
 	}
189 189
 
190 190
 
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
 			3 => '',
205 205
 		);
206 206
 
207
-		$product = $this->create( 'job_csv_test' );
207
+		$product = $this->create('job_csv_test');
208 208
 
209
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
210
-		$object->process( $product, $data );
209
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
210
+		$object->process($product, $data);
211 211
 
212 212
 
213 213
 		$listItems = $product->getListItems();
214 214
 
215
-		$this->assertEquals( 1, count( $listItems ) );
215
+		$this->assertEquals(1, count($listItems));
216 216
 	}
217 217
 
218 218
 
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
 			5 => 'default',
237 237
 		);
238 238
 
239
-		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/text/listtypes', array( 'default' ) );
239
+		$this->context->getConfig()->set('controller/common/product/import/csv/processor/text/listtypes', array('default'));
240 240
 
241
-		$product = $this->create( 'job_csv_test' );
241
+		$product = $this->create('job_csv_test');
242 242
 
243
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard( $this->context, $mapping, $this->endpoint );
243
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Text\Standard($this->context, $mapping, $this->endpoint);
244 244
 
245
-		$this->setExpectedException( '\Aimeos\Controller\Common\Exception' );
246
-		$object->process( $product, $data );
245
+		$this->setExpectedException('\Aimeos\Controller\Common\Exception');
246
+		$object->process($product, $data);
247 247
 	}
248 248
 
249 249
 
250 250
 	/**
251 251
 	 * @param string $code
252 252
 	 */
253
-	protected function create( $code )
253
+	protected function create($code)
254 254
 	{
255
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
256
-		return $manager->createItem()->setCode( $code );
255
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
256
+		return $manager->createItem()->setCode($code);
257 257
 	}
258 258
 }
259 259
\ No newline at end of file
Please login to merge, or discard this patch.
tests/Controller/Common/Product/Import/Csv/Processor/Price/StandardTest.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 	protected function setUp()
19 19
 	{
20
-		\Aimeos\MShop\Factory::setCache( true );
20
+		\Aimeos\MShop\Factory::setCache(true);
21 21
 
22 22
 		$this->context = \TestHelperCntl::getContext();
23
-		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done( $this->context, [] );
23
+		$this->endpoint = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Done($this->context, []);
24 24
 	}
25 25
 
26 26
 
27 27
 	protected function tearDown()
28 28
 	{
29
-		\Aimeos\MShop\Factory::setCache( false );
29
+		\Aimeos\MShop\Factory::setCache(false);
30 30
 		\Aimeos\MShop\Factory::clear();
31 31
 	}
32 32
 
@@ -57,33 +57,33 @@  discard block
 block discarded – undo
57 57
 			8 => 1,
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\Price\Standard( $this->context, $mapping, $this->endpoint );
63
-		$object->process( $product, $data );
62
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
63
+		$object->process($product, $data);
64 64
 
65 65
 
66 66
 		$listItems = $product->getListItems();
67
-		$listItem = reset( $listItems );
67
+		$listItem = reset($listItems);
68 68
 
69
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
70
-		$this->assertEquals( 1, count( $listItems ) );
69
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
70
+		$this->assertEquals(1, count($listItems));
71 71
 
72
-		$this->assertEquals( 1, $listItem->getStatus() );
73
-		$this->assertEquals( 0, $listItem->getPosition() );
74
-		$this->assertEquals( 'default', $listItem->getType() );
72
+		$this->assertEquals(1, $listItem->getStatus());
73
+		$this->assertEquals(0, $listItem->getPosition());
74
+		$this->assertEquals('default', $listItem->getType());
75 75
 
76 76
 		$refItem = $listItem->getRefItem();
77 77
 
78
-		$this->assertEquals( 1, $refItem->getStatus() );
79
-		$this->assertEquals( 'default', $refItem->getType() );
80
-		$this->assertEquals( 'EUR 1.00', $refItem->getLabel() );
81
-		$this->assertEquals( 5, $refItem->getQuantity() );
82
-		$this->assertEquals( '1.00', $refItem->getValue() );
83
-		$this->assertEquals( '0.20', $refItem->getCosts() );
84
-		$this->assertEquals( '0.10', $refItem->getRebate() );
85
-		$this->assertEquals( '20.00', $refItem->getTaxrate() );
86
-		$this->assertEquals( 1, $refItem->getStatus() );
78
+		$this->assertEquals(1, $refItem->getStatus());
79
+		$this->assertEquals('default', $refItem->getType());
80
+		$this->assertEquals('EUR 1.00', $refItem->getLabel());
81
+		$this->assertEquals(5, $refItem->getQuantity());
82
+		$this->assertEquals('1.00', $refItem->getValue());
83
+		$this->assertEquals('0.20', $refItem->getCosts());
84
+		$this->assertEquals('0.10', $refItem->getRebate());
85
+		$this->assertEquals('20.00', $refItem->getTaxrate());
86
+		$this->assertEquals(1, $refItem->getStatus());
87 87
 	}
88 88
 
89 89
 
@@ -111,21 +111,21 @@  discard block
 block discarded – undo
111 111
 			7 => '4.00',
112 112
 		);
113 113
 
114
-		$product = $this->create( 'job_csv_test' );
114
+		$product = $this->create('job_csv_test');
115 115
 
116
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint );
117
-		$object->process( $product, $data );
116
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
117
+		$object->process($product, $data);
118 118
 
119 119
 
120 120
 		$pos = 0;
121 121
 		$listItems = $product->getListItems();
122 122
 
123
-		$this->assertEquals( 4, count( $listItems ) );
123
+		$this->assertEquals(4, count($listItems));
124 124
 
125
-		foreach( $listItems as $listItem )
125
+		foreach ($listItems as $listItem)
126 126
 		{
127
-			$this->assertEquals( $data[$pos++], $listItem->getRefItem()->getCurrencyId() );
128
-			$this->assertEquals( $data[$pos++], $listItem->getRefItem()->getValue() );
127
+			$this->assertEquals($data[$pos++], $listItem->getRefItem()->getCurrencyId());
128
+			$this->assertEquals($data[$pos++], $listItem->getRefItem()->getValue());
129 129
 		}
130 130
 	}
131 131
 
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 			1 => '2.00',
148 148
 		);
149 149
 
150
-		$product = $this->create( 'job_csv_test' );
150
+		$product = $this->create('job_csv_test');
151 151
 
152
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint );
153
-		$object->process( $product, $data );
154
-		$object->process( $product, $dataUpdate );
152
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
153
+		$object->process($product, $data);
154
+		$object->process($product, $dataUpdate);
155 155
 
156 156
 
157 157
 		$listItems = $product->getListItems();
158
-		$listItem = reset( $listItems );
158
+		$listItem = reset($listItems);
159 159
 
160
-		$this->assertEquals( 1, count( $listItems ) );
161
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem );
160
+		$this->assertEquals(1, count($listItems));
161
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $listItem);
162 162
 
163
-		$this->assertEquals( '2.00', $listItem->getRefItem()->getValue() );
163
+		$this->assertEquals('2.00', $listItem->getRefItem()->getValue());
164 164
 	}
165 165
 
166 166
 
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 			1 => '1.00',
177 177
 		);
178 178
 
179
-		$product = $this->create( 'job_csv_test' );
179
+		$product = $this->create('job_csv_test');
180 180
 
181
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint );
182
-		$object->process( $product, $data );
181
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
182
+		$object->process($product, $data);
183 183
 
184
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, [], $this->endpoint );
185
-		$object->process( $product, [] );
184
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, [], $this->endpoint);
185
+		$object->process($product, []);
186 186
 
187 187
 
188 188
 		$listItems = $product->getListItems();
189 189
 
190
-		$this->assertEquals( 0, count( $listItems ) );
190
+		$this->assertEquals(0, count($listItems));
191 191
 	}
192 192
 
193 193
 
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
 			3 => '',
208 208
 		);
209 209
 
210
-		$product = $this->create( 'job_csv_test' );
210
+		$product = $this->create('job_csv_test');
211 211
 
212
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint );
213
-		$object->process( $product, $data );
212
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
213
+		$object->process($product, $data);
214 214
 
215 215
 
216 216
 		$listItems = $product->getListItems();
217 217
 
218
-		$this->assertEquals( 1, count( $listItems ) );
218
+		$this->assertEquals(1, count($listItems));
219 219
 	}
220 220
 
221 221
 
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
 			5 => 'default',
240 240
 		);
241 241
 
242
-		$this->context->getConfig()->set( 'controller/common/product/import/csv/processor/price/listtypes', array( 'default' ) );
242
+		$this->context->getConfig()->set('controller/common/product/import/csv/processor/price/listtypes', array('default'));
243 243
 
244
-		$product = $this->create( 'job_csv_test' );
244
+		$product = $this->create('job_csv_test');
245 245
 
246
-		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard( $this->context, $mapping, $this->endpoint );
246
+		$object = new \Aimeos\Controller\Common\Product\Import\Csv\Processor\Price\Standard($this->context, $mapping, $this->endpoint);
247 247
 
248
-		$this->setExpectedException( '\Aimeos\Controller\Common\Exception' );
249
-		$object->process( $product, $data );
248
+		$this->setExpectedException('\Aimeos\Controller\Common\Exception');
249
+		$object->process($product, $data);
250 250
 	}
251 251
 
252 252
 
253 253
 	/**
254 254
 	 * @param string $code
255 255
 	 */
256
-	protected function create( $code )
256
+	protected function create($code)
257 257
 	{
258
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
259
-		return $manager->createItem()->setCode( $code );
258
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
259
+		return $manager->createItem()->setCode($code);
260 260
 	}
261 261
 }
262 262
\ No newline at end of file
Please login to merge, or discard this patch.
controller/common/src/Controller/Common/Catalog/Import/Csv/Base.php 1 patch
Spacing   +41 added lines, -41 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 catalog 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\Catalog\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\\Catalog\\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/catalog/import/csv/cache/' . $type . '/name', 'Standard' );
64
+		if ($name === null) {
65
+			$name = $config->get('controller/common/catalog/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\\Catalog\\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\\Catalog\\Import\\Csv\\Cache\\' . ucfirst( $type ) . '\\' . $name;
74
+		$classname = '\\Aimeos\\Controller\\Common\\Catalog\\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\\Catalog\\Import\\Csv\\Cache\\Iface', $object );
82
+		\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\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 catalog code (starting from 0)
112 112
 	 * @return array List of arrays with catalog 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
 
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	 * @param array $mapping List of domain item keys with the CSV field position as key
176 176
 	 * @return array List of associative arrays containing the chunked properties
177 177
 	 */
178
-	protected function getMappedChunk( array &$data, array $mapping )
178
+	protected function getMappedChunk(array &$data, array $mapping)
179 179
 	{
180 180
 		$idx = 0;
181 181
 		$map = [];
182 182
 
183
-		foreach( $mapping as $pos => $key )
183
+		foreach ($mapping as $pos => $key)
184 184
 		{
185
-			if( isset( $map[$idx][$key] ) ) {
185
+			if (isset($map[$idx][$key])) {
186 186
 				$idx++;
187 187
 			}
188 188
 
189
-			if( isset( $data[$pos] ) )
189
+			if (isset($data[$pos]))
190 190
 			{
191 191
 				$map[$idx][$key] = $data[$pos];
192
-				unset( $data[$pos] );
192
+				unset($data[$pos]);
193 193
 			}
194 194
 		}
195 195
 
@@ -203,37 +203,37 @@  discard block
 block discarded – undo
203 203
 	 * @param array $mappings Associative list of processor types as keys and index/data mappings as values
204 204
 	 * @return \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface Processor object
205 205
 	 */
206
-	protected function getProcessors( array $mappings )
206
+	protected function getProcessors(array $mappings)
207 207
 	{
208 208
 		$context = $this->getContext();
209 209
 		$config = $context->getConfig();
210
-		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done( $context, [] );
210
+		$object = new \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Done($context, []);
211 211
 
212
-		foreach( $mappings as $type => $mapping )
212
+		foreach ($mappings as $type => $mapping)
213 213
 		{
214
-			if( ctype_alnum( $type ) === false )
214
+			if (ctype_alnum($type) === false)
215 215
 			{
216 216
 				$classname = is_string($type) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type : '<not a string>';
217
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
217
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
218 218
 			}
219 219
 
220
-			$name = $config->get( 'controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard' );
220
+			$name = $config->get('controller/common/catalog/import/csv/processor/' . $type . '/name', 'Standard');
221 221
 
222
-			if( ctype_alnum( $name ) === false )
222
+			if (ctype_alnum($name) === false)
223 223
 			{
224 224
 				$classname = is_string($name) ? '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . $type . '\\' . $name : '<not a string>';
225
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
225
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
226 226
 			}
227 227
 
228
-			$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst( $type ) . '\\' . $name;
228
+			$classname = '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\' . ucfirst($type) . '\\' . $name;
229 229
 
230
-			if( class_exists( $classname ) === false ) {
231
-				throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Class "%1$s" not found', $classname ) );
230
+			if (class_exists($classname) === false) {
231
+				throw new \Aimeos\Controller\Jobs\Exception(sprintf('Class "%1$s" not found', $classname));
232 232
 			}
233 233
 
234
-			$object = new $classname( $context, $mapping, $object );
234
+			$object = new $classname($context, $mapping, $object);
235 235
 
236
-			\Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object );
236
+			\Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Common\\Catalog\\Import\\Csv\\Processor\\Iface', $object);
237 237
 		}
238 238
 
239 239
 		return $object;
Please login to merge, or discard this patch.
common/src/Controller/Common/Catalog/Import/Csv/Processor/Base.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 	 * @param array $mapping Associative list of field position in CSV as key and domain item key as value
33 33
 	 * @param \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object Decorated processor
34 34
 	 */
35
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping,
36
-		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null )
35
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $mapping,
36
+		\Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null)
37 37
 	{
38 38
 		$this->context = $context;
39 39
 		$this->mapping = $mapping;
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	 * @param integer $pos Computed position of the list item in the associated list of items
49 49
 	 * @return array Given associative list enriched by default values if they were not already set
50 50
 	 */
51
-	protected function addListItemDefaults( array $list, $pos )
51
+	protected function addListItemDefaults(array $list, $pos)
52 52
 	{
53
-		if( !isset( $list['catalog.lists.position'] ) ) {
53
+		if (!isset($list['catalog.lists.position'])) {
54 54
 			$list['catalog.lists.position'] = $pos;
55 55
 		}
56 56
 
57
-		if( !isset( $list['catalog.lists.status'] ) ) {
57
+		if (!isset($list['catalog.lists.status'])) {
58 58
 			$list['catalog.lists.status'] = 1;
59 59
 		}
60 60
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function getObject()
94 94
 	{
95
-		if( $this->object === null ) {
96
-			throw new \Aimeos\Controller\Jobs\Exception( 'No processor object available' );
95
+		if ($this->object === null) {
96
+			throw new \Aimeos\Controller\Jobs\Exception('No processor object available');
97 97
 		}
98 98
 
99 99
 		return $this->object;
Please login to merge, or discard this patch.
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\Factory::createManager( $context, 'attribute' );
48
-		$result = $manager->searchItems( $manager->createSearch() );
47
+		$manager = \Aimeos\MShop\Factory::createManager($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\Factory::createManager( $this->getContext(), 'attribute' );
69
+		$manager = \Aimeos\MShop\Factory::createManager($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\Factory::createManager( $this->getContext(), 'product' );
296
+		$manager = \Aimeos\MShop\Factory::createManager($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.