Completed
Push — master ( f9d464...00af66 )
by Aimeos
02:40
created
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +322 added lines, -322 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product');
26 26
 	}
27 27
 
28 28
 
@@ -34,42 +34,42 @@  discard block
 block discarded – undo
34 34
 
35 35
 	public function testDelete()
36 36
 	{
37
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' );
37
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem');
38 38
 
39
-		$params = array( 'id' => $this->getProductItem()->getId() );
40
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
41
-		$this->view->addHelper( 'param', $helper );
39
+		$params = array('id' => $this->getProductItem()->getId());
40
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
41
+		$this->view->addHelper('param', $helper);
42 42
 
43 43
 		$header = array();
44 44
 		$status = 500;
45 45
 
46
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
46
+		$result = json_decode($this->object->delete('', $header, $status), true);
47 47
 
48
-		$this->assertEquals( 200, $status );
49
-		$this->assertEquals( 1, count( $header ) );
50
-		$this->assertEquals( 1, $result['meta']['total'] );
51
-		$this->assertArrayNotHasKey( 'included', $result );
52
-		$this->assertArrayNotHasKey( 'data', $result );
53
-		$this->assertArrayNotHasKey( 'errors', $result );
48
+		$this->assertEquals(200, $status);
49
+		$this->assertEquals(1, count($header));
50
+		$this->assertEquals(1, $result['meta']['total']);
51
+		$this->assertArrayNotHasKey('included', $result);
52
+		$this->assertArrayNotHasKey('data', $result);
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testDeleteBulk()
58 58
 	{
59
-		$this->getProductMock( array( 'deleteItems' ) )->expects( $this->once() )->method( 'deleteItems' );
59
+		$this->getProductMock(array('deleteItems'))->expects($this->once())->method('deleteItems');
60 60
 
61 61
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
62 62
 		$header = array();
63 63
 		$status = 500;
64 64
 
65
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
65
+		$result = json_decode($this->object->delete($body, $header, $status), true);
66 66
 
67
-		$this->assertEquals( 200, $status );
68
-		$this->assertEquals( 1, count( $header ) );
69
-		$this->assertEquals( 2, $result['meta']['total'] );
70
-		$this->assertArrayNotHasKey( 'included', $result );
71
-		$this->assertArrayNotHasKey( 'data', $result );
72
-		$this->assertArrayNotHasKey( 'errors', $result );
67
+		$this->assertEquals(200, $status);
68
+		$this->assertEquals(1, count($header));
69
+		$this->assertEquals(2, $result['meta']['total']);
70
+		$this->assertArrayNotHasKey('included', $result);
71
+		$this->assertArrayNotHasKey('data', $result);
72
+		$this->assertArrayNotHasKey('errors', $result);
73 73
 	}
74 74
 
75 75
 
@@ -79,71 +79,71 @@  discard block
 block discarded – undo
79 79
 		$header = array();
80 80
 		$status = 500;
81 81
 
82
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
82
+		$result = json_decode($this->object->delete($body, $header, $status), true);
83 83
 
84
-		$this->assertEquals( 400, $status );
85
-		$this->assertEquals( 1, count( $header ) );
86
-		$this->assertEquals( 0, $result['meta']['total'] );
87
-		$this->assertArrayHasKey( 'errors', $result );
88
-		$this->assertArrayNotHasKey( 'included', $result );
89
-		$this->assertArrayNotHasKey( 'data', $result );
84
+		$this->assertEquals(400, $status);
85
+		$this->assertEquals(1, count($header));
86
+		$this->assertEquals(0, $result['meta']['total']);
87
+		$this->assertArrayHasKey('errors', $result);
88
+		$this->assertArrayNotHasKey('included', $result);
89
+		$this->assertArrayNotHasKey('data', $result);
90 90
 	}
91 91
 
92 92
 
93 93
 	public function testDeleteException()
94 94
 	{
95
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
96
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
95
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
96
+			->will($this->throwException(new \Exception('test exception')));
97 97
 
98
-		$params = array( 'id' => $this->getProductItem()->getId() );
99
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
100
-		$this->view->addHelper( 'param', $helper );
98
+		$params = array('id' => $this->getProductItem()->getId());
99
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
100
+		$this->view->addHelper('param', $helper);
101 101
 
102 102
 		$header = array();
103 103
 		$status = 500;
104 104
 
105
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
105
+		$result = json_decode($this->object->delete('', $header, $status), true);
106 106
 
107
-		$this->assertEquals( 500, $status );
108
-		$this->assertArrayHasKey( 'errors', $result );
107
+		$this->assertEquals(500, $status);
108
+		$this->assertArrayHasKey('errors', $result);
109 109
 	}
110 110
 
111 111
 
112 112
 	public function testDeleteMAdminException()
113 113
 	{
114
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
115
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
114
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
115
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
116 116
 
117
-		$params = array( 'id' => $this->getProductItem()->getId() );
118
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
119
-		$this->view->addHelper( 'param', $helper );
117
+		$params = array('id' => $this->getProductItem()->getId());
118
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
119
+		$this->view->addHelper('param', $helper);
120 120
 
121 121
 		$header = array();
122 122
 		$status = 500;
123 123
 
124
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
124
+		$result = json_decode($this->object->delete('', $header, $status), true);
125 125
 
126
-		$this->assertEquals( 404, $status );
127
-		$this->assertArrayHasKey( 'errors', $result );
126
+		$this->assertEquals(404, $status);
127
+		$this->assertArrayHasKey('errors', $result);
128 128
 	}
129 129
 
130 130
 
131 131
 	public function testDeleteMShopException()
132 132
 	{
133
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
134
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
133
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
134
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
135 135
 
136
-		$params = array( 'id' => $this->getProductItem()->getId() );
137
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
138
-		$this->view->addHelper( 'param', $helper );
136
+		$params = array('id' => $this->getProductItem()->getId());
137
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
138
+		$this->view->addHelper('param', $helper);
139 139
 
140 140
 		$header = array();
141 141
 		$status = 500;
142 142
 
143
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
143
+		$result = json_decode($this->object->delete('', $header, $status), true);
144 144
 
145
-		$this->assertEquals( 404, $status );
146
-		$this->assertArrayHasKey( 'errors', $result );
145
+		$this->assertEquals(404, $status);
146
+		$this->assertArrayHasKey('errors', $result);
147 147
 	}
148 148
 
149 149
 
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		$header = array();
153 153
 		$status = 500;
154 154
 
155
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
155
+		$result = json_decode($this->object->get('', $header, $status), true);
156 156
 
157
-		$this->assertEquals( 200, $status );
158
-		$this->assertEquals( 1, count( $header ) );
159
-		$this->assertEquals( 28, $result['meta']['total'] );
160
-		$this->assertEquals( 25, count( $result['data'] ) );
161
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
162
-		$this->assertEquals( 0, count( $result['included'] ) );
163
-		$this->assertArrayHasKey( 'next', $result['links'] );
164
-		$this->assertArrayHasKey( 'last', $result['links'] );
165
-		$this->assertArrayHasKey( 'self', $result['links'] );
166
-		$this->assertArrayNotHasKey( 'errors', $result );
157
+		$this->assertEquals(200, $status);
158
+		$this->assertEquals(1, count($header));
159
+		$this->assertEquals(28, $result['meta']['total']);
160
+		$this->assertEquals(25, count($result['data']));
161
+		$this->assertEquals('product', $result['data'][0]['type']);
162
+		$this->assertEquals(0, count($result['included']));
163
+		$this->assertArrayHasKey('next', $result['links']);
164
+		$this->assertArrayHasKey('last', $result['links']);
165
+		$this->assertArrayHasKey('self', $result['links']);
166
+		$this->assertArrayNotHasKey('errors', $result);
167 167
 	}
168 168
 
169 169
 
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
 		$status = 500;
174 174
 
175 175
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
176
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/stock/warehouse' );
176
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/stock/warehouse');
177 177
 
178
-		$result = json_decode( $object->get( '', $header, $status ), true );
178
+		$result = json_decode($object->get('', $header, $status), true);
179 179
 
180
-		$this->assertEquals( 200, $status );
181
-		$this->assertEquals( 1, count( $header ) );
182
-		$this->assertEquals( 6, $result['meta']['total'] );
183
-		$this->assertEquals( 6, count( $result['data'] ) );
184
-		$this->assertEquals( 'product/stock/warehouse', $result['data'][0]['type'] );
185
-		$this->assertEquals( 0, count( $result['included'] ) );
186
-		$this->assertArrayNotHasKey( 'errors', $result );
180
+		$this->assertEquals(200, $status);
181
+		$this->assertEquals(1, count($header));
182
+		$this->assertEquals(6, $result['meta']['total']);
183
+		$this->assertEquals(6, count($result['data']));
184
+		$this->assertEquals('product/stock/warehouse', $result['data'][0]['type']);
185
+		$this->assertEquals(0, count($result['included']));
186
+		$this->assertArrayNotHasKey('errors', $result);
187 187
 	}
188 188
 
189 189
 
@@ -193,74 +193,74 @@  discard block
 block discarded – undo
193 193
 		$status = 500;
194 194
 
195 195
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
196
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' );
196
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
197 197
 
198
-		$result = json_decode( $object->get( '', $header, $status ), true );
198
+		$result = json_decode($object->get('', $header, $status), true);
199 199
 
