Completed
Push — master ( 360704...7da046 )
by Aimeos
02:36
created
admin/jsonadm/src/Admin/JsonAdm/Base.php 1 patch
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array $templatePaths List of file system paths where the templates are stored
34 34
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
36
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
37 37
 	{
38 38
 		$this->view = $view;
39 39
 		$this->context = $context;
@@ -50,48 +50,48 @@  discard block
 block discarded – undo
50 50
 	 * @param integer &$status Variable which contains the HTTP status afterwards
51 51
 	 * @return string Content for response body
52 52
 	 */
53
-	public function delete( $body, array &$header, &$status )
53
+	public function delete($body, array &$header, &$status)
54 54
 	{
55
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
55
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
56 56
 		$context = $this->getContext();
57 57
 		$view = $this->getView();
58 58
 
59 59
 		try
60 60
 		{
61
-			$view = $this->deleteItems( $view, $body );
61
+			$view = $this->deleteItems($view, $body);
62 62
 			$status = 200;
63 63
 		}
64
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
64
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
65 65
 		{
66 66
 			$status = $e->getCode();
67
-			$view->errors = array( array(
68
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
67
+			$view->errors = array(array(
68
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
69 69
 				'detail' => $e->getTraceAsString(),
70
-			) );
70
+			));
71 71
 		}
72
-		catch( \Aimeos\MAdmin\Exception $e )
72
+		catch (\Aimeos\MAdmin\Exception $e)
73 73
 		{
74 74
 			$status = 404;
75
-			$view->errors = array( array(
76
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
75
+			$view->errors = array(array(
76
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
77 77
 				'detail' => $e->getTraceAsString(),
78
-			) );
78
+			));
79 79
 		}
80
-		catch( \Aimeos\MShop\Exception $e )
80
+		catch (\Aimeos\MShop\Exception $e)
81 81
 		{
82 82
 			$status = 404;
83
-			$view->errors = array( array(
84
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
83
+			$view->errors = array(array(
84
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
85 85
 				'detail' => $e->getTraceAsString(),
86
-			) );
86
+			));
87 87
 		}
88
-		catch( \Exception $e )
88
+		catch (\Exception $e)
89 89
 		{
90 90
 			$status = 500;
91
-			$view->errors = array( array(
91
+			$view->errors = array(array(
92 92
 				'title' => $e->getMessage(),
93 93
 				'detail' => $e->getTraceAsString(),
94
-			) );
94
+			));
95 95
 		}
96 96
 
97 97
 		/** admin/jsonadm/standard/template-delete
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$tplconf = 'admin/jsonadm/standard/template-delete';
122 122
 		$default = 'delete-default.php';
123 123
 
124
-		return $view->render( $view->config( $tplconf, $default ) );
124
+		return $view->render($view->config($tplconf, $default));
125 125
 	}
126 126
 
127 127
 
@@ -133,39 +133,39 @@  discard block
 block discarded – undo
133 133
 	 * @param integer &$status Variable which contains the HTTP status afterwards
134 134
 	 * @return string Content for response body
135 135
 	 */
136
-	public function get( $body, array &$header, &$status )
136
+	public function get($body, array &$header, &$status)
137 137
 	{
138
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
138
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
139 139
 		$view = $this->getView();
140 140
 
141 141
 		try
142 142
 		{
143
-			$view = $this->getItem( $view );
143
+			$view = $this->getItem($view);
144 144
 			$status = 200;
145 145
 		}
146
-		catch( \Aimeos\MAdmin\Exception $e )
146
+		catch (\Aimeos\MAdmin\Exception $e)
147 147
 		{
148 148
 			$status = 404;
149
-			$view->errors = array( array(
150
-				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
149
+			$view->errors = array(array(
150
+				'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()),
151 151
 				'detail' => $e->getTraceAsString(),
152
-			) );
152
+			));
153 153
 		}
154
-		catch( \Aimeos\MShop\Exception $e )
154
+		catch (\Aimeos\MShop\Exception $e)
155 155
 		{
156 156
 			$status = 404;
157
-			$view->errors = array( array(
158
-				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
157
+			$view->errors = array(array(
158
+				'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()),
159 159
 				'detail' => $e->getTraceAsString(),
160
-			) );
160
+			));
161 161
 		}
162
-		catch( \Exception $e )
162
+		catch (\Exception $e)
163 163
 		{
164 164
 			$status = 500;
165
-			$view->errors = array( array(
165
+			$view->errors = array(array(
166 166
 				'title' => $e->getMessage(),
167 167
 				'detail' => $e->getTraceAsString(),
168
-			) );
168
+			));
169 169
 		}
170 170
 
171 171
 		/** admin/jsonadm/standard/template-get
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		$tplconf = 'admin/jsonadm/standard/template-get';
196 196
 		$default = 'get-default.php';
197 197
 
198
-		return $view->render( $view->config( $tplconf, $default ) );
198
+		return $view->render($view->config($tplconf, $default));
199 199
 	}
200 200
 
201 201
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 * @param integer &$status Variable which contains the HTTP status afterwards
208 208
 	 * @return string Content for response body
209 209
 	 */
210
-	public function patch( $body, array &$header, &$status )
210
+	public function patch($body, array &$header, &$status)
211 211
 	{
212
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
212
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
213 213
 		$context = $this->getContext();
214 214
 		$view = $this->getView();
215 215
 
216 216
 		try
217 217
 		{
218
-			$view = $this->patchItems( $view, $body, $header );
218
+			$view = $this->patchItems($view, $body, $header);
219 219
 			$status = 200;
220 220
 		}
221
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
221
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
222 222
 		{
223 223
 			$status = $e->getCode();
224
-			$view->errors = array( array(
225
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
224
+			$view->errors = array(array(
225
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
226 226
 				'detail' => $e->getTraceAsString(),
227
-			) );
227
+			));
228 228
 		}
229
-		catch( \Aimeos\MAdmin\Exception $e )
229
+		catch (\Aimeos\MAdmin\Exception $e)
230 230
 		{
231 231
 			$status = 404;
232
-			$view->errors = array( array(
233
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
232
+			$view->errors = array(array(
233
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
234 234
 				'detail' => $e->getTraceAsString(),
235
-			) );
235
+			));
236 236
 		}
237
-		catch( \Aimeos\MShop\Exception $e )
237
+		catch (\Aimeos\MShop\Exception $e)
238 238
 		{
239 239
 			$status = 404;
240
-			$view->errors = array( array(
241
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
240
+			$view->errors = array(array(
241
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
242 242
 				'detail' => $e->getTraceAsString(),
243
-			) );
243
+			));
244 244
 		}
245
-		catch( \Exception $e )
245
+		catch (\Exception $e)
246 246
 		{
247 247
 			$status = 500;
248
-			$view->errors = array( array(
248
+			$view->errors = array(array(
249 249
 				'title' => $e->getMessage(),
250 250
 				'detail' => $e->getTraceAsString(),
251
-			) );
251
+			));
252 252
 		}
253 253
 
254 254
 		/** admin/jsonadm/standard/template-patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$tplconf = 'admin/jsonadm/standard/template-patch';
279 279
 		$default = 'patch-default.php';
280 280
 
281
-		return $view->render( $view->config( $tplconf, $default ) );
281
+		return $view->render($view->config($tplconf, $default));
282 282
 	}
283 283
 
284 284
 
@@ -290,48 +290,48 @@  discard block
 block discarded – undo
290 290
 	 * @param integer &$status Variable which contains the HTTP status afterwards
291 291
 	 * @return string Content for response body
292 292
 	 */
293
-	public function post( $body, array &$header, &$status )
293
+	public function post($body, array &$header, &$status)
294 294
 	{
295
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
295
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
296 296
 		$context = $this->getContext();
297 297
 		$view = $this->getView();
298 298
 
299 299
 		try
300 300
 		{
301
-			$view = $this->postItems( $view, $body, $header );
301
+			$view = $this->postItems($view, $body, $header);
302 302
 			$status = 201;
303 303
 		}
304
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
304
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
305 305
 		{
306 306
 			$status = $e->getCode();
307
-			$view->errors = array( array(
308
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
307
+			$view->errors = array(array(
308
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
309 309
 				'detail' => $e->getTraceAsString(),
310
-			) );
310
+			));
311 311
 		}
312
-		catch( \Aimeos\MAdmin\Exception $e )
312
+		catch (\Aimeos\MAdmin\Exception $e)
313 313
 		{
314 314
 			$status = 404;
315
-			$view->errors = array( array(
316
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
315
+			$view->errors = array(array(
316
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
317 317
 				'detail' => $e->getTraceAsString(),
318
-			) );
318
+			));
319 319
 		}
320
-		catch( \Aimeos\MShop\Exception $e )
320
+		catch (\Aimeos\MShop\Exception $e)
321 321
 		{
322 322
 			$status = 404;
323
-			$view->errors = array( array(
324
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
323
+			$view->errors = array(array(
324
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
325 325
 				'detail' => $e->getTraceAsString(),
326
-			) );
326
+			));
327 327
 		}
328
-		catch( \Exception $e )
328
+		catch (\Exception $e)
329 329
 		{
330 330
 			$status = 500;
331
-			$view->errors = array( array(
331
+			$view->errors = array(array(
332 332
 				'title' => $e->getMessage(),
333 333
 				'detail' => $e->getTraceAsString(),
334
-			) );
334
+			));
335 335
 		}
336 336
 
337 337
 		/** admin/jsonadm/standard/template-post
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		$tplconf = 'admin/jsonadm/standard/template-post';
362 362
 		$default = 'post-default.php';
363 363
 
364
-		return $view->render( $view->config( $tplconf, $default ) );
364
+		return $view->render($view->config($tplconf, $default));
365 365
 	}
366 366
 
367 367
 
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
 	 * @param integer &$status Variable which contains the HTTP status afterwards
374 374
 	 * @return string Content for response body
375 375
 	 */
376
-	public function put( $body, array &$header, &$status )
376
+	public function put($body, array &$header, &$status)
377 377
 	{
378
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
378
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
379 379
 		$status = 501;
380 380
 
381 381
 		$context = $this->getContext();
382 382
 		$view = $this->getView();
383 383
 
384
-		$view->errors = array( array(
385
-			'title' => $context->getI18n()->dt( 'admin/jsonadm', 'Not implemented, use PATCH instead' ),
386
-		) );
384
+		$view->errors = array(array(
385
+			'title' => $context->getI18n()->dt('admin/jsonadm', 'Not implemented, use PATCH instead'),
386
+		));
387 387
 
388 388
 		/** admin/jsonadm/standard/template-put
389 389
 		 * Relative path to the JSON API template for PUT requests
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 		$tplconf = 'admin/jsonadm/standard/template-put';
413 413
 		$default = 'put-default.php';
414 414
 
415
-		return $view->render( $view->config( $tplconf, $default ) );
415
+		return $view->render($view->config($tplconf, $default));
416 416
 	}
417 417
 
418 418
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 * @param integer &$status Variable which contains the HTTP status afterwards
425 425
 	 * @return string Content for response body
426 426
 	 */
427
-	public function options( $body, array &$header, &$status )
427
+	public function options($body, array &$header, &$status)
428 428
 	{
429 429
 		$context = $this->getContext();
430 430
 		$view = $this->getView();
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		{
434 434
 			$resources = $attributes = array();
435 435
 
436
-			foreach( $this->getDomains( $view ) as $domain )
436
+			foreach ($this->getDomains($view) as $domain)
437 437
 			{
438
-				$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
439
-				$resources = array_merge( $resources, $manager->getResourceType( true ) );
440
-				$attributes = array_merge( $attributes, $manager->getSearchAttributes( true ) );
438
+				$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
439
+				$resources = array_merge($resources, $manager->getResourceType(true));
440
+				$attributes = array_merge($attributes, $manager->getSearchAttributes(true));
441 441
 			}
442 442
 
443 443
 			$view->resources = $resources;
@@ -449,29 +449,29 @@  discard block
 block discarded – undo
449 449
 			);
450 450
 			$status = 200;
451 451
 		}
452
-		catch( \Aimeos\MAdmin\Exception $e )
452
+		catch (\Aimeos\MAdmin\Exception $e)
453 453
 		{
454 454
 			$status = 404;
455
-			$view->errors = array( array(
456
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
455
+			$view->errors = array(array(
456
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
457 457
 				'detail' => $e->getTraceAsString(),
458
-			) );
458
+			));
459 459
 		}
460
-		catch( \Aimeos\MShop\Exception $e )
460
+		catch (\Aimeos\MShop\Exception $e)
461 461
 		{
462 462
 			$status = 404;
463
-			$view->errors = array( array(
464
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
463
+			$view->errors = array(array(
464
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
465 465
 				'detail' => $e->getTraceAsString(),
466
-			) );
466
+			));
467 467
 		}
468
-		catch( \Exception $e )
468
+		catch (\Exception $e)
469 469
 		{
470 470
 			$status = 500;
471
-			$view->errors = array( array(
471
+			$view->errors = array(array(
472 472
 				'title' => $e->getMessage(),
473 473
 				'detail' => $e->getTraceAsString(),
474
-			) );
474
+			));
475 475
 		}
476 476
 
477 477
 		/** admin/jsonadm/standard/template-options
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		$tplconf = 'admin/jsonadm/standard/template-options';
502 502
 		$default = 'options-default.php';
503 503
 
504
-		return $view->render( $view->config( $tplconf, $default ) );
504
+		return $view->render($view->config($tplconf, $default));
505 505
 	}
506 506
 
507 507
 
@@ -513,23 +513,23 @@  discard block
 block discarded – undo
513 513
 	 * @return \Aimeos\MW\View\Iface $view View object that will contain the "total" property afterwards
514 514
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the request body is invalid
515 515
 	 */
516
-	protected function deleteItems( \Aimeos\MW\View\Iface $view, $body )
516
+	protected function deleteItems(\Aimeos\MW\View\Iface $view, $body)
517 517
 	{
518
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
518
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
519 519
 
520
-		if( ( $id = $view->param( 'id' ) ) == null )
520
+		if (($id = $view->param('id')) == null)
521 521
 		{
522
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) || !is_array( $request->data ) ) {
523
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
522
+			if (($request = json_decode($body)) === null || !isset($request->data) || !is_array($request->data)) {
523
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
524 524
 			}
525 525
 
526
-			$ids = $this->getIds( $request );
527
-			$manager->deleteItems( $ids );
528
-			$view->total = count( $ids );
526
+			$ids = $this->getIds($request);
527
+			$manager->deleteItems($ids);
528
+			$view->total = count($ids);
529 529
 		}
530 530
 		else
531 531
 		{
532
-			$manager->deleteItem( $id );
532
+			$manager->deleteItem($id);
533 533
 			$view->total = 1;
534 534
 		}
535 535
 
@@ -543,27 +543,27 @@  discard block
 block discarded – undo
543 543
 	 * @param \Aimeos\MW\View\Iface $view View instance
544 544
 	 * @return \Aimeos\MW\View\Iface View instance with additional data assigned
545 545
 	 */
546
-	protected function getItem( \Aimeos\MW\View\Iface $view )
546
+	protected function getItem(\Aimeos\MW\View\Iface $view)
547 547
 	{
548 548
 		$total = 1;
549
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
550
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
549
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
550
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
551 551
 
552
-		if( ( $id = $view->param( 'id' ) ) == null )
552
+		if (($id = $view->param('id')) == null)
553 553
 		{
554
-			$search = $this->initCriteria( $manager->createSearch(), $view->param() );
555
-			$view->data = $manager->searchItems( $search, array(), $total );
556
-			$view->childItems = $this->getChildItems( $view->data, $include );
557
-			$view->listItems = $this->getListItems( $view->data, $include );
554
+			$search = $this->initCriteria($manager->createSearch(), $view->param());
555
+			$view->data = $manager->searchItems($search, array(), $total);
556
+			$view->childItems = $this->getChildItems($view->data, $include);
557
+			$view->listItems = $this->getListItems($view->data, $include);
558 558
 		}
559 559
 		else
560 560
 		{
561
-			$view->data = $manager->getItem( $id, array() );
562
-			$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
563
-			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
561
+			$view->data = $manager->getItem($id, array());
562
+			$view->childItems = $this->getChildItems(array($id => $view->data), $include);
563
+			$view->listItems = $this->getListItems(array($id => $view->data), $include);
564 564
 		}
565 565
 
566
-		$view->refItems = $this->getRefItems( $view->listItems );
566
+		$view->refItems = $this->getRefItems($view->listItems);
567 567
 
568 568
 		$view->total = $total;
569 569
 
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 	 * @param array $params List of criteria data with condition, sorting and paging
589 589
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
590 590
 	 */
591
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
591
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
592 592
 	{
593
-		$this->initCriteriaConditions( $criteria, $params );
594
-		$this->initCriteriaSortations( $criteria, $params );
595
-		$this->initCriteriaSlice( $criteria, $params );
593
+		$this->initCriteriaConditions($criteria, $params);
594
+		$this->initCriteriaSortations($criteria, $params);
595
+		$this->initCriteriaSlice($criteria, $params);
596 596
 
597 597
 		return $criteria;
598 598
 	}
@@ -604,15 +604,15 @@  discard block
 block discarded – undo
604 604
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
605 605
 	 * @param array $params List of criteria data with condition, sorting and paging
606 606
 	 */
607
-	private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
607
+	private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
608 608
 	{
609
-		if( isset( $params['filter'] ) && is_array( $params['filter'] ) )
609
+		if (isset($params['filter']) && is_array($params['filter']))
610 610
 		{
611 611
 			$existing = $criteria->getConditions();
612
-			$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
612
+			$criteria->setConditions($criteria->toConditions((array) $params['filter']));
613 613
 
614
-			$expr = array( $criteria->getConditions(), $existing );
615
-			$criteria->setConditions( $criteria->combine( '&&', $expr ) );
614
+			$expr = array($criteria->getConditions(), $existing);
615
+			$criteria->setConditions($criteria->combine('&&', $expr));
616 616
 		}
617 617
 	}
618 618
 
@@ -623,12 +623,12 @@  discard block
 block discarded – undo
623 623
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
624 624
 	 * @param array $params List of criteria data with condition, sorting and paging
625 625
 	 */
626
-	private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
626
+	private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
627 627
 	{
628
-		$start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 );
629
-		$size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 25 );
628
+		$start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0);
629
+		$size = (isset($params['page']['limit']) ? $params['page']['limit'] : 25);
630 630
 
631
-		$criteria->setSlice( $start, $size );
631
+		$criteria->setSlice($start, $size);
632 632
 	}
633 633
 
634 634
 
@@ -638,24 +638,24 @@  discard block
 block discarded – undo
638 638
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
639 639
 	 * @param array $params List of criteria data with condition, sorting and paging
640 640
 	 */
641
-	private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
641
+	private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
642 642
 	{
643
-		if( !isset( $params['sort'] ) ) {
643
+		if (!isset($params['sort'])) {
644 644
 			return;
645 645
 		}
646 646
 
647 647
 		$sortation = array();
648 648
 
649
-		foreach( explode( ',', $params['sort'] ) as $sort )
649
+		foreach (explode(',', $params['sort']) as $sort)
650 650
 		{
651
-			if( $sort[0] === '-' ) {
652
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
651
+			if ($sort[0] === '-') {
652
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
653 653
 			} else {
654
-				$sortation[] = $criteria->sort( '+', $sort ); break;
654
+				$sortation[] = $criteria->sort('+', $sort); break;
655 655
 			}
656 656
 		}
657 657
 
658
-		$criteria->setSortations( $sortation );
658
+		$criteria->setSortations($sortation);
659 659
 	}
660 660
 
661 661
 
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
666 666
 	 * @return array List of domain names
667 667
 	 */
668
-	protected function getDomains( \Aimeos\MW\View\Iface $view )
668
+	protected function getDomains(\Aimeos\MW\View\Iface $view)
669 669
 	{
670
-		if( ( $domains = $view->param( 'resource' ) ) == '' )
670
+		if (($domains = $view->param('resource')) == '')
671 671
 		{
672 672
 			/** admin/jsonadm/domains
673 673
 			 * A list of domain names whose clients are available for the JSON API
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 				'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media',
690 690
 				'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text'
691 691
 			);
692
-			$domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default );
692
+			$domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
693 693
 		}
694 694
 
695 695
 		return (array) $domains;
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	 * @param array $include List of resource types that should be fetched
704 704
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
705 705
 	 */
706
-	protected function getChildItems( array $items, array $include )
706
+	protected function getChildItems(array $items, array $include)
707 707
 	{
708 708
 		return array();
709 709
 	}
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @param array $include List of resource types that should be fetched
717 717
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
718 718
 	 */
719
-	protected function getListItems( array $items, array $include )
719
+	protected function getListItems(array $items, array $include)
720 720
 	{
721 721
 		return array();
722 722
 	}
@@ -728,22 +728,22 @@  discard block
 block discarded – undo
728 728
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
729 729
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
730 730
 	 */
731
-	protected function getRefItems( array $listItems )
731
+	protected function getRefItems(array $listItems)
732 732
 	{
733 733
 		$list = $map = array();
734 734
 
735
-		foreach( $listItems as $listItem ) {
735
+		foreach ($listItems as $listItem) {
736 736
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
737 737
 		}
738 738
 
739
-		foreach( $map as $domain => $ids )
739
+		foreach ($map as $domain => $ids)
740 740
 		{
741
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
741
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
742 742
 
743 743
 			$search = $manager->createSearch();
744
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
744
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
745 745
 
746
-			$list = array_merge( $list, $manager->searchItems( $search ) );
746
+			$list = array_merge($list, $manager->searchItems($search));
747 747
 		}
748 748
 
749 749
 		return $list;
@@ -756,15 +756,15 @@  discard block
 block discarded – undo
756 756
 	 * @param \stdClass $request Decoded request body
757 757
 	 * @return array List of item IDs
758 758
 	 */
759
-	protected function getIds( $request )
759
+	protected function getIds($request)
760 760
 	{
761 761
 		$ids = array();
762 762
 
763
-		if( isset( $request->data ) )
763
+		if (isset($request->data))
764 764
 		{
765
-			foreach( $request->data as $entry )
765
+			foreach ($request->data as $entry)
766 766
 			{
767
-				if( isset( $entry->id ) ) {
767
+				if (isset($entry->id)) {
768 768
 					$ids[] = $entry->id;
769 769
 				}
770 770
 			}
@@ -816,30 +816,30 @@  discard block
 block discarded – undo
816 816
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If "id" parameter isn't available or the body is invalid
817 817
 	 * @return \Aimeos\MW\View\Iface Updated view instance
818 818
 	 */
819
-	protected function patchItems( \Aimeos\MW\View\Iface $view, $body, array &$header )
819
+	protected function patchItems(\Aimeos\MW\View\Iface $view, $body, array &$header)
820 820
 	{
821
-		if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
822
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
821
+		if (($request = json_decode($body)) === null || !isset($request->data)) {
822
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
823 823
 		}
824 824
 
825
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
825
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
826 826
 
827
-		if( is_array( $request->data ) )
827
+		if (is_array($request->data))
828 828
 		{
829
-			$data = $this->saveData( $manager, $request );
829
+			$data = $this->saveData($manager, $request);
830 830
 
831 831
 			$view->data = $data;
832
-			$view->total = count( $data );
832
+			$view->total = count($data);
833 833
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
834 834
 		}
835 835
 		else
836 836
 		{
837
-			if( ( $id = $view->param( 'id' ) ) == null ) {
838
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
837
+			if (($id = $view->param('id')) == null) {
838
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
839 839
 			}
840 840
 
841 841
 			$request->data->id = $id;
842
-			$data = $this->saveEntry( $manager, $request->data );
842
+			$data = $this->saveEntry($manager, $request->data);
843 843
 
844 844
 			$view->data = $data;
845 845
 			$view->total = 1;
@@ -857,31 +857,31 @@  discard block
 block discarded – undo
857 857
 	 * @param array &$header Associative list of HTTP headers as value/result parameter
858 858
 	 * @return \Aimeos\MW\View\Iface Updated view instance
859 859
 	 */
860
-	protected function postItems( \Aimeos\MW\View\Iface $view, $body, array &$header )
860
+	protected function postItems(\Aimeos\MW\View\Iface $view, $body, array &$header)
861 861
 	{
862
-		if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
863
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
862
+		if (($request = json_decode($body)) === null || !isset($request->data)) {
863
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
864 864
 		}
865 865
 
866
-		if( isset( $request->data->id ) || $view->param( 'id' ) != null ) {
867
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Client generated IDs are not supported' ), 403 );
866
+		if (isset($request->data->id) || $view->param('id') != null) {
867
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Client generated IDs are not supported'), 403);
868 868
 		}
869 869
 
870 870
 
871
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() );
871
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath());
872 872
 
873
-		if( is_array( $request->data ) )
873
+		if (is_array($request->data))
874 874
 		{
875
-			$data = $this->saveData( $manager, $request );
875
+			$data = $this->saveData($manager, $request);
876 876
 
877 877
 			$view->data = $data;
878
-			$view->total = count( $data );
878
+			$view->total = count($data);
879 879
 			$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
880 880
 		}
881 881
 		else
882 882
 		{
883 883
 			$request->data->id = null;
884
-			$data = $this->saveEntry( $manager, $request->data );
884
+			$data = $this->saveEntry($manager, $request->data);
885 885
 
886 886
 			$view->data = $data;
887 887
 			$view->total = 1;
@@ -898,14 +898,14 @@  discard block
 block discarded – undo
898 898
 	 * @param \stdClass $request Object with request body data
899 899
 	 * @return array List of items
900 900
 	 */
901
-	protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request )
901
+	protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request)
902 902
 	{
903 903
 		$data = array();
904 904
 
905
-		if( isset( $request->data ) )
905
+		if (isset($request->data))
906 906
 		{
907
-			foreach( (array) $request->data as $entry ) {
908
-				$data[] = $this->saveEntry( $manager, $entry );
907
+			foreach ((array) $request->data as $entry) {
908
+				$data[] = $this->saveEntry($manager, $entry);
909 909
 			}
910 910
 		}
911 911
 
@@ -920,22 +920,22 @@  discard block
 block discarded – undo
920 920
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
921 921
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
922 922
 	 */
923
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
923
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
924 924
 	{
925
-		if( isset( $entry->id ) && $entry->id !== null ) {
926
-			$item = $manager->getItem( $entry->id );
925
+		if (isset($entry->id) && $entry->id !== null) {
926
+			$item = $manager->getItem($entry->id);
927 927
 		} else {
928 928
 			$item = $manager->createItem();
929 929
 		}
930 930
 
931
-		$item = $this->addItemData( $manager, $item, $entry );
932
-		$manager->saveItem( $item );
931
+		$item = $this->addItemData($manager, $item, $entry);
932
+		$manager->saveItem($item);
933 933
 
934
-		if( isset( $entry->relationships ) ) {
935
-			$this->saveRelationships( $manager, $item, $entry->relationships );
934
+		if (isset($entry->relationships)) {
935
+			$this->saveRelationships($manager, $item, $entry->relationships);
936 936
 		}
937 937
 
938
-		return $manager->getItem( $item->getId() );
938
+		return $manager->getItem($item->getId());
939 939
 	}
940 940
 
941 941
 
@@ -946,28 +946,28 @@  discard block
 block discarded – undo
946 946
 	 * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set
947 947
 	 * @param \stdClass $relationships Object including the <domain>/data/attributes structure
948 948
 	 */
949
-	protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager,
950
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships )
949
+	protected function saveRelationships(\Aimeos\MShop\Common\Manager\Iface $manager,
950
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships)
951 951
 	{
952 952
 		$id = $item->getId();
953
-		$listManager = $manager->getSubManager( 'lists' );
953
+		$listManager = $manager->getSubManager('lists');
954 954
 
955
-		foreach( (array) $relationships as $domain => $list )
955
+		foreach ((array) $relationships as $domain => $list)
956 956
 		{
957
-			if( isset( $list->data ) )
957
+			if (isset($list->data))
958 958
 			{
959
-				foreach( (array) $list->data as $data )
959
+				foreach ((array) $list->data as $data)
960 960
 				{
961
-					$listItem = $this->addItemData( $listManager, $listManager->createItem(), $data, $domain );
961
+					$listItem = $this->addItemData($listManager, $listManager->createItem(), $data, $domain);
962 962
 
963
-					if( isset( $data->id ) ) {
964
-						$listItem->setRefId( $data->id );
963
+					if (isset($data->id)) {
964
+						$listItem->setRefId($data->id);
965 965
 					}
966 966
 
967
-					$listItem->setParentId( $id );
968
-					$listItem->setDomain( $domain );
967
+					$listItem->setParentId($id);
968
+					$listItem->setDomain($domain);
969 969
 
970
-					$listManager->saveItem( $listItem, false );
970
+					$listManager->saveItem($listItem, false);
971 971
 				}
972 972
 			}
973 973
 		}
@@ -984,24 +984,24 @@  discard block
 block discarded – undo
984 984
 	 * @return \Aimeos\MShop\Common\Item\Iface Item including the data
985 985
 	 */
986 986
 	protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager,
987
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain = null )
987
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain = null)
988 988
 	{
989
-		if( isset( $data->attributes ) )
989
+		if (isset($data->attributes))
990 990
 		{
991 991
 			$attr = (array) $data->attributes;
992
-			$key = str_replace( '/', '.', $item->getResourceType() );
992
+			$key = str_replace('/', '.', $item->getResourceType());
993 993
 
994
-			if( isset( $attr[$key.'.type'] ) )
994
+			if (isset($attr[$key . '.type']))
995 995
 			{
996
-				if( $domain === null ) {
997
-					$domain = ( isset( $attr[$key.'.domain'] ) ? $attr[$key.'.domain'] : $key );
996
+				if ($domain === null) {
997
+					$domain = (isset($attr[$key . '.domain']) ? $attr[$key . '.domain'] : $key);
998 998
 				}
999 999
 
1000
-				$typeItem = $manager->getSubManager( 'type' )->findItem( $attr[$key.'.type'], array(), $domain );
1001
-				$attr[$key.'.typeid'] = $typeItem->getId();
1000
+				$typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], array(), $domain);
1001
+				$attr[$key . '.typeid'] = $typeItem->getId();
1002 1002
 			}
1003 1003
 
1004
-			$item->fromArray( $attr );
1004
+			$item->fromArray($attr);
1005 1005
 		}
1006 1006
 
1007 1007
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +351 added lines, -351 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,142 +488,142 @@  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( 'createItem', 'getItem', 'saveItem' ) );
547
+		$productManagerStub = $this->getProductMock(array('createItem', 'getItem', 'saveItem'));
548 548
 
549 549
 		$item = new \Aimeos\MShop\Product\Item\Standard();
550
-		$item->setId( '-1' );
550
+		$item->setId('-1');
551 551
 
552
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
553
-			->will( $this->returnValue( $item ) );
554
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
555
-			->will( $this->returnValue( $item ) );
556
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
552
+		$productManagerStub->expects($this->once())->method('createItem')
553
+			->will($this->returnValue($item));
554
+		$productManagerStub->expects($this->any())->method('getItem')
555
+			->will($this->returnValue($item));
556
+		$productManagerStub->expects($this->once())->method('saveItem');
557 557
 
558 558
 
559 559
 		$body = '{"data": {"type": "product", "attributes": {"product.type": "default", "product.label": "test"}}}';
560 560
 		$header = array();
561 561
 		$status = 500;
562 562
 
563
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
563
+		$result = json_decode($this->object->post($body, $header, $status), true);
564 564
 
565
-		$this->assertEquals( 201, $status );
566
-		$this->assertEquals( 1, count( $header ) );
567
-		$this->assertEquals( 1, $result['meta']['total'] );
568
-		$this->assertArrayHasKey( 'data', $result );
569
-		$this->assertEquals( '-1', $result['data']['id'] );
570
-		$this->assertEquals( 'product', $result['data']['type'] );
571
-		$this->assertGreaterThan( 0, $result['data']['attributes']['product.typeid'] );
572
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
573
-		$this->assertArrayNotHasKey( 'included', $result );
574
-		$this->assertArrayNotHasKey( 'errors', $result );
565
+		$this->assertEquals(201, $status);
566
+		$this->assertEquals(1, count($header));
567
+		$this->assertEquals(1, $result['meta']['total']);
568
+		$this->assertArrayHasKey('data', $result);
569
+		$this->assertEquals('-1', $result['data']['id']);
570
+		$this->assertEquals('product', $result['data']['type']);
571
+		$this->assertGreaterThan(0, $result['data']['attributes']['product.typeid']);
572
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
573
+		$this->assertArrayNotHasKey('included', $result);
574
+		$this->assertArrayNotHasKey('errors', $result);
575 575
 	}
576 576
 
577 577
 
578 578
 	public function testPostBulk()
579 579
 	{
580
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
580
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
581 581
 
582 582
 		$item = $productManagerStub->createItem();
583
-		$item->setLabel( 'test' );
584
-		$item->setId( '-1' );
583
+		$item->setLabel('test');
584
+		$item->setId('-1');
585 585
 
586
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
587
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
588
-			->will( $this->returnValue( $item ) );
586
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
587
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
588
+			->will($this->returnValue($item));
589 589
 
590 590
 
591 591
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
592 592
 		$header = array();
593 593
 		$status = 500;
594 594
 
595
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
595
+		$result = json_decode($this->object->post($body, $header, $status), true);
596 596
 
597
-		$this->assertEquals( 201, $status );
598
-		$this->assertEquals( 1, count( $header ) );
599
-		$this->assertEquals( 2, $result['meta']['total'] );
600
-		$this->assertArrayHasKey( 'data', $result );
601
-		$this->assertEquals( 2, count( $result['data'] ) );
602
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
603
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
604
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
605
-		$this->assertArrayNotHasKey( 'included', $result );
606
-		$this->assertArrayNotHasKey( 'errors', $result );
597
+		$this->assertEquals(201, $status);
598
+		$this->assertEquals(1, count($header));
599
+		$this->assertEquals(2, $result['meta']['total']);
600
+		$this->assertArrayHasKey('data', $result);
601
+		$this->assertEquals(2, count($result['data']));
602
+		$this->assertEquals('-1', $result['data'][0]['id']);
603
+		$this->assertEquals('product', $result['data'][0]['type']);
604
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
605
+		$this->assertArrayNotHasKey('included', $result);
606
+		$this->assertArrayNotHasKey('errors', $result);
607 607
 	}
608 608
 
609 609
 
610 610
 	public function testPostRelationships()
611 611
 	{
612
-		$productManagerStub = $this->getProductMock( array( 'getSubManager', 'createItem', 'getItem', 'saveItem' ) );
613
-		$productManagerListsStub = $this->getProductListsMock( array( 'saveItem' ) );
612
+		$productManagerStub = $this->getProductMock(array('getSubManager', 'createItem', 'getItem', 'saveItem'));
613
+		$productManagerListsStub = $this->getProductListsMock(array('saveItem'));
614 614
 
615 615
 		$item = new \Aimeos\MShop\Product\Item\Standard();
616
-		$item->setId( '-1' );
616
+		$item->setId('-1');
617 617
 
618
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
619
-			->will( $this->returnValue( $item ) );
620
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
621
-			->will( $this->returnValue( $item ) );
622
-		$productManagerStub->expects( $this->once() )->method( 'getSubManager' )
623
-			->will( $this->returnValue( $productManagerListsStub ) );
624
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
618
+		$productManagerStub->expects($this->once())->method('createItem')
619
+			->will($this->returnValue($item));
620
+		$productManagerStub->expects($this->any())->method('getItem')
621
+			->will($this->returnValue($item));
622
+		$productManagerStub->expects($this->once())->method('getSubManager')
623
+			->will($this->returnValue($productManagerListsStub));
624
+		$productManagerStub->expects($this->once())->method('saveItem');
625 625
 
626
-		$productManagerListsStub->expects( $this->once() )->method( 'saveItem' );
626
+		$productManagerListsStub->expects($this->once())->method('saveItem');
627 627
 
628 628
 		$body = '{"data": {"type": "product",
629 629
 			"attributes": {"product.label": "test"},
@@ -634,17 +634,17 @@  discard block
 block discarded – undo
634 634
 		$header = array();
635 635
 		$status = 500;
636 636
 
637
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
637
+		$result = json_decode($this->object->post($body, $header, $status), true);
638 638
 
639
-		$this->assertEquals( 201, $status );
640
-		$this->assertEquals( 1, count( $header ) );
641
-		$this->assertEquals( 1, $result['meta']['total'] );
642
-		$this->assertArrayHasKey( 'data', $result );
643
-		$this->assertEquals( '-1', $result['data']['id'] );
644
-		$this->assertEquals( 'product', $result['data']['type'] );
645
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
646
-		$this->assertArrayNotHasKey( 'included', $result );
647
-		$this->assertArrayNotHasKey( 'errors', $result );
639
+		$this->assertEquals(201, $status);
640
+		$this->assertEquals(1, count($header));
641
+		$this->assertEquals(1, $result['meta']['total']);
642
+		$this->assertArrayHasKey('data', $result);
643
+		$this->assertEquals('-1', $result['data']['id']);
644
+		$this->assertEquals('product', $result['data']['type']);
645
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
646
+		$this->assertArrayNotHasKey('included', $result);
647
+		$this->assertArrayNotHasKey('errors', $result);
648 648
 	}
649 649
 
650 650
 
@@ -654,14 +654,14 @@  discard block
 block discarded – undo
654 654
 		$header = array();
655 655
 		$status = 500;
656 656
 
657
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
657
+		$result = json_decode($this->object->post($body, $header, $status), true);
658 658
 
659
-		$this->assertEquals( 400, $status );
660
-		$this->assertEquals( 1, count( $header ) );
661
-		$this->assertEquals( 0, $result['meta']['total'] );
662
-		$this->assertArrayHasKey( 'errors', $result );
663
-		$this->assertArrayNotHasKey( 'included', $result );
664
-		$this->assertArrayNotHasKey( 'data', $result );
659
+		$this->assertEquals(400, $status);
660
+		$this->assertEquals(1, count($header));
661
+		$this->assertEquals(0, $result['meta']['total']);
662
+		$this->assertArrayHasKey('errors', $result);
663
+		$this->assertArrayNotHasKey('included', $result);
664
+		$this->assertArrayNotHasKey('data', $result);
665 665
 	}
666 666
 
667 667
 
@@ -671,57 +671,57 @@  discard block
 block discarded – undo
671 671
 		$header = array();
672 672
 		$status = 500;
673 673
 
674
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
674
+		$result = json_decode($this->object->post($body, $header, $status), true);
675 675
 
676
-		$this->assertEquals( 403, $status );
677
-		$this->assertEquals( 1, count( $header ) );
678
-		$this->assertEquals( 0, $result['meta']['total'] );
679
-		$this->assertArrayHasKey( 'errors', $result );
676
+		$this->assertEquals(403, $status);
677
+		$this->assertEquals(1, count($header));
678
+		$this->assertEquals(0, $result['meta']['total']);
679
+		$this->assertArrayHasKey('errors', $result);
680 680
 	}
681 681
 
682 682
 
683 683
 	public function testPostException()
684 684
 	{
685
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
686
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
685
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
686
+			->will($this->throwException(new \Exception('test exception')));
687 687
 
688 688
 		$header = array();
689 689
 		$status = 500;
690 690
 
691
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
691
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
692 692
 
693
-		$this->assertEquals( 500, $status );
694
-		$this->assertArrayHasKey( 'errors', $result );
693
+		$this->assertEquals(500, $status);
694
+		$this->assertArrayHasKey('errors', $result);
695 695
 	}
696 696
 
697 697
 
698 698
 	public function testPostMAdminException()
699 699
 	{
700
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
701
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
700
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
701
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
702 702
 
703 703
 		$header = array();
704 704
 		$status = 500;
705 705
 
706
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
706
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
707 707
 
708
-		$this->assertEquals( 404, $status );
709
-		$this->assertArrayHasKey( 'errors', $result );
708
+		$this->assertEquals(404, $status);
709
+		$this->assertArrayHasKey('errors', $result);
710 710
 	}
711 711
 
712 712
 
713 713
 	public function testPostMShopException()
714 714
 	{
715
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
716
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
715
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
716
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
717 717
 
718 718
 		$header = array();
719 719
 		$status = 500;
720 720
 
721
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
721
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
722 722
 
723
-		$this->assertEquals( 404, $status );
724
-		$this->assertArrayHasKey( 'errors', $result );
723
+		$this->assertEquals(404, $status);
724
+		$this->assertArrayHasKey('errors', $result);
725 725
 	}
726 726
 
727 727
 
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
 		$header = array();
732 732
 		$status = 500;
733 733
 
734
-		$result = json_decode( $this->object->put( $body, $header, $status ), true );
734
+		$result = json_decode($this->object->put($body, $header, $status), true);
735 735
 
736
-		$this->assertEquals( 501, $status );
737
-		$this->assertEquals( 1, count( $header ) );
738
-		$this->assertArrayHasKey( 'errors', $result );
736
+		$this->assertEquals(501, $status);
737
+		$this->assertEquals(1, count($header));
738
+		$this->assertArrayHasKey('errors', $result);
739 739
 	}
740 740
 
741 741
 
@@ -744,102 +744,102 @@  discard block
 block discarded – undo
744 744
 		$header = array();
745 745
 		$status = 500;
746 746
 
747
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
747
+		$result = json_decode($this->object->options('', $header, $status), true);
748 748
 
749
-		$this->assertEquals( 200, $status );
750
-		$this->assertEquals( 2, count( $header ) );
751
-		$this->assertEquals( 59, count( $result['meta']['resources'] ) );
752
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
753
-		$this->assertArrayNotHasKey( 'errors', $result );
749
+		$this->assertEquals(200, $status);
750
+		$this->assertEquals(2, count($header));
751
+		$this->assertEquals(59, count($result['meta']['resources']));
752
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
753
+		$this->assertArrayNotHasKey('errors', $result);
754 754
 	}
755 755
 
756 756
 
757 757
 	public function testOptionsException()
758 758
 	{
759
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
760
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
759
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
760
+			->will($this->throwException(new \Exception('test exception')));
761 761
 
762 762
 		$header = array();
763 763
 		$status = 500;
764 764
 
765
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
765
+		$result = json_decode($this->object->options('', $header, $status), true);
766 766
 
767
-		$this->assertEquals( 500, $status );
768
-		$this->assertArrayHasKey( 'errors', $result );
767
+		$this->assertEquals(500, $status);
768
+		$this->assertArrayHasKey('errors', $result);
769 769
 	}
770 770
 
771 771
 
772 772
 	public function testOptionsMAdminException()
773 773
 	{
774
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
775
-			->will( $this->throwException( new \Aimeos\MAdmin\Exception( 'test exception' ) ) );
774
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
775
+			->will($this->throwException(new \Aimeos\MAdmin\Exception('test exception')));
776 776
 
777 777
 		$header = array();
778 778
 		$status = 500;
779 779
 
780
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
780
+		$result = json_decode($this->object->options('', $header, $status), true);
781 781
 
782
-		$this->assertEquals( 404, $status );
783
-		$this->assertArrayHasKey( 'errors', $result );
782
+		$this->assertEquals(404, $status);
783
+		$this->assertArrayHasKey('errors', $result);
784 784
 	}
785 785
 
786 786
 
787 787
 	public function testOptionsMShopException()
788 788
 	{
789
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
790
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
789
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
790
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
791 791
 
792 792
 		$header = array();
793 793
 		$status = 500;
794 794
 
795
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
795
+		$result = json_decode($this->object->options('', $header, $status), true);
796 796
 
797
-		$this->assertEquals( 404, $status );
798
-		$this->assertArrayHasKey( 'errors', $result );
797
+		$this->assertEquals(404, $status);
798
+		$this->assertArrayHasKey('errors', $result);
799 799
 	}
800 800
 
801 801
 
802
-	protected function getProductMock( array $methods )
802
+	protected function getProductMock(array $methods)
803 803
 	{
804 804
 		$name = 'ClientJsonAdmStandard';
805
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
805
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
806 806
 
807
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
808
-			->setConstructorArgs( array( $this->context ) )
809
-			->setMethods( $methods )
807
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
808
+			->setConstructorArgs(array($this->context))
809
+			->setMethods($methods)
810 810
 			->getMock();
811 811
 
812
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
812
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
813 813
 
814 814
 		return $stub;
815 815
 	}
816 816
 
817 817
 
818
-	protected function getProductListsMock( array $methods )
818
+	protected function getProductListsMock(array $methods)
819 819
 	{
820 820
 		$name = 'ClientJsonAdmStandard';
821
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
821
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
822 822
 
823
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
824
-			->setConstructorArgs( array( $this->context ) )
825
-			->setMethods( $methods )
823
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
824
+			->setConstructorArgs(array($this->context))
825
+			->setMethods($methods)
826 826
 			->getMock();
827 827
 
828
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
828
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
829 829
 
830 830
 		return $stub;
831 831
 	}
832 832
 
833 833
 
834
-	protected function getProductItem( $code = 'CNC' )
834
+	protected function getProductItem($code = 'CNC')
835 835
 	{
836
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
836
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
837 837
 		$search = $manager->createSearch();
838
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
839
-		$items = $manager->searchItems( $search );
838
+		$search->setConditions($search->compare('==', 'product.code', $code));
839
+		$items = $manager->searchItems($search);
840 840
 
841
-		if( ( $item = reset( $items ) ) === false ) {
842
-			throw new \Exception( sprintf( 'No product item with code "%1$s" found', $code ) );
841
+		if (($item = reset($items)) === false) {
842
+			throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
843 843
 		}
844 844
 
845 845
 		return $item;
Please login to merge, or discard this patch.