200
-		$this->assertEquals( 404, $status );
201
-		$this->assertEquals( 1, count( $header ) );
202
-		$this->assertEquals( 1, count( $result['errors'] ) );
203
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
204
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
205
-		$this->assertArrayNotHasKey( 'data', $result );
206
-		$this->assertArrayNotHasKey( 'indluded', $result );
200
+		$this->assertEquals(404, $status);
201
+		$this->assertEquals(1, count($header));
202
+		$this->assertEquals(1, count($result['errors']));
203
+		$this->assertArrayHasKey('title', $result['errors'][0]);
204
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
205
+		$this->assertArrayNotHasKey('data', $result);
206
+		$this->assertArrayNotHasKey('indluded', $result);
207 207
 	}
208 208
 
209 209
 
210 210
 	public function testGetException()
211 211
 	{
212
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
213
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
212
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
213
+			->will($this->throwException(new \Exception('test exception')));
214 214
 
215
-		$params = array( 'id' => -1 );
216
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
217
-		$this->view->addHelper( 'param', $helper );
215
+		$params = array('id' => -1);
216
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
217
+		$this->view->addHelper('param', $helper);
218 218
 
219 219
 		$header = array();
220 220
 		$status = 500;
221 221
 
222
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
222
+		$result = json_decode($this->object->get('', $header, $status), true);
223 223
 
224
-		$this->assertEquals( 500, $status );
225
-		$this->assertArrayHasKey( 'errors', $result );
224
+		$this->assertEquals(500, $status);
225
+		$this->assertArrayHasKey('errors', $result);
226 226
 	}
227 227
 
228 228
 
229 229
 	public function testGetMAdminException()
230 230
 	{
231
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
232
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
231
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
232
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
233 233
 
234
-		$params = array( 'id' => -1 );
235
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
236
-		$this->view->addHelper( 'param', $helper );
234
+		$params = array('id' => -1);
235
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
236
+		$this->view->addHelper('param', $helper);
237 237
 
238 238
 		$header = array();
239 239
 		$status = 500;
240 240
 
241
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
241
+		$result = json_decode($this->object->get('', $header, $status), true);
242 242
 
243
-		$this->assertEquals( 404, $status );
244
-		$this->assertArrayHasKey( 'errors', $result );
243
+		$this->assertEquals(404, $status);
244
+		$this->assertArrayHasKey('errors', $result);
245 245
 	}
246 246
 
247 247
 
248 248
 	public function testGetMShopException()
249 249
 	{
250
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
251
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
250
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
251
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
252 252
 
253
-		$params = array( 'id' => -1 );
254
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
255
-		$this->view->addHelper( 'param', $helper );
253
+		$params = array('id' => -1);
254
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
255
+		$this->view->addHelper('param', $helper);
256 256
 
257 257
 		$header = array();
258 258
 		$status = 500;
259 259
 
260
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
260
+		$result = json_decode($this->object->get('', $header, $status), true);
261 261
 
262
-		$this->assertEquals( 404, $status );
263
-		$this->assertArrayHasKey( 'errors', $result );
262
+		$this->assertEquals(404, $status);
263
+		$this->assertArrayHasKey('errors', $result);
264 264
 	}
265 265
 
266 266
 
@@ -268,24 +268,24 @@  discard block
 block discarded – undo
268 268
 	{
269 269
 		$params = array(
270 270
 			'filter' => array(
271
-				'==' => array( 'product.type.code' => 'select' )
271
+				'==' => array('product.type.code' => 'select')
272 272
 			)
273 273
 		);
274
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
275
-		$this->view->addHelper( 'param', $helper );
274
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
275
+		$this->view->addHelper('param', $helper);
276 276
 
277 277
 		$header = array();
278 278
 		$status = 500;
279 279
 
280
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
280
+		$result = json_decode($this->object->get('', $header, $status), true);
281 281
 
282
-		$this->assertEquals( 200, $status );
283
-		$this->assertEquals( 1, count( $header ) );
284
-		$this->assertEquals( 3, $result['meta']['total'] );
285
-		$this->assertEquals( 3, count( $result['data'] ) );
286
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
287
-		$this->assertEquals( 0, count( $result['included'] ) );
288
-		$this->assertArrayNotHasKey( 'errors', $result );
282
+		$this->assertEquals(200, $status);
283
+		$this->assertEquals(1, count($header));
284
+		$this->assertEquals(3, $result['meta']['total']);
285
+		$this->assertEquals(3, count($result['data']));
286
+		$this->assertEquals('product', $result['data'][0]['type']);
287
+		$this->assertEquals(0, count($result['included']));
288
+		$this->assertArrayNotHasKey('errors', $result);
289 289
 	}
290 290
 
291 291
 
@@ -294,26 +294,26 @@  discard block
 block discarded – undo
294 294
 		$params = array(
295 295
 			'filter' => array(
296 296
 				'&&' => array(
297
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
298
-					array( '==' => array( 'product.type.code' => 'select' ) ),
297
+					array('=~' => array('product.label' => 'Unittest: Test')),
298
+					array('==' => array('product.type.code' => 'select')),
299 299
 				)
300 300
 			)
301 301
 		);
302
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
303
-		$this->view->addHelper( 'param', $helper );
302
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
303
+		$this->view->addHelper('param', $helper);
304 304
 
305 305
 		$header = array();
306 306
 		$status = 500;
307 307
 
308
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
308
+		$result = json_decode($this->object->get('', $header, $status), true);
309 309
 
310
-		$this->assertEquals( 200, $status );
311
-		$this->assertEquals( 1, count( $header ) );
312
-		$this->assertEquals( 2, $result['meta']['total'] );
313
-		$this->assertEquals( 2, count( $result['data'] ) );
314
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
315
-		$this->assertEquals( 0, count( $result['included'] ) );
316
-		$this->assertArrayNotHasKey( 'errors', $result );
310
+		$this->assertEquals(200, $status);
311
+		$this->assertEquals(1, count($header));
312
+		$this->assertEquals(2, $result['meta']['total']);
313
+		$this->assertEquals(2, count($result['data']));
314
+		$this->assertEquals('product', $result['data'][0]['type']);
315
+		$this->assertEquals(0, count($result['included']));
316
+		$this->assertArrayNotHasKey('errors', $result);
317 317
 	}
318 318
 
319 319
 
@@ -325,24 +325,24 @@  discard block
 block discarded – undo
325 325
 				'limit' => 25
326 326
 			)
327 327
 		);
328
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
329
-		$this->view->addHelper( 'param', $helper );
328
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
329
+		$this->view->addHelper('param', $helper);
330 330
 
331 331
 		$header = array();
332 332
 		$status = 500;
333 333
 
334
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
334
+		$result = json_decode($this->object->get('', $header, $status), true);
335 335
 
336
-		$this->assertEquals( 200, $status );
337
-		$this->assertEquals( 1, count( $header ) );
338
-		$this->assertEquals( 28, $result['meta']['total'] );
339
-		$this->assertEquals( 3, count( $result['data'] ) );
340
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
341
-		$this->assertEquals( 0, count( $result['included'] ) );
342
-		$this->assertArrayHasKey( 'first', $result['links'] );
343
-		$this->assertArrayHasKey( 'prev', $result['links'] );
344
-		$this->assertArrayHasKey( 'self', $result['links'] );
345
-		$this->assertArrayNotHasKey( 'errors', $result );
336
+		$this->assertEquals(200, $status);
337
+		$this->assertEquals(1, count($header));
338
+		$this->assertEquals(28, $result['meta']['total']);
339
+		$this->assertEquals(3, count($result['data']));
340
+		$this->assertEquals('product', $result['data'][0]['type']);
341
+		$this->assertEquals(0, count($result['included']));
342
+		$this->assertArrayHasKey('first', $result['links']);
343
+		$this->assertArrayHasKey('prev', $result['links']);
344
+		$this->assertArrayHasKey('self', $result['links']);
345
+		$this->assertArrayNotHasKey('errors', $result);
346 346
 	}
347 347
 
348 348
 
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 		$params = array(
352 352
 			'sort' => 'product.label,-product.code'
353 353
 		);
354
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
355
-		$this->view->addHelper( 'param', $helper );
354
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
355
+		$this->view->addHelper('param', $helper);
356 356
 
357 357
 		$header = array();
358 358
 		$status = 500;
359 359
 
360
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
360
+		$result = json_decode($this->object->get('', $header, $status), true);
361 361
 
362
-		$this->assertEquals( 200, $status );
363
-		$this->assertEquals( 1, count( $header ) );
364
-		$this->assertEquals( 28, $result['meta']['total'] );
365
-		$this->assertEquals( 25, count( $result['data'] ) );
366
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
367
-		$this->assertEquals( 'ABCD', $result['data'][0]['attributes']['product.code'] );
368
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
369
-		$this->assertEquals( 0, count( $result['included'] ) );
370
-		$this->assertArrayNotHasKey( 'errors', $result );
362
+		$this->assertEquals(200, $status);
363
+		$this->assertEquals(1, count($header));
364
+		$this->assertEquals(28, $result['meta']['total']);
365
+		$this->assertEquals(25, count($result['data']));
366
+		$this->assertEquals('product', $result['data'][0]['type']);
367
+		$this->assertEquals('ABCD', $result['data'][0]['attributes']['product.code']);
368
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
369
+		$this->assertEquals(0, count($result['included']));
370
+		$this->assertArrayNotHasKey('errors', $result);
371 371
 	}
372 372
 
373 373
 
@@ -380,88 +380,88 @@  discard block
 block discarded – undo
380 380
 			'sort' => 'product.id',
381 381
 			'include' => 'product'
382 382
 		);
383
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
384
-		$this->view->addHelper( 'param', $helper );
383
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
384
+		$this->view->addHelper('param', $helper);
385 385
 
386 386
 		$header = array();
387 387
 		$status = 500;
388 388
 
389
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
389
+		$result = json_decode($this->object->get('', $header, $status), true);
390 390
 
391
-		$this->assertEquals( 200, $status );
392
-		$this->assertEquals( 1, count( $header ) );
393
-		$this->assertEquals( 28, $result['meta']['total'] );
394
-		$this->assertEquals( 25, count( $result['data'] ) );
395
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
396
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
397
-		$this->assertArrayNotHasKey( 'errors', $result );
391
+		$this->assertEquals(200, $status);
392
+		$this->assertEquals(1, count($header));
393
+		$this->assertEquals(28, $result['meta']['total']);
394
+		$this->assertEquals(25, count($result['data']));
395
+		$this->assertEquals('product', $result['data'][0]['type']);
396
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
397
+		$this->assertArrayNotHasKey('errors', $result);
398 398
 	}
399 399
 
400 400
 
401 401
 	public function testPatch()
402 402
 	{
403
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
403
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
404 404
 
405 405
 		$item = $productManagerStub->createItem();
406
-		$item->setLabel( 'test' );
407
-		$item->setId( '-1' );
406
+		$item->setLabel('test');
407
+		$item->setId('-1');
408 408
 
409
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
410
-		$productManagerStub->expects( $this->exactly( 3 ) )->method( 'getItem' ) // 3x due to decorator
411
-			->will( $this->returnValue( $item ) );
409
+		$productManagerStub->expects($this->once())->method('saveItem');
410
+		$productManagerStub->expects($this->exactly(3))->method('getItem') // 3x due to decorator
411
+			->will($this->returnValue($item));
412 412
 
413 413
 
414
-		$params = array( 'id' => '-1' );
415
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
416
-		$this->view->addHelper( 'param', $helper );
414
+		$params = array('id' => '-1');
415
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
416
+		$this->view->addHelper('param', $helper);
417 417
 
418 418
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
419 419
 		$header = array();
420 420
 		$status = 500;
421 421
 
422
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
422
+		$result = json_decode($this->object->patch($body, $header, $status), true);
423 423
 
424
-		$this->assertEquals( 200, $status );
425
-		$this->assertEquals( 1, count( $header ) );
426
-		$this->assertEquals( 1, $result['meta']['total'] );
427
-		$this->assertArrayHasKey( 'data', $result );
428
-		$this->assertEquals( '-1', $result['data']['id'] );
429
-		$this->assertEquals( 'product', $result['data']['type'] );
430
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
431
-		$this->assertArrayNotHasKey( 'included', $result );
432
-		$this->assertArrayNotHasKey( 'errors', $result );
424
+		$this->assertEquals(200, $status);
425
+		$this->assertEquals(1, count($header));
426
+		$this->assertEquals(1, $result['meta']['total']);
427
+		$this->assertArrayHasKey('data', $result);
428
+		$this->assertEquals('-1', $result['data']['id']);
429
+		$this->assertEquals('product', $result['data']['type']);
430
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
431
+		$this->assertArrayNotHasKey('included', $result);
432
+		$this->assertArrayNotHasKey('errors', $result);
433 433
 	}
434 434
 
435 435
 
436 436
 	public function testPatchBulk()
437 437
 	{
438
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
438
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
439 439
 
440 440
 		$item = $productManagerStub->createItem();
441
-		$item->setLabel( 'test' );
442
-		$item->setId( '-1' );
441
+		$item->setLabel('test');
442
+		$item->setId('-1');
443 443
 
444
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
445
-		$productManagerStub->expects( $this->exactly( 6 ) )->method( 'getItem' ) // 6x due to decorator
446
-			->will( $this->returnValue( $item ) );
444
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
445
+		$productManagerStub->expects($this->exactly(6))->method('getItem') // 6x due to decorator
446
+			->will($this->returnValue($item));
447 447
 
448 448
 
449 449
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
450 450
 		$header = array();
451 451
 		$status = 500;
452 452
 
453
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
453
+		$result = json_decode($this->object->patch($body, $header, $status), true);
454 454
 
455
-		$this->assertEquals( 200, $status );
456
-		$this->assertEquals( 1, count( $header ) );
457
-		$this->assertEquals( 2, $result['meta']['total'] );
458
-		$this->assertArrayHasKey( 'data', $result );
459
-		$this->assertEquals( 2, count( $result['data'] ) );
460
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
461
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
462
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
463
-		$this->assertArrayNotHasKey( 'included', $result );
464
-		$this->assertArrayNotHasKey( 'errors', $result );
455
+		$this->assertEquals(200, $status);
456
+		$this->assertEquals(1, count($header));
457
+		$this->assertEquals(2, $result['meta']['total']);
458
+		$this->assertArrayHasKey('data', $result);
459
+		$this->assertEquals(2, count($result['data']));
460
+		$this->assertEquals('-1', $result['data'][0]['id']);
461
+		$this->assertEquals('product', $result['data'][0]['type']);
462
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
463
+		$this->assertArrayNotHasKey('included', $result);
464
+		$this->assertArrayNotHasKey('errors', $result);
465 465
 	}
466 466
 
467 467
 
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
 		$header = array();
472 472
 		$status = 500;
473 473
 
474
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
474
+		$result = json_decode($this->object->patch($body, $header, $status), true);
475 475
 
476
-		$this->assertEquals( 400, $status );
477
-		$this->assertEquals( 1, count( $header ) );
478
-		$this->assertEquals( 0, $result['meta']['total'] );
479
-		$this->assertArrayHasKey( 'errors', $result );
480
-		$this->assertArrayNotHasKey( 'included', $result );
481
-		$this->assertArrayNotHasKey( 'data', $result );
476
+		$this->assertEquals(400, $status);
477
+		$this->assertEquals(1, count($header));
478
+		$this->assertEquals(0, $result['meta']['total']);
479
+		$this->assertArrayHasKey('errors', $result);
480
+		$this->assertArrayNotHasKey('included', $result);
481
+		$this->assertArrayNotHasKey('data', $result);
482 482
 	}
483 483
 
484 484
 
@@ -488,120 +488,120 @@  discard block
 block discarded – undo
488 488
 		$header = array();
489 489
 		$status = 500;
490 490
 
491
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
491
+		$result = json_decode($this->object->patch($body, $header, $status), true);
492 492
 
493
-		$this->assertEquals( 400, $status );
494
-		$this->assertEquals( 1, count( $header ) );
495
-		$this->assertEquals( 0, $result['meta']['total'] );
496
-		$this->assertArrayHasKey( 'errors', $result );
493
+		$this->assertEquals(400, $status);
494
+		$this->assertEquals(1, count($header));
495
+		$this->assertEquals(0, $result['meta']['total']);
496
+		$this->assertArrayHasKey('errors', $result);
497 497
 	}
498 498
 
499 499
 
500 500
 	public function testPatchException()
501 501
 	{
502
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
503
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
502
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
503
+			->will($this->throwException(new \Exception('test exception')));
504 504
 
505 505
 		$header = array();
506 506
 		$status = 500;
507 507
 
508
-		$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true );
508
+		$result = json_decode($this->object->patch('{"data":[{"id":-1}]}', $header, $status), true);
509 509
 
510
-		$this->assertEquals( 500, $status );
511
-		$this->assertArrayHasKey( 'errors', $result );
510
+		$this->assertEquals(500, $status);
511
+		$this->assertArrayHasKey('errors', $result);
512 512
 	}
513 513
 
514 514
 
515 515
 	public function testPatchMAdminException()
516 516
 	{
517
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
518
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
517
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
518
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
519 519
 
520 520
 		$header = array();
521 521
 		$status = 500;
522 522
 
523
-		$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true );
523
+		$result = json_decode($this->object->patch('{"data":[{"id":-1}]}', $header, $status), true);
524 524
 
525
-		$this->assertEquals( 404, $status );
526
-		$this->assertArrayHasKey( 'errors', $result );
525
+		$this->assertEquals(404, $status);
526
+		$this->assertArrayHasKey('errors', $result);
527 527
 	}
528 528
 
529 529
 
530 530
 	public function testPatchMShopException()
531 531
 	{
532
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
533
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
532
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
533
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
534 534
 
535 535
 		$header = array();
536 536
 		$status = 500;
537 537
 
538
-		$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true );
538
+		$result = json_decode($this->object->patch('{"data":[{"id":-1}]}', $header, $status), true);
539 539
 
540
-		$this->assertEquals( 404, $status );
541
-		$this->assertArrayHasKey( 'errors', $result );
540
+		$this->assertEquals(404, $status);
541
+		$this->assertArrayHasKey('errors', $result);
542 542
 	}
543 543
 
544 544
 
545 545
 	public function testPost()
546 546
 	{
547
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
547
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
548 548
 
549 549
 		$item = $productManagerStub->createItem();
550
-		$item->setLabel( 'test' );
551
-		$item->setId( '-1' );
550
+		$item->setLabel('test');
551
+		$item->setId('-1');
552 552
 
553
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
554
-		$productManagerStub->expects( $this->once() )->method( 'getItem' )
555
-			->will( $this->returnValue( $item ) );
553
+		$productManagerStub->expects($this->once())->method('saveItem');
554
+		$productManagerStub->expects($this->once())->method('getItem')
555
+			->will($this->returnValue($item));
556 556
 
557 557
 
558 558
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
559 559
 		$header = array();
560 560
 		$status = 500;
561 561
 
562
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
562
+		$result = json_decode($this->object->post($body, $header, $status), true);
563 563
 
564
-		$this->assertEquals( 201, $status );
565
-		$this->assertEquals( 1, count( $header ) );
566
-		$this->assertEquals( 1, $result['meta']['total'] );
567
-		$this->assertArrayHasKey( 'data', $result );
568
-		$this->assertEquals( '-1', $result['data']['id'] );
569
-		$this->assertEquals( 'product', $result['data']['type'] );
570
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
571
-		$this->assertArrayNotHasKey( 'included', $result );
572
-		$this->assertArrayNotHasKey( 'errors', $result );
564
+		$this->assertEquals(201, $status);
565
+		$this->assertEquals(1, count($header));
566
+		$this->assertEquals(1, $result['meta']['total']);
567
+		$this->assertArrayHasKey('data', $result);
568
+		$this->assertEquals('-1', $result['data']['id']);
569
+		$this->assertEquals('product', $result['data']['type']);
570
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
571
+		$this->assertArrayNotHasKey('included', $result);
572
+		$this->assertArrayNotHasKey('errors', $result);
573 573
 	}
574 574
 
575 575
 
576 576
 	public function testPostBulk()
577 577
 	{
578
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
578
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
579 579
 
580 580
 		$item = $productManagerStub->createItem();
581
-		$item->setLabel( 'test' );
582
-		$item->setId( '-1' );
581
+		$item->setLabel('test');
582
+		$item->setId('-1');
583 583
 
584
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
585
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
586
-			->will( $this->returnValue( $item ) );
584
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
585
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
586
+			->will($this->returnValue($item));
587 587
 
588 588
 
589 589
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
590 590
 		$header = array();
591 591
 		$status = 500;
592 592
 
593
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
593
+		$result = json_decode($this->object->post($body, $header, $status), true);
594 594
 
595
-		$this->assertEquals( 201, $status );
596
-		$this->assertEquals( 1, count( $header ) );
597
-		$this->assertEquals( 2, $result['meta']['total'] );
598
-		$this->assertArrayHasKey( 'data', $result );
599
-		$this->assertEquals( 2, count( $result['data'] ) );
600
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
601
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
602
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
603
-		$this->assertArrayNotHasKey( 'included', $result );
604
-		$this->assertArrayNotHasKey( 'errors', $result );
595
+		$this->assertEquals(201, $status);
596
+		$this->assertEquals(1, count($header));
597
+		$this->assertEquals(2, $result['meta']['total']);
598
+		$this->assertArrayHasKey('data', $result);
599
+		$this->assertEquals(2, count($result['data']));
600
+		$this->assertEquals('-1', $result['data'][0]['id']);
601
+		$this->assertEquals('product', $result['data'][0]['type']);
602
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
603
+		$this->assertArrayNotHasKey('included', $result);
604
+		$this->assertArrayNotHasKey('errors', $result);
605 605
 	}
606 606
 
607 607
 
@@ -611,14 +611,14 @@  discard block
 block discarded – undo
611 611
 		$header = array();
612 612
 		$status = 500;
613 613
 
614
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
614
+		$result = json_decode($this->object->post($body, $header, $status), true);
615 615
 
616
-		$this->assertEquals( 400, $status );
617
-		$this->assertEquals( 1, count( $header ) );
618
-		$this->assertEquals( 0, $result['meta']['total'] );
619
-		$this->assertArrayHasKey( 'errors', $result );
620
-		$this->assertArrayNotHasKey( 'included', $result );
621
-		$this->assertArrayNotHasKey( 'data', $result );
616
+		$this->assertEquals(400, $status);
617
+		$this->assertEquals(1, count($header));
618
+		$this->assertEquals(0, $result['meta']['total']);
619
+		$this->assertArrayHasKey('errors', $result);
620
+		$this->assertArrayNotHasKey('included', $result);
621
+		$this->assertArrayNotHasKey('data', $result);
622 622
 	}
623 623
 
624 624
 
@@ -628,57 +628,57 @@  discard block
 block discarded – undo
628 628
 		$header = array();
629 629
 		$status = 500;
630 630
 
631
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
631
+		$result = json_decode($this->object->post($body, $header, $status), true);
632 632
 
633
-		$this->assertEquals( 403, $status );
634
-		$this->assertEquals( 1, count( $header ) );
635
-		$this->assertEquals( 0, $result['meta']['total'] );
636
-		$this->assertArrayHasKey( 'errors', $result );
633
+		$this->assertEquals(403, $status);
634
+		$this->assertEquals(1, count($header));
635
+		$this->assertEquals(0, $result['meta']['total']);
636
+		$this->assertArrayHasKey('errors', $result);
637 637
 	}
638 638
 
639 639
 
640 640
 	public function testPostException()
641 641
 	{
642
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
643
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
642
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
643
+			->will($this->throwException(new \Exception('test exception')));
644 644
 
645 645
 		$header = array();
646 646
 		$status = 500;
647 647
 
648
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
648
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
649 649
 
650
-		$this->assertEquals( 500, $status );
651
-		$this->assertArrayHasKey( 'errors', $result );
650
+		$this->assertEquals(500, $status);
651
+		$this->assertArrayHasKey('errors', $result);
652 652
 	}
653 653
 
654 654
 
655 655
 	public function testPostMAdminException()
656 656
 	{
657
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
658
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
657
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
658
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
659 659
 
660 660
 		$header = array();
661 661
 		$status = 500;
662 662
 
663
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
663
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
664 664
 
665
-		$this->assertEquals( 404, $status );
666
-		$this->assertArrayHasKey( 'errors', $result );
665
+		$this->assertEquals(404, $status);
666
+		$this->assertArrayHasKey('errors', $result);
667 667
 	}
668 668
 
669 669
 
670 670
 	public function testPostMShopException()
671 671
 	{
672
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
673
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
672
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
673
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
674 674
 
675 675
 		$header = array();
676 676
 		$status = 500;
677 677
 
678
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
678
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
679 679
 
680
-		$this->assertEquals( 404, $status );
681
-		$this->assertArrayHasKey( 'errors', $result );
680
+		$this->assertEquals(404, $status);
681
+		$this->assertArrayHasKey('errors', $result);
682 682
 	}
683 683
 
684 684
 
@@ -688,11 +688,11 @@  discard block
 block discarded – undo
688 688
 		$header = array();
689 689
 		$status = 500;
690 690
 
691
-		$result = json_decode( $this->object->put( $body, $header, $status ), true );
691
+		$result = json_decode($this->object->put($body, $header, $status), true);
692 692
 
693
-		$this->assertEquals( 501, $status );
694
-		$this->assertEquals( 1, count( $header ) );
695
-		$this->assertArrayHasKey( 'errors', $result );
693
+		$this->assertEquals(501, $status);
694
+		$this->assertEquals(1, count($header));
695
+		$this->assertArrayHasKey('errors', $result);
696 696
 	}
697 697
 
698 698
 
@@ -701,86 +701,86 @@  discard block
 block discarded – undo
701 701
 		$header = array();
702 702
 		$status = 500;
703 703
 
704
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
704
+		$result = json_decode($this->object->options('', $header, $status), true);
705 705
 
706
-		$this->assertEquals( 200, $status );
707
-		$this->assertEquals( 2, count( $header ) );
708
-		$this->assertEquals( 59, count( $result['meta']['resources'] ) );
709
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
710
-		$this->assertArrayNotHasKey( 'errors', $result );
706
+		$this->assertEquals(200, $status);
707
+		$this->assertEquals(2, count($header));
708
+		$this->assertEquals(59, count($result['meta']['resources']));
709
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
710
+		$this->assertArrayNotHasKey('errors', $result);
711 711
 	}
712 712
 
713 713
 
714 714
 	public function testOptionsException()
715 715
 	{
716
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
717
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
716
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
717
+			->will($this->throwException(new \Exception('test exception')));
718 718
 
719 719
 		$header = array();
720 720
 		$status = 500;
721 721
 
722
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
722
+		$result = json_decode($this->object->options('', $header, $status), true);
723 723
 
724
-		$this->assertEquals( 500, $status );
725
-		$this->assertArrayHasKey( 'errors', $result );
724
+		$this->assertEquals(500, $status);
725
+		$this->assertArrayHasKey('errors', $result);
726 726
 	}
727 727
 
728 728
 
729 729
 	public function testOptionsMAdminException()
730 730
 	{
731
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
732
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
731
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
732
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
733 733
 
734 734
 		$header = array();
735 735
 		$status = 500;
736 736
 
737
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
737
+		$result = json_decode($this->object->options('', $header, $status), true);
738 738
 
739
-		$this->assertEquals( 404, $status );
740
-		$this->assertArrayHasKey( 'errors', $result );
739
+		$this->assertEquals(404, $status);
740
+		$this->assertArrayHasKey('errors', $result);
741 741
 	}
742 742
 
743 743
 
744 744
 	public function testOptionsMShopException()
745 745
 	{
746
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
747
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
746
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
747
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
748 748
 
749 749
 		$header = array();
750 750
 		$status = 500;
751 751
 
752
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
752
+		$result = json_decode($this->object->options('', $header, $status), true);
753 753
 
754
-		$this->assertEquals( 404, $status );
755
-		$this->assertArrayHasKey( 'errors', $result );
754
+		$this->assertEquals(404, $status);
755
+		$this->assertArrayHasKey('errors', $result);
756 756
 	}
757 757
 
758 758
 
759
-	protected function getProductMock( array $methods )
759
+	protected function getProductMock(array $methods)
760 760
 	{
761 761
 		$name = 'ClientJsonAdmStandard';
762
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
762
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
763 763
 
764
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
765
-			->setConstructorArgs( array( $this->context ) )
766
-			->setMethods( $methods )
764
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
765
+			->setConstructorArgs(array($this->context))
766
+			->setMethods($methods)
767 767
 			->getMock();
768 768
 
769
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
769
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
770 770
 
771 771
 		return $productManagerStub;
772 772
 	}
773 773
 
774 774
 
775
-	protected function getProductItem( $code = 'CNC' )
775
+	protected function getProductItem($code = 'CNC')
776 776
 	{
777
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
777
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
778 778
 		$search = $manager->createSearch();
779
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
780
-		$items = $manager->searchItems( $search );
779
+		$search->setConditions($search->compare('==', 'product.code', $code));
780
+		$items = $manager->searchItems($search);
781 781
 
782
-		if( ( $item = reset( $items ) ) === false ) {
783
-			throw new \Exception( sprintf( 'No product item with code "%1$s" found', $code ) );
782
+		if (($item = reset($items)) === false) {
783
+			throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
784 784
 		}
785 785
 
786 786
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/FactoryTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJadm::getContext();
17 17
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
18 18
 
19
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
20
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
19
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
20
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJadm::getContext();
27 27
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
28 28
 
29
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
30
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
29
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
30
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJadm::getContext();
37 37
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
38 38
 
39
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '' );
40
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
39
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '');
40
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
41 41
 	}
42 42
 
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJadm::getContext();
47 47
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
50
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '%^' );
49
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
50
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '%^');
51 51
 	}
52 52
 
53 53
 
@@ -56,68 +56,68 @@  discard block
 block discarded – undo
56 56
 		$context = \TestHelperJadm::getContext();
57 57
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
58 58
 
59
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
60
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '', '%^' );
59
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
60
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '', '%^');
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testClear()
65 65
 	{
66
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
66
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
67 67
 
68 68
 		$context = \TestHelperJadm::getContext();
69 69
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
70 70
 
71
-		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
71
+		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
72 72
 		\Aimeos\Admin\JsonAdm\Factory::clear();
73
-		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
73
+		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
74 74
 
75
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
75
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
76 76
 
77
-		$this->assertNotSame( $client1, $client2 );
77
+		$this->assertNotSame($client1, $client2);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testClearSite()
82 82
 	{
83
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
83
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
84 84
 
85 85
 		$context = \TestHelperJadm::getContext();
86 86
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
87 87
 
88
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
89
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
90
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context );
88
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
89
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
90
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context);
91 91
 
92
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
93
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
92
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
93
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
94 94
 
95
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
95
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
96 96
 
97
-		$this->assertNotSame( $cntlA1, $cntlA2 );
98
-		$this->assertNotSame( $cntlB1, $cntlB2 );
97
+		$this->assertNotSame($cntlA1, $cntlA2);
98
+		$this->assertNotSame($cntlB1, $cntlB2);
99 99
 	}
100 100
 
101 101
 
102 102
 	public function testClearSpecific()
103 103
 	{
104
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
104
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
105 105
 
106 106
 		$context = \TestHelperJadm::getContext();
107 107
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
108 108
 
109
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
110
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
109
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
110
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
111 111
 
112
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' );
112
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
113 113
 
114
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
115
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
114
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
115
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
116 116
 
117
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
117
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
118 118
 
119
-		$this->assertNotSame( $cntlA1, $cntlA2 );
120
-		$this->assertSame( $cntlB1, $cntlB2 );
119
+		$this->assertNotSame($cntlA1, $cntlA2);
120
+		$this->assertSame($cntlB1, $cntlB2);
121 121
 	}
122 122
 
123 123
 }
124 124
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Base.php 2 patches
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
35 35
 	 * @return void
36 36
 	 */
37
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
37
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
38 38
 	{
39 39
 		$this->view = $view;
40 40
 		$this->context = $context;
@@ -51,48 +51,48 @@  discard block
 block discarded – undo
51 51
 	 * @param integer &$status Variable which contains the HTTP status afterwards
52 52
 	 * @return string Content for response body
53 53
 	 */
54
-	public function delete( $body, array &$header, &$status )
54
+	public function delete($body, array &$header, &$status)
55 55
 	{
56
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
56
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
57 57
 		$context = $this->getContext();
58 58
 		$view = $this->getView();
59 59
 
60 60
 		try
61 61
 		{
62
-			$view = $this->deleteItems( $view, $body );
62
+			$view = $this->deleteItems($view, $body);
63 63
 			$status = 200;
64 64
 		}
65
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
65
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
66 66
 		{
67 67
 			$status = $e->getCode();
68
-			$view->errors = array( array(
69
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
68
+			$view->errors = array(array(
69
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
70 70
 				'detail' => $e->getTraceAsString(),
71
-			) );
71
+			));
72 72
 		}
73
-		catch( \Aimeos\MAdmin\Exception $e )
73
+		catch (\Aimeos\MAdmin\Exception $e)
74 74
 		{
75 75
 			$status = 404;
76
-			$view->errors = array( array(
77
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
76
+			$view->errors = array(array(
77
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
78 78
 				'detail' => $e->getTraceAsString(),
79
-			) );
79
+			));
80 80
 		}
81
-		catch( \Aimeos\MShop\Exception $e )
81
+		catch (\Aimeos\MShop\Exception $e)
82 82
 		{
83 83
 			$status = 404;
84
-			$view->errors = array( array(
85
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
84
+			$view->errors = array(array(
85
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
86 86
 				'detail' => $e->getTraceAsString(),
87
-			) );
87
+			));
88 88
 		}
89
-		catch( \Exception $e )
89
+		catch (\Exception $e)
90 90
 		{
91 91
 			$status = 500;
92
-			$view->errors = array( array(
92
+			$view->errors = array(array(
93 93
 				'title' => $e->getMessage(),
94 94
 				'detail' => $e->getTraceAsString(),
95
-			) );
95
+			));
96 96
 		}
97 97
 
98 98
 		/** admin/jsonadm/standard/template-delete
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$tplconf = 'admin/jsonadm/standard/template-delete';
123 123
 		$default = 'delete-default.php';
124 124
 
125
-		return $view->render( $view->config( $tplconf, $default ) );
125
+		return $view->render($view->config($tplconf, $default));
126 126
 	}
127 127
 
128 128
 
@@ -134,60 +134,60 @@  discard block
 block discarded – undo
134 134
 	 * @param integer &$status Variable which contains the HTTP status afterwards
135 135
 	 * @return string Content for response body
136 136
 	 */
137
-	public function get( $body, array &$header, &$status )
137
+	public function get($body, array &$header, &$status)
138 138
 	{
139
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
139
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
140 140
 		$context = $this->getContext();
141 141
 		$view = $this->getView();
142 142
 		$total = 1;
143 143
 
144 144
 		try
145 145
 		{
146
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
147
-			$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
146
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
147
+			$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
148 148
 
149
-			if( ( $id = $view->param( 'id' ) ) == null )
149
+			if (($id = $view->param('id')) == null)
150 150
 			{
151
-				$search = $this->initCriteria( $manager->createSearch(), $view->param() );
152
-				$view->data = $manager->searchItems( $search, array(), $total );
153
-				$view->childItems = $this->getChildItems( $view->data, $include );
154
-				$view->listItems = $this->getListItems( $view->data, $include );
151
+				$search = $this->initCriteria($manager->createSearch(), $view->param());
152
+				$view->data = $manager->searchItems($search, array(), $total);
153
+				$view->childItems = $this->getChildItems($view->data, $include);
154
+				$view->listItems = $this->getListItems($view->data, $include);
155 155
 			}
156 156
 			else
157 157
 			{
158
-				$view->data = $manager->getItem( $id, array() );
159
-				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
160
-				$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
158
+				$view->data = $manager->getItem($id, array());
159
+				$view->childItems = $this->getChildItems(array($id => $view->data), $include);
160
+				$view->listItems = $this->getListItems(array($id => $view->data), $include);
161 161
 			}
162 162
 
163
-			$view->refItems = $this->getRefItems( $view->listItems );
163
+			$view->refItems = $this->getRefItems($view->listItems);
164 164
 
165 165
 			$view->total = $total;
166 166
 			$status = 200;
167 167
 		}
168
-		catch( \Aimeos\MAdmin\Exception $e )
168
+		catch (\Aimeos\MAdmin\Exception $e)
169 169
 		{
170 170
 			$status = 404;
171
-			$view->errors = array( array(
172
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
171
+			$view->errors = array(array(
172
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
173 173
 				'detail' => $e->getTraceAsString(),
174
-			) );
174
+			));
175 175
 		}
176
-		catch( \Aimeos\MShop\Exception $e )
176
+		catch (\Aimeos\MShop\Exception $e)
177 177
 		{
178 178
 			$status = 404;
179
-			$view->errors = array( array(
180
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
179
+			$view->errors = array(array(
180
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
181 181
 				'detail' => $e->getTraceAsString(),
182
-			) );
182
+			));
183 183
 		}
184
-		catch( \Exception $e )
184
+		catch (\Exception $e)
185 185
 		{
186 186
 			$status = 500;
187
-			$view->errors = array( array(
187
+			$view->errors = array(array(
188 188
 				'title' => $e->getMessage(),
189 189
 				'detail' => $e->getTraceAsString(),
190
-			) );
190
+			));
191 191
 		}
192 192
 
193 193
 		/** admin/jsonadm/standard/template-get
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 		$tplconf = 'admin/jsonadm/standard/template-get';
218 218
 		$default = 'get-default.php';
219 219
 
220
-		return $view->render( $view->config( $tplconf, $default ) );
220
+		return $view->render($view->config($tplconf, $default));
221 221
 	}
222 222
 
223 223
 
@@ -229,48 +229,48 @@  discard block
 block discarded – undo
229 229
 	 * @param integer &$status Variable which contains the HTTP status afterwards
230 230
 	 * @return string Content for response body
231 231
 	 */
232
-	public function patch( $body, array &$header, &$status )
232
+	public function patch($body, array &$header, &$status)
233 233
 	{
234
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
234
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
235 235
 		$context = $this->getContext();
236 236
 		$view = $this->getView();
237 237
 
238 238
 		try
239 239
 		{
240
-			$view = $this->patchItems( $view, $body, $header );
240
+			$view = $this->patchItems($view, $body, $header);
241 241
 			$status = 200;
242 242
 		}
243
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
243
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
244 244
 		{
245 245
 			$status = $e->getCode();
246
-			$view->errors = array( array(
247
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
246
+			$view->errors = array(array(
247
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
248 248
 				'detail' => $e->getTraceAsString(),
249
-			) );
249
+			));
250 250
 		}
251
-		catch( \Aimeos\MAdmin\Exception $e )
251
+		catch (\Aimeos\MAdmin\Exception $e)
252 252
 		{
253 253
 			$status = 404;
254
-			$view->errors = array( array(
255
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
254
+			$view->errors = array(array(
255
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
256 256
 				'detail' => $e->getTraceAsString(),
257
-			) );
257
+			));
258 258
 		}
259
-		catch( \Aimeos\MShop\Exception $e )
259
+		catch (\Aimeos\MShop\Exception $e)
260 260
 		{
261 261
 			$status = 404;
262
-			$view->errors = array( array(
263
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
262
+			$view->errors = array(array(
263
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
264 264
 				'detail' => $e->getTraceAsString(),
265
-			) );
265
+			));
266 266
 		}
267
-		catch( \Exception $e )
267
+		catch (\Exception $e)
268 268
 		{
269 269
 			$status = 500;
270
-			$view->errors = array( array(
270
+			$view->errors = array(array(
271 271
 				'title' => $e->getMessage(),
272 272
 				'detail' => $e->getTraceAsString(),
273
-			) );
273
+			));
274 274
 		}
275 275
 
276 276
 		/** admin/jsonadm/standard/template-patch
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		$tplconf = 'admin/jsonadm/standard/template-patch';
301 301
 		$default = 'patch-default.php';
302 302
 
303
-		return $view->render( $view->config( $tplconf, $default ) );
303
+		return $view->render($view->config($tplconf, $default));
304 304
 	}
305 305
 
306 306
 
@@ -312,48 +312,48 @@  discard block
 block discarded – undo
312 312
 	 * @param integer &$status Variable which contains the HTTP status afterwards
313 313
 	 * @return string Content for response body
314 314
 	 */
315
-	public function post( $body, array &$header, &$status )
315
+	public function post($body, array &$header, &$status)
316 316
 	{
317
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
317
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
318 318
 		$context = $this->getContext();
319 319
 		$view = $this->getView();
320 320
 
321 321
 		try
322 322
 		{
323
-			$view = $this->postItems( $view, $body, $header );
323
+			$view = $this->postItems($view, $body, $header);
324 324
 			$status = 201;
325 325
 		}
326
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
326
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
327 327
 		{
328 328
 			$status = $e->getCode();
329
-			$view->errors = array( array(
330
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
329
+			$view->errors = array(array(
330
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
331 331
 				'detail' => $e->getTraceAsString(),
332
-			) );
332
+			));
333 333
 		}
334
-		catch( \Aimeos\MAdmin\Exception $e )
334
+		catch (\Aimeos\MAdmin\Exception $e)
335 335
 		{
336 336
 			$status = 404;
337
-			$view->errors = array( array(
338
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
337
+			$view->errors = array(array(
338
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
339 339
 				'detail' => $e->getTraceAsString(),
340
-			) );
340
+			));
341 341
 		}
342
-		catch( \Aimeos\MShop\Exception $e )
342
+		catch (\Aimeos\MShop\Exception $e)
343 343
 		{
344 344
 			$status = 404;
345
-			$view->errors = array( array(
346
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
345
+			$view->errors = array(array(
346
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
347 347
 				'detail' => $e->getTraceAsString(),
348
-			) );
348
+			));
349 349
 		}
350
-		catch( \Exception $e )
350
+		catch (\Exception $e)
351 351
 		{
352 352
 			$status = 500;
353
-			$view->errors = array( array(
353
+			$view->errors = array(array(
354 354
 				'title' => $e->getMessage(),
355 355
 				'detail' => $e->getTraceAsString(),
356
-			) );
356
+			));
357 357
 		}
358 358
 
359 359
 		/** admin/jsonadm/standard/template-post
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		$tplconf = 'admin/jsonadm/standard/template-post';
384 384
 		$default = 'post-default.php';
385 385
 
386
-		return $view->render( $view->config( $tplconf, $default ) );
386
+		return $view->render($view->config($tplconf, $default));
387 387
 	}
388 388
 
389 389
 
@@ -395,17 +395,17 @@  discard block
 block discarded – undo
395 395
 	 * @param integer &$status Variable which contains the HTTP status afterwards
396 396
 	 * @return string Content for response body
397 397
 	 */
398
-	public function put( $body, array &$header, &$status )
398
+	public function put($body, array &$header, &$status)
399 399
 	{
400
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
400
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
401 401
 		$status = 501;
402 402
 
403 403
 		$context = $this->getContext();
404 404
 		$view = $this->getView();
405 405
 
406
-		$view->errors = array( array(
407
-			'title' => $context->getI18n()->dt( 'admin/jsonadm', 'Not implemented, use PATCH instead' ),
408
-		) );
406
+		$view->errors = array(array(
407
+			'title' => $context->getI18n()->dt('admin/jsonadm', 'Not implemented, use PATCH instead'),
408
+		));
409 409
 
410 410
 		/** admin/jsonadm/standard/template-put
411 411
 		 * Relative path to the JSON API template for PUT requests
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		$tplconf = 'admin/jsonadm/standard/template-put';
435 435
 		$default = 'put-default.php';
436 436
 
437
-		return $view->render( $view->config( $tplconf, $default ) );
437
+		return $view->render($view->config($tplconf, $default));
438 438
 	}
439 439
 
440 440
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	 * @param integer &$status Variable which contains the HTTP status afterwards
447 447
 	 * @return string Content for response body
448 448
 	 */
449
-	public function options( $body, array &$header, &$status )
449
+	public function options($body, array &$header, &$status)
450 450
 	{
451 451
 		$context = $this->getContext();
452 452
 		$view = $this->getView();
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		{
456 456
 			$resources = $attributes = array();
457 457
 
458
-			if( ( $domains = $view->param( 'resource' ) ) == '' )
458
+			if (($domains = $view->param('resource')) == '')
459 459
 			{
460 460
 				/** admin/jsonadm/domains
461 461
 				 * A list of domain names whose clients are available for the JSON API
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
 					'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media',
478 478
 					'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text'
479 479
 				);
480
-				$domains = $context->getConfig()->get( 'admin/jsonadm/domains', $default );
480
+				$domains = $context->getConfig()->get('admin/jsonadm/domains', $default);
481 481
 			}
482 482
 
483
-			foreach( (array) $domains as $domain )
483
+			foreach ((array) $domains as $domain)
484 484
 			{
485
-				$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
486
-				$resources = array_merge( $resources, $manager->getResourceType( true ) );
487
-				$attributes = array_merge( $attributes, $manager->getSearchAttributes( true ) );
485
+				$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
486
+				$resources = array_merge($resources, $manager->getResourceType(true));
487
+				$attributes = array_merge($attributes, $manager->getSearchAttributes(true));
488 488
 			}
489 489
 
490 490
 			$view->resources = $resources;
@@ -496,29 +496,29 @@  discard block
 block discarded – undo
496 496
 			);
497 497
 			$status = 200;
498 498
 		}
499
-		catch( \Aimeos\MAdmin\Exception $e )
499
+		catch (\Aimeos\MAdmin\Exception $e)
500 500
 		{
501 501
 			$status = 404;
502
-			$view->errors = array( array(
503
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
502
+			$view->errors = array(array(
503
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
504 504
 				'detail' => $e->getTraceAsString(),
505
-			) );
505
+			));
506 506
 		}
507
-		catch( \Aimeos\MShop\Exception $e )
507
+		catch (\Aimeos\MShop\Exception $e)
508 508
 		{
509 509
 			$status = 404;
510
-			$view->errors = array( array(
511
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
510
+			$view->errors = array(array(
511
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
512 512
 				'detail' => $e->getTraceAsString(),
513
-			) );
513
+			));
514 514
 		}
515
-		catch( \Exception $e )
515
+		catch (\Exception $e)
516 516
 		{
517 517
 			$status = 500;
518
-			$view->errors = array( array(
518
+			$view->errors = array(array(
519 519
 				'title' => $e->getMessage(),
520 520
 				'detail' => $e->getTraceAsString(),
521
-			) );
521
+			));
522 522
 		}
523 523
 
524 524
 		/** admin/jsonadm/standard/template-options
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		$tplconf = 'admin/jsonadm/standard/template-options';
549 549
 		$default = 'options-default.php';
550 550
 
551
-		return $view->render( $view->config( $tplconf, $default ) );
551
+		return $view->render($view->config($tplconf, $default));
552 552
 	}
553 553
 
554 554
 
@@ -560,31 +560,31 @@  discard block
 block discarded – undo
560 560
 	 * @return \Aimeos\MW\View\Iface $view View object that will contain the "total" property afterwards
561 561
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the request body is invalid
562 562
 	 */
563
-	protected function deleteItems( \Aimeos\MW\View\Iface $view, $body )
563
+	protected function deleteItems(\Aimeos\MW\View\Iface $view, $body)
564 564
 	{
565
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
565
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
566 566
 
567
-		if( ( $id = $view->param( 'id' ) ) == null )
567
+		if (($id = $view->param('id')) == null)
568 568
 		{
569
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) || !is_array( $request->data ) ) {
570
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
569
+			if (($request = json_decode($body)) === null || !isset($request->data) || !is_array($request->data)) {
570
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
571 571
 			}
572 572
 
573 573
 			$ids = array();
574 574
 
575
-			foreach( $request->data as $entry )
575
+			foreach ($request->data as $entry)
576 576
 			{
577
-				if( isset( $entry->id ) ) {
577
+				if (isset($entry->id)) {
578 578
 					$ids[] = $entry->id;
579 579
 				}
580 580
 			}
581 581
 
582
-			$manager->deleteItems( $ids );
583
-			$view->total = count( $ids );
582
+			$manager->deleteItems($ids);
583
+			$view->total = count($ids);
584 584
 		}
585 585
 		else
586 586
 		{
587
-			$manager->deleteItem( $id );
587
+			$manager->deleteItem($id);
588 588
 			$view->total = 1;
589 589
 		}
590 590
 
@@ -610,11 +610,11 @@  discard block
 block discarded – undo
610 610
 	 * @param array $params List of criteria data with condition, sorting and paging
611 611
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
612 612
 	 */
613
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
613
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
614 614
 	{
615
-		$this->initCriteriaConditions( $criteria, $params );
616
-		$this->initCriteriaSortations( $criteria, $params );
617
-		$this->initCriteriaSlice( $criteria, $params );
615
+		$this->initCriteriaConditions($criteria, $params);
616
+		$this->initCriteriaSortations($criteria, $params);
617
+		$this->initCriteriaSlice($criteria, $params);
618 618
 
619 619
 		return $criteria;
620 620
 	}
@@ -626,15 +626,15 @@  discard block
 block discarded – undo
626 626
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
627 627
 	 * @param array $params List of criteria data with condition, sorting and paging
628 628
 	 */
629
-	private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
629
+	private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
630 630
 	{
631
-		if( isset( $params['filter'] ) && is_array( $params['filter'] ) )
631
+		if (isset($params['filter']) && is_array($params['filter']))
632 632
 		{
633 633
 			$existing = $criteria->getConditions();
634
-			$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
634
+			$criteria->setConditions($criteria->toConditions((array) $params['filter']));
635 635
 
636
-			$expr = array( $criteria->getConditions(), $existing );
637
-			$criteria->setConditions( $criteria->combine( '&&', $expr ) );
636
+			$expr = array($criteria->getConditions(), $existing);
637
+			$criteria->setConditions($criteria->combine('&&', $expr));
638 638
 		}
639 639
 	}
640 640
 
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
646 646
 	 * @param array $params List of criteria data with condition, sorting and paging
647 647
 	 */
648
-	private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
648
+	private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
649 649
 	{
650
-		$start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 );
651
-		$size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 25 );
650
+		$start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0);
651
+		$size = (isset($params['page']['limit']) ? $params['page']['limit'] : 25);
652 652
 
653
-		$criteria->setSlice( $start, $size );
653
+		$criteria->setSlice($start, $size);
654 654
 	}
655 655
 
656 656
 
@@ -660,24 +660,24 @@  discard block
 block discarded – undo
660 660
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
661 661
 	 * @param array $params List of criteria data with condition, sorting and paging
662 662
 	 */
663
-	private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
663
+	private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
664 664
 	{
665
-		if( !isset( $params['sort'] ) ) {
665
+		if (!isset($params['sort'])) {
666 666
 			return;
667 667
 		}
668 668
 
669 669
 		$sortation = array();
670 670
 
671
-		foreach( explode( ',', $params['sort'] ) as $sort )
671
+		foreach (explode(',', $params['sort']) as $sort)
672 672
 		{
673
-			if( $sort[0] === '-' ) {
674
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
673
+			if ($sort[0] === '-') {
674
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
675 675
 			} else {
676
-				$sortation[] = $criteria->sort( '+', $sort ); break;
676
+				$sortation[] = $criteria->sort('+', $sort); break;
677 677
 			}
678 678
 		}
679 679
 
680
-		$criteria->setSortations( $sortation );
680
+		$criteria->setSortations($sortation);
681 681
 	}
682 682
 
683 683
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param array $include List of resource types that should be fetched
689 689
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
690 690
 	 */
691
-	protected function getChildItems( array $items, array $include )
691
+	protected function getChildItems(array $items, array $include)
692 692
 	{
693 693
 		return array();
694 694
 	}
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * @param array $include List of resource types that should be fetched
702 702
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
703 703
 	 */
704
-	protected function getListItems( array $items, array $include )
704
+	protected function getListItems(array $items, array $include)
705 705
 	{
706 706
 		return array();
707 707
 	}
@@ -713,22 +713,22 @@  discard block
 block discarded – undo
713 713
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
714 714
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
715 715
 	 */
716
-	protected function getRefItems( array $listItems )
716
+	protected function getRefItems(array $listItems)
717 717
 	{
718 718
 		$list = $map = array();
719 719
 
720
-		foreach( $listItems as $listItem ) {
720
+		foreach ($listItems as $listItem) {
721 721
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
722 722
 		}
723 723
 
724
-		foreach( $map as $domain => $ids )
724
+		foreach ($map as $domain => $ids)
725 725
 		{
726
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
726
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
727 727
 
728 728
 			$search = $manager->createSearch();
729
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
729
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
730 730
 
731
-			$list = array_merge( $list, $manager->searchItems( $search ) );
731
+			$list = array_merge($list, $manager->searchItems($search));
732 732
 		}
733 733
 
734 734
 		return $list;
@@ -777,30 +777,30 @@  discard block
 block discarded – undo
777 777
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If "id" parameter isn't available or the body is invalid
778 778
 	 * @return \Aimeos\MW\View\Iface Updated view instance
779 779
 	 */
780
-	protected function patchItems( \Aimeos\MW\View\Iface $view, $body, array &$header )
780
+	protected function patchItems(\Aimeos\MW\View\Iface $view, $body, array &$header)
781 781
 	{
782
-		if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
783
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
782
+		if (($request = json_decode($body)) === null || !isset($request->data)) {
783
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
784 784
 		}
785 785
 
786
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
786
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
787 787
 
788
-		if( is_array( $request->data ) )
788
+		if (is_array($request->data))
789 789
 		{
790
-			$data = $this->saveData( $manager, $request );
790
+			$data = $this->saveData($manager, $request);
791 791
 
792 792
 			$view->data = $data;
793
-			$view->total = count( $data );
793
+			$view->total = count($data);
794 794
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
795 795
 		}
796 796
 		else
797 797
 		{
798
-			if( ( $id = $view->param( 'id' ) ) == null ) {
799
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
798
+			if (($id = $view->param('id')) == null) {
799
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
800 800
 			}
801 801
 
802 802
 			$request->data->id = $id;
803
-			$data = $this->saveEntry( $manager, $request->data );
803
+			$data = $this->saveEntry($manager, $request->data);
804 804
 
805 805
 			$view->data = $data;
806 806
 			$view->total = 1;
@@ -818,31 +818,31 @@  discard block
 block discarded – undo
818 818
 	 * @param array &$header Associative list of HTTP headers as value/result parameter
819 819
 	 * @return \Aimeos\MW\View\Iface Updated view instance
820 820
 	 */
821
-	protected function postItems( \Aimeos\MW\View\Iface $view, $body, array &$header )
821
+	protected function postItems(\Aimeos\MW\View\Iface $view, $body, array &$header)
822 822
 	{
823
-		if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
824
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
823
+		if (($request = json_decode($body)) === null || !isset($request->data)) {
824
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
825 825
 		}
826 826
 
827
-		if( isset( $request->data->id ) || $view->param( 'id' ) != null ) {
828
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Client generated IDs are not supported' ), 403 );
827
+		if (isset($request->data->id) || $view->param('id') != null) {
828
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Client generated IDs are not supported'), 403);
829 829
 		}
830 830
 
831 831
 
832
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
832
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
833 833
 
834
-		if( is_array( $request->data ) )
834
+		if (is_array($request->data))
835 835
 		{
836
-			$data = $this->saveData( $manager, $request );
836
+			$data = $this->saveData($manager, $request);
837 837
 
838 838
 			$view->data = $data;
839
-			$view->total = count( $data );
839
+			$view->total = count($data);
840 840
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
841 841
 		}
842 842
 		else
843 843
 		{
844 844
 			$request->data->id = null;
845
-			$data = $this->saveEntry( $manager, $request->data );
845
+			$data = $this->saveEntry($manager, $request->data);
846 846
 
847 847
 			$view->data = $data;
848 848
 			$view->total = 1;
@@ -859,14 +859,14 @@  discard block
 block discarded – undo
859 859
 	 * @param \stdClass $request Object with request body data
860 860
 	 * @return array List of items
861 861
 	 */
862
-	protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request )
862
+	protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request)
863 863
 	{
864 864
 		$data = array();
865 865
 
866
-		if( isset( $request->data ) )
866
+		if (isset($request->data))
867 867
 		{
868
-			foreach( (array) $request->data as $entry ) {
869
-				$data[] = $this->saveEntry( $manager, $entry );
868
+			foreach ((array) $request->data as $entry) {
869
+				$data[] = $this->saveEntry($manager, $entry);
870 870
 			}
871 871
 		}
872 872
 
@@ -881,19 +881,19 @@  discard block
 block discarded – undo
881 881
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
882 882
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
883 883
 	 */
884
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
884
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
885 885
 	{
886
-		$attr = ( isset( $entry->attributes ) ? (array) $entry->attributes : array() );
886
+		$attr = (isset($entry->attributes) ? (array) $entry->attributes : array());
887 887
 
888
-		if( isset( $entry->id ) && $entry->id !== null ) {
889
-			$item = $manager->getItem( $entry->id );
888
+		if (isset($entry->id) && $entry->id !== null) {
889
+			$item = $manager->getItem($entry->id);
890 890
 		} else {
891 891
 			$item = $manager->createItem();
892 892
 		}
893 893
 
894
-		$item->fromArray( $attr );
895
-		$manager->saveItem( $item );
894
+		$item->fromArray($attr);
895
+		$manager->saveItem($item);
896 896
 
897
-		return $manager->getItem( $item->getId() );
897
+		return $manager->getItem($item->getId());
898 898
 	}
899 899
 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -44 removed lines patch added patch discarded remove patch
@@ -61,32 +61,28 @@  discard block
 block discarded – undo
61 61
 		{
62 62
 			$view = $this->deleteItems( $view, $body );
63 63
 			$status = 200;
64
-		}
65
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
64
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
66 65
 		{
67 66
 			$status = $e->getCode();
68 67
 			$view->errors = array( array(
69 68
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
70 69
 				'detail' => $e->getTraceAsString(),
71 70
 			) );
72
-		}
73
-		catch( \Aimeos\MAdmin\Exception $e )
71
+		} catch( \Aimeos\MAdmin\Exception $e )
74 72
 		{
75 73
 			$status = 404;
76 74
 			$view->errors = array( array(
77 75
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
78 76
 				'detail' => $e->getTraceAsString(),
79 77
 			) );
80
-		}
81
-		catch( \Aimeos\MShop\Exception $e )
78
+		} catch( \Aimeos\MShop\Exception $e )
82 79
 		{
83 80
 			$status = 404;
84 81
 			$view->errors = array( array(
85 82
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
86 83
 				'detail' => $e->getTraceAsString(),
87 84
 			) );
88
-		}
89
-		catch( \Exception $e )
85
+		} catch( \Exception $e )
90 86
 		{
91 87
 			$status = 500;
92 88
 			$view->errors = array( array(
@@ -152,8 +148,7 @@  discard block
 block discarded – undo
152 148
 				$view->data = $manager->searchItems( $search, array(), $total );
153 149
 				$view->childItems = $this->getChildItems( $view->data, $include );
154 150
 				$view->listItems = $this->getListItems( $view->data, $include );
155
-			}
156
-			else
151
+			} else
157 152
 			{
158 153
 				$view->data = $manager->getItem( $id, array() );
159 154
 				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
@@ -164,24 +159,21 @@  discard block
 block discarded – undo
164 159
 
165 160
 			$view->total = $total;
166 161
 			$status = 200;
167
-		}
168
-		catch( \Aimeos\MAdmin\Exception $e )
162
+		} catch( \Aimeos\MAdmin\Exception $e )
169 163
 		{
170 164
 			$status = 404;
171 165
 			$view->errors = array( array(
172 166
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
173 167
 				'detail' => $e->getTraceAsString(),
174 168
 			) );
175
-		}
176
-		catch( \Aimeos\MShop\Exception $e )
169
+		} catch( \Aimeos\MShop\Exception $e )
177 170
 		{
178 171
 			$status = 404;
179 172
 			$view->errors = array( array(
180 173
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
181 174
 				'detail' => $e->getTraceAsString(),
182 175
 			) );
183
-		}
184
-		catch( \Exception $e )
176
+		} catch( \Exception $e )
185 177
 		{
186 178
 			$status = 500;
187 179
 			$view->errors = array( array(
@@ -239,32 +231,28 @@  discard block
 block discarded – undo
239 231
 		{
240 232
 			$view = $this->patchItems( $view, $body, $header );
241 233
 			$status = 200;
242
-		}
243
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
234
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
244 235
 		{
245 236
 			$status = $e->getCode();
246 237
 			$view->errors = array( array(
247 238
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
248 239
 				'detail' => $e->getTraceAsString(),
249 240
 			) );
250
-		}
251
-		catch( \Aimeos\MAdmin\Exception $e )
241
+		} catch( \Aimeos\MAdmin\Exception $e )
252 242
 		{
253 243
 			$status = 404;
254 244
 			$view->errors = array( array(
255 245
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
256 246
 				'detail' => $e->getTraceAsString(),
257 247
 			) );
258
-		}
259
-		catch( \Aimeos\MShop\Exception $e )
248
+		} catch( \Aimeos\MShop\Exception $e )
260 249
 		{
261 250
 			$status = 404;
262 251
 			$view->errors = array( array(
263 252
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
264 253
 				'detail' => $e->getTraceAsString(),
265 254
 			) );
266
-		}
267
-		catch( \Exception $e )
255
+		} catch( \Exception $e )
268 256
 		{
269 257
 			$status = 500;
270 258
 			$view->errors = array( array(
@@ -322,32 +310,28 @@  discard block
 block discarded – undo
322 310
 		{
323 311
 			$view = $this->postItems( $view, $body, $header );
324 312
 			$status = 201;
325
-		}
326
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
313
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
327 314
 		{
328 315
 			$status = $e->getCode();
329 316
 			$view->errors = array( array(
330 317
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
331 318
 				'detail' => $e->getTraceAsString(),
332 319
 			) );
333
-		}
334
-		catch( \Aimeos\MAdmin\Exception $e )
320
+		} catch( \Aimeos\MAdmin\Exception $e )
335 321
 		{
336 322
 			$status = 404;
337 323
 			$view->errors = array( array(
338 324
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
339 325
 				'detail' => $e->getTraceAsString(),
340 326
 			) );
341
-		}
342
-		catch( \Aimeos\MShop\Exception $e )
327
+		} catch( \Aimeos\MShop\Exception $e )
343 328
 		{
344 329
 			$status = 404;
345 330
 			$view->errors = array( array(
346 331
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
347 332
 				'detail' => $e->getTraceAsString(),
348 333
 			) );
349
-		}
350
-		catch( \Exception $e )
334
+		} catch( \Exception $e )
351 335
 		{
352 336
 			$status = 500;
353 337
 			$view->errors = array( array(
@@ -495,24 +479,21 @@  discard block
 block discarded – undo
495 479
 				'Allow' => 'DELETE,GET,POST,OPTIONS'
496 480
 			);
497 481
 			$status = 200;
498
-		}
499
-		catch( \Aimeos\MAdmin\Exception $e )
482
+		} catch( \Aimeos\MAdmin\Exception $e )
500 483
 		{
501 484
 			$status = 404;
502 485
 			$view->errors = array( array(
503 486
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
504 487
 				'detail' => $e->getTraceAsString(),
505 488
 			) );
506
-		}
507
-		catch( \Aimeos\MShop\Exception $e )
489
+		} catch( \Aimeos\MShop\Exception $e )
508 490
 		{
509 491
 			$status = 404;
510 492
 			$view->errors = array( array(
511 493
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
512 494
 				'detail' => $e->getTraceAsString(),
513 495
 			) );
514
-		}
515
-		catch( \Exception $e )
496
+		} catch( \Exception $e )
516 497
 		{
517 498
 			$status = 500;
518 499
 			$view->errors = array( array(
@@ -581,8 +562,7 @@  discard block
 block discarded – undo
581 562
 
582 563
 			$manager->deleteItems( $ids );
583 564
 			$view->total = count( $ids );
584
-		}
585
-		else
565
+		} else
586 566
 		{
587 567
 			$manager->deleteItem( $id );
588 568
 			$view->total = 1;
@@ -792,8 +772,7 @@  discard block
 block discarded – undo
792 772
 			$view->data = $data;
793 773
 			$view->total = count( $data );
794 774
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
795
-		}
796
-		else
775
+		} else
797 776
 		{
798 777
 			if( ( $id = $view->param( 'id' ) ) == null ) {
799 778
 				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
@@ -838,8 +817,7 @@  discard block
 block discarded – undo
838 817
 			$view->data = $data;
839 818
 			$view->total = count( $data );
840 819
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
841
-		}
842
-		else
820
+		} else
843 821
 		{
844 822
 			$request->data->id = null;
845 823
 			$data = $this->saveEntry( $manager, $request->data );
Please login to merge, or discard this patch.