Completed
Push — master ( 42e540...7a9199 )
by Aimeos
01:51
created
admin/jsonadm/templates/get-default.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @see admin/jsonadm/url/action
23 23
  * @see admin/jsonadm/url/config
24 24
  */
25
-$target = $this->config( 'admin/jsonadm/url/target' );
25
+$target = $this->config('admin/jsonadm/url/target');
26 26
 
27 27
 /** admin/jsonadm/url/controller
28 28
  * Name of the client whose action should be called
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @see admin/jsonadm/url/action
39 39
  * @see admin/jsonadm/url/config
40 40
  */
41
-$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
41
+$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
42 42
 
43 43
 /** admin/jsonadm/url/action
44 44
  * Name of the action that should create the output
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
  * @see admin/jsonadm/url/controller
55 55
  * @see admin/jsonadm/url/config
56 56
  */
57
-$action = $this->config( 'admin/jsonadm/url/action', 'get' );
57
+$action = $this->config('admin/jsonadm/url/action', 'get');
58 58
 
59 59
 /** admin/jsonadm/url/config
60 60
  * Associative list of configuration options used for generating the URL
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
  * @see admin/jsonadm/url/controller
77 77
  * @see admin/jsonadm/url/action
78 78
  */
79
-$config = $this->config( 'admin/jsonadm/url/config', [] );
79
+$config = $this->config('admin/jsonadm/url/config', []);
80 80
 
81 81
 
82 82
 /** admin/jsonadm/partials/template-errors
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
  */
129 129
 
130 130
 
131
-$total = $this->get( 'total', 0 );
132
-$offset = max( $this->param( 'page/offset', 0 ), 0 );
133
-$limit = max( $this->param( 'page/limit', 25 ), 1 );
131
+$total = $this->get('total', 0);
132
+$offset = max($this->param('page/offset', 0), 0);
133
+$limit = max($this->param('page/limit', 25), 1);
134 134
 
135
-$first = ( $offset > 0 ? 0 : null );
136
-$prev = ( $offset - $limit >= 0 ? $offset - $limit : null );
137
-$next = ( $offset + $limit < $total ? $offset + $limit : null );
138
-$last = ( ((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null );
135
+$first = ($offset > 0 ? 0 : null);
136
+$prev = ($offset - $limit >= 0 ? $offset - $limit : null);
137
+$next = ($offset + $limit < $total ? $offset + $limit : null);
138
+$last = (((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null);
139 139
 
140 140
 
141
-$ref = array( 'id', 'resource', 'filter', 'page', 'sort', 'include', 'fields' );
142
-$params = array_intersect_key( $this->param(), array_flip( $ref ) ) + ['id' => ''];
143
-$fields = $this->param( 'fields', [] );
141
+$ref = array('id', 'resource', 'filter', 'page', 'sort', 'include', 'fields');
142
+$params = array_intersect_key($this->param(), array_flip($ref)) + ['id' => ''];
143
+$fields = $this->param('fields', []);
144 144
 
145
-foreach( (array) $fields as $resource => $list ) {
146
-	$fields[$resource] = array_flip( explode( ',', $list ) );
145
+foreach ((array) $fields as $resource => $list) {
146
+	$fields[$resource] = array_flip(explode(',', $list));
147 147
 }
148 148
 
149 149
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	"meta": {
153 153
 		"total": <?= $total; ?>
154 154
 
155
-		<?php if( $this->csrf()->name() != '' ) : ?>
155
+		<?php if ($this->csrf()->name() != '') : ?>
156 156
 			, "csrf": {
157 157
 				"name": "<?= $this->csrf()->name(); ?>",
158 158
 				"value": "<?= $this->csrf()->value(); ?>"
@@ -163,42 +163,42 @@  discard block
 block discarded – undo
163 163
 
164 164
 	"links": {
165 165
 
166
-		<?php if( is_array( $this->get( 'data' ) ) ) : ?>
166
+		<?php if (is_array($this->get('data'))) : ?>
167 167
 
168
-			<?php if( $first !== null ) : ?>
168
+			<?php if ($first !== null) : ?>
169 169
 
170
-				"first": "<?php $params['page']['offset'] = $first; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
170
+				"first": "<?php $params['page']['offset'] = $first; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
171 171
 
172 172
 			<?php endif; ?>
173
-			<?php if( $prev !== null ) : ?>
173
+			<?php if ($prev !== null) : ?>
174 174
 
175
-				"prev": "<?php $params['page']['offset'] = $prev; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
175
+				"prev": "<?php $params['page']['offset'] = $prev; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
176 176
 
177 177
 			<?php endif; ?>
178
-			<?php if( $next !== null ) : ?>
178
+			<?php if ($next !== null) : ?>
179 179
 
180
-				"next": "<?php $params['page']['offset'] = $next; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
180
+				"next": "<?php $params['page']['offset'] = $next; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
181 181
 
182 182
 			<?php endif; ?>
183
-			<?php if( $last !== null ) : ?>
183
+			<?php if ($last !== null) : ?>
184 184
 
185
-				"last": "<?php $params['page']['offset'] = $last; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>",
185
+				"last": "<?php $params['page']['offset'] = $last; echo $this->url($target, $cntl, $action, $params, [], $config); ?>",
186 186
 
187 187
 			<?php endif; ?>
188 188
 		<?php endif; ?>
189 189
 
190
-		"self": "<?php $params['page']['offset'] = $offset; echo $this->url( $target, $cntl, $action, $params, [], $config ); ?>"
190
+		"self": "<?php $params['page']['offset'] = $offset; echo $this->url($target, $cntl, $action, $params, [], $config); ?>"
191 191
 	},
192 192
 
193
-	<?php if( isset( $this->errors ) ) : ?>
193
+	<?php if (isset($this->errors)) : ?>
194 194
 
195
-		"errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
195
+		"errors": <?= $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
196 196
 
197
-	<?php elseif( isset( $this->data ) ) : ?>
197
+	<?php elseif (isset($this->data)) : ?>
198 198
 
199
-		"data": <?= $this->partial( $this->config( $this->get( 'partial-data', 'admin/jsonadm/partials/template-data' ), 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ), 'childItems' => $this->get( 'childItems', [] ), 'listItems' => $this->get( 'listItems', [] ) ) ); ?>,
199
+		"data": <?= $this->partial($this->config($this->get('partial-data', 'admin/jsonadm/partials/template-data'), 'partials/data-standard.php'), array('data' => $this->get('data'), 'childItems' => $this->get('childItems', []), 'listItems' => $this->get('listItems', []))); ?>,
200 200
 
201
-		"included": <?= $this->partial( $this->config( $this->get( 'partial-included', 'admin/jsonadm/partials/template-included' ), 'partials/included-standard.php' ), array( 'childItems' => $this->get( 'childItems', [] ), 'refItems' => $this->get( 'refItems', [] ) ) ); ?>
201
+		"included": <?= $this->partial($this->config($this->get('partial-included', 'admin/jsonadm/partials/template-included'), 'partials/included-standard.php'), array('childItems' => $this->get('childItems', []), 'refItems' => $this->get('refItems', []))); ?>
202 202
 
203 203
 	<?php endif; ?>
204 204
 
Please login to merge, or discard this patch.
admin/jsonadm/templates/aggregate-default.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 
11
-$data = $this->get( 'data', [] );
11
+$data = $this->get('data', []);
12 12
 $entries = [];
13 13
 
14
-foreach( $data as $key => $value ) {
15
-	$entries[] = array( 'id' => $key, 'type' => 'aggregate', 'attributes' => $value );
14
+foreach ($data as $key => $value) {
15
+	$entries[] = array('id' => $key, 'type' => 'aggregate', 'attributes' => $value);
16 16
 }
17 17
 
18 18
 ?>
19 19
 {
20 20
 	"meta": {
21
-		"total": <?= count( $data ); ?>
21
+		"total": <?= count($data); ?>
22 22
 
23
-		<?php if( $this->csrf()->name() != '' ) : ?>
23
+		<?php if ($this->csrf()->name() != '') : ?>
24 24
 			, "csrf": {
25 25
 				"name": "<?= $this->csrf()->name(); ?>",
26 26
 				"value": "<?= $this->csrf()->value(); ?>"
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 
30 30
 	},
31 31
 
32
-	<?php if( isset( $this->errors ) ) : ?>
32
+	<?php if (isset($this->errors)) : ?>
33 33
 
34
-		"errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
34
+		"errors": <?= $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
35 35
 
36
-	<?php elseif( isset( $this->data ) ) : ?>
36
+	<?php elseif (isset($this->data)) : ?>
37 37
 
38
-		"data": <?= json_encode( $entries ); ?>
38
+		"data": <?= json_encode($entries); ?>
39 39
 
40 40
 	<?php endif; ?>
41 41
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/patch-default.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 ?>
12 12
 {
13 13
 	"meta": {
14
-		"total": <?= $this->get( 'total', 0 ); ?>
14
+		"total": <?= $this->get('total', 0); ?>
15 15
 
16
-		<?php if( $this->csrf()->name() != '' ) : ?>
16
+		<?php if ($this->csrf()->name() != '') : ?>
17 17
 			, "csrf": {
18 18
 				"name": "<?= $this->csrf()->name(); ?>",
19 19
 				"value": "<?= $this->csrf()->value(); ?>"
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 
23 23
 	}
24 24
 
25
-	<?php if( isset( $this->errors ) ) : ?>
25
+	<?php if (isset($this->errors)) : ?>
26 26
 
27
-		, "errors": <?= $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
27
+		, "errors": <?= $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
28 28
 
29
-	<?php elseif( isset( $this->data ) ) : ?>
29
+	<?php elseif (isset($this->data)) : ?>
30 30
 
31
-		, "data": <?= $this->partial( $this->config( 'admin/jsonadm/partials/template-data', 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ) ) ); ?>
31
+		, "data": <?= $this->partial($this->config('admin/jsonadm/partials/template-data', 'partials/data-standard.php'), array('data' => $this->get('data'))); ?>
32 32
 
33 33
 	<?php endif; ?>
34 34
 
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +387 added lines, -387 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,193 +34,193 @@  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
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
44
-		$result = json_decode( (string) $response->getBody(), true );
43
+		$response = $this->object->delete($this->view->request(), $this->view->response());
44
+		$result = json_decode((string) $response->getBody(), true);
45 45
 
46 46
 
47
-		$this->assertEquals( 200, $response->getStatusCode() );
48
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
47
+		$this->assertEquals(200, $response->getStatusCode());
48
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
49 49
 
50
-		$this->assertEquals( 1, $result['meta']['total'] );
50
+		$this->assertEquals(1, $result['meta']['total']);
51 51
 
52
-		$this->assertArrayNotHasKey( 'included', $result );
53
-		$this->assertArrayNotHasKey( 'data', $result );
54
-		$this->assertArrayNotHasKey( 'errors', $result );
52
+		$this->assertArrayNotHasKey('included', $result);
53
+		$this->assertArrayNotHasKey('data', $result);
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testDeleteBulk()
59 59
 	{
60
-		$this->getProductMock( array( 'deleteItems' ) )->expects( $this->once() )->method( 'deleteItems' );
60
+		$this->getProductMock(array('deleteItems'))->expects($this->once())->method('deleteItems');
61 61
 
62 62
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
63
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
63
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
64 64
 
65
-		$response = $this->object->delete( $request, $this->view->response() );
66
-		$result = json_decode( (string) $response->getBody(), true );
65
+		$response = $this->object->delete($request, $this->view->response());
66
+		$result = json_decode((string) $response->getBody(), true);
67 67
 
68 68
 
69
-		$this->assertEquals( 200, $response->getStatusCode() );
70
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
69
+		$this->assertEquals(200, $response->getStatusCode());
70
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
71 71
 
72
-		$this->assertEquals( 2, $result['meta']['total'] );
73
-		$this->assertArrayNotHasKey( 'included', $result );
74
-		$this->assertArrayNotHasKey( 'data', $result );
75
-		$this->assertArrayNotHasKey( 'errors', $result );
72
+		$this->assertEquals(2, $result['meta']['total']);
73
+		$this->assertArrayNotHasKey('included', $result);
74
+		$this->assertArrayNotHasKey('data', $result);
75
+		$this->assertArrayNotHasKey('errors', $result);
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testDeleteInvalid()
80 80
 	{
81 81
 		$body = '{"data":null}';
82
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
82
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
83 83
 
84
-		$response = $this->object->delete( $request, $this->view->response() );
85
-		$result = json_decode( (string) $response->getBody(), true );
84
+		$response = $this->object->delete($request, $this->view->response());
85
+		$result = json_decode((string) $response->getBody(), true);
86 86
 
87 87
 
88
-		$this->assertEquals( 400, $response->getStatusCode() );
89
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
88
+		$this->assertEquals(400, $response->getStatusCode());
89
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
90 90
 
91
-		$this->assertEquals( 0, $result['meta']['total'] );
92
-		$this->assertArrayHasKey( 'errors', $result );
93
-		$this->assertArrayNotHasKey( 'included', $result );
94
-		$this->assertArrayNotHasKey( 'data', $result );
91
+		$this->assertEquals(0, $result['meta']['total']);
92
+		$this->assertArrayHasKey('errors', $result);
93
+		$this->assertArrayNotHasKey('included', $result);
94
+		$this->assertArrayNotHasKey('data', $result);
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testDeleteException()
99 99
 	{
100
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
101
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
100
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
101
+			->will($this->throwException(new \RuntimeException('test exception')));
102 102
 
103
-		$params = array( 'id' => $this->getProductItem()->getId() );
104
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
105
-		$this->view->addHelper( 'param', $helper );
103
+		$params = array('id' => $this->getProductItem()->getId());
104
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
105
+		$this->view->addHelper('param', $helper);
106 106
 
107
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
108
-		$result = json_decode( (string) $response->getBody(), true );
107
+		$response = $this->object->delete($this->view->request(), $this->view->response());
108
+		$result = json_decode((string) $response->getBody(), true);
109 109
 
110
-		$this->assertEquals( 500, $response->getStatusCode() );
111
-		$this->assertArrayHasKey( 'errors', $result );
110
+		$this->assertEquals(500, $response->getStatusCode());
111
+		$this->assertArrayHasKey('errors', $result);
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testDeleteMShopException()
116 116
 	{
117
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
118
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
117
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
118
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
119 119
 
120
-		$params = array( 'id' => $this->getProductItem()->getId() );
121
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
122
-		$this->view->addHelper( 'param', $helper );
120
+		$params = array('id' => $this->getProductItem()->getId());
121
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
122
+		$this->view->addHelper('param', $helper);
123 123
 
124
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
125
-		$result = json_decode( (string) $response->getBody(), true );
124
+		$response = $this->object->delete($this->view->request(), $this->view->response());
125
+		$result = json_decode((string) $response->getBody(), true);
126 126
 
127
-		$this->assertEquals( 404, $response->getStatusCode() );
128
-		$this->assertArrayHasKey( 'errors', $result );
127
+		$this->assertEquals(404, $response->getStatusCode());
128
+		$this->assertArrayHasKey('errors', $result);
129 129
 	}
130 130
 
131 131
 
132 132
 	public function testGet()
133 133
 	{
134
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
135
-		$result = json_decode( (string) $response->getBody(), true );
134
+		$response = $this->object->get($this->view->request(), $this->view->response());
135
+		$result = json_decode((string) $response->getBody(), true);
136 136
 
137 137
 
138
-		$this->assertEquals( 200, $response->getStatusCode() );
139
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
138
+		$this->assertEquals(200, $response->getStatusCode());
139
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
140 140
 
141
-		$this->assertEquals( 28, $result['meta']['total'] );
142
-		$this->assertEquals( 25, count( $result['data'] ) );
143
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
144
-		$this->assertEquals( 0, count( $result['included'] ) );
145
-		$this->assertArrayHasKey( 'next', $result['links'] );
146
-		$this->assertArrayHasKey( 'last', $result['links'] );
147
-		$this->assertArrayHasKey( 'self', $result['links'] );
148
-		$this->assertArrayNotHasKey( 'errors', $result );
141
+		$this->assertEquals(28, $result['meta']['total']);
142
+		$this->assertEquals(25, count($result['data']));
143
+		$this->assertEquals('product', $result['data'][0]['type']);
144
+		$this->assertEquals(0, count($result['included']));
145
+		$this->assertArrayHasKey('next', $result['links']);
146
+		$this->assertArrayHasKey('last', $result['links']);
147
+		$this->assertArrayHasKey('self', $result['links']);
148
+		$this->assertArrayNotHasKey('errors', $result);
149 149
 	}
150 150
 
151 151
 
152 152
 	public function testGetType()
153 153
 	{
154 154
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
155
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/property/type' );
155
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/property/type');
156 156
 
157
-		$response = $object->get( $this->view->request(), $this->view->response() );
158
-		$result = json_decode( (string) $response->getBody(), true );
157
+		$response = $object->get($this->view->request(), $this->view->response());
158
+		$result = json_decode((string) $response->getBody(), true);
159 159
 
160 160
 
161
-		$this->assertEquals( 200, $response->getStatusCode() );
162
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
161
+		$this->assertEquals(200, $response->getStatusCode());
162
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
163 163
 
164
-		$this->assertEquals( 4, $result['meta']['total'] );
165
-		$this->assertEquals( 4, count( $result['data'] ) );
166
-		$this->assertEquals( 'product/property/type', $result['data'][0]['type'] );
167
-		$this->assertEquals( 0, count( $result['included'] ) );
164
+		$this->assertEquals(4, $result['meta']['total']);
165
+		$this->assertEquals(4, count($result['data']));
166
+		$this->assertEquals('product/property/type', $result['data'][0]['type']);
167
+		$this->assertEquals(0, count($result['included']));
168 168
 
169
-		$this->assertArrayNotHasKey( 'errors', $result );
169
+		$this->assertArrayNotHasKey('errors', $result);
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testGetInvalid()
174 174
 	{
175 175
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
176
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' );
176
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
177 177
 
178
-		$response = $object->get( $this->view->request(), $this->view->response() );
179
-		$result = json_decode( (string) $response->getBody(), true );
178
+		$response = $object->get($this->view->request(), $this->view->response());
179
+		$result = json_decode((string) $response->getBody(), true);
180 180
 
181 181
 
182
-		$this->assertEquals( 404, $response->getStatusCode() );
183
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
182
+		$this->assertEquals(404, $response->getStatusCode());
183
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
184 184
 
185
-		$this->assertEquals( 1, count( $result['errors'] ) );
186
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
187
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
188
-		$this->assertArrayNotHasKey( 'data', $result );
189
-		$this->assertArrayNotHasKey( 'indluded', $result );
185
+		$this->assertEquals(1, count($result['errors']));
186
+		$this->assertArrayHasKey('title', $result['errors'][0]);
187
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
188
+		$this->assertArrayNotHasKey('data', $result);
189
+		$this->assertArrayNotHasKey('indluded', $result);
190 190
 	}
191 191
 
192 192
 
193 193
 	public function testGetException()
194 194
 	{
195
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
196
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
195
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
196
+			->will($this->throwException(new \RuntimeException('test exception')));
197 197
 
198
-		$params = array( 'id' => -1 );
199
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
200
-		$this->view->addHelper( 'param', $helper );
198
+		$params = array('id' => -1);
199
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
200
+		$this->view->addHelper('param', $helper);
201 201
 
202
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
203
-		$result = json_decode( (string) $response->getBody(), true );
202
+		$response = $this->object->get($this->view->request(), $this->view->response());
203
+		$result = json_decode((string) $response->getBody(), true);
204 204
 
205
-		$this->assertEquals( 500, $response->getStatusCode() );
206
-		$this->assertArrayHasKey( 'errors', $result );
205
+		$this->assertEquals(500, $response->getStatusCode());
206
+		$this->assertArrayHasKey('errors', $result);
207 207
 	}
208 208
 
209 209
 
210 210
 	public function testGetMShopException()
211 211
 	{
212
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
213
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
212
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
213
+			->will($this->throwException(new \Aimeos\MShop\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
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
220
-		$result = json_decode( (string) $response->getBody(), true );
219
+		$response = $this->object->get($this->view->request(), $this->view->response());
220
+		$result = json_decode((string) $response->getBody(), true);
221 221
 
222
-		$this->assertEquals( 404, $response->getStatusCode() );
223
-		$this->assertArrayHasKey( 'errors', $result );
222
+		$this->assertEquals(404, $response->getStatusCode());
223
+		$this->assertArrayHasKey('errors', $result);
224 224
 	}
225 225
 
226 226
 
@@ -228,25 +228,25 @@  discard block
 block discarded – undo
228 228
 	{
229 229
 		$params = array(
230 230
 			'filter' => array(
231
-				'==' => array( 'product.type.code' => 'select' )
231
+				'==' => array('product.type.code' => 'select')
232 232
 			)
233 233
 		);
234
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
235
-		$this->view->addHelper( 'param', $helper );
234
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
235
+		$this->view->addHelper('param', $helper);
236 236
 
237
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
238
-		$result = json_decode( (string) $response->getBody(), true );
237
+		$response = $this->object->get($this->view->request(), $this->view->response());
238
+		$result = json_decode((string) $response->getBody(), true);
239 239
 
240 240
 
241
-		$this->assertEquals( 200, $response->getStatusCode() );
242
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
241
+		$this->assertEquals(200, $response->getStatusCode());
242
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
243 243
 
244
-		$this->assertEquals( 3, $result['meta']['total'] );
245
-		$this->assertEquals( 3, count( $result['data'] ) );
246
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
247
-		$this->assertEquals( 0, count( $result['included'] ) );
244
+		$this->assertEquals(3, $result['meta']['total']);
245
+		$this->assertEquals(3, count($result['data']));
246
+		$this->assertEquals('product', $result['data'][0]['type']);
247
+		$this->assertEquals(0, count($result['included']));
248 248
 
249
-		$this->assertArrayNotHasKey( 'errors', $result );
249
+		$this->assertArrayNotHasKey('errors', $result);
250 250
 	}
251 251
 
252 252
 
@@ -255,27 +255,27 @@  discard block
 block discarded – undo
255 255
 		$params = array(
256 256
 			'filter' => array(
257 257
 				'&&' => array(
258
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
259
-					array( '==' => array( 'product.type.code' => 'select' ) ),
258
+					array('=~' => array('product.label' => 'Unittest: Test')),
259
+					array('==' => array('product.type.code' => 'select')),
260 260
 				)
261 261
 			)
262 262
 		);
263
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
264
-		$this->view->addHelper( 'param', $helper );
263
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
264
+		$this->view->addHelper('param', $helper);
265 265
 
266
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
267
-		$result = json_decode( (string) $response->getBody(), true );
266
+		$response = $this->object->get($this->view->request(), $this->view->response());
267
+		$result = json_decode((string) $response->getBody(), true);
268 268
 
269 269
 
270
-		$this->assertEquals( 200, $response->getStatusCode() );
271
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
270
+		$this->assertEquals(200, $response->getStatusCode());
271
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
272 272
 
273
-		$this->assertEquals( 2, $result['meta']['total'] );
274
-		$this->assertEquals( 2, count( $result['data'] ) );
275
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
276
-		$this->assertEquals( 0, count( $result['included'] ) );
273
+		$this->assertEquals(2, $result['meta']['total']);
274
+		$this->assertEquals(2, count($result['data']));
275
+		$this->assertEquals('product', $result['data'][0]['type']);
276
+		$this->assertEquals(0, count($result['included']));
277 277
 
278
-		$this->assertArrayNotHasKey( 'errors', $result );
278
+		$this->assertArrayNotHasKey('errors', $result);
279 279
 	}
280 280
 
281 281
 
@@ -287,25 +287,25 @@  discard block
 block discarded – undo
287 287
 				'limit' => 25
288 288
 			)
289 289
 		);
290
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
291
-		$this->view->addHelper( 'param', $helper );
290
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
291
+		$this->view->addHelper('param', $helper);
292 292
 
293
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
294
-		$result = json_decode( (string) $response->getBody(), true );
293
+		$response = $this->object->get($this->view->request(), $this->view->response());
294
+		$result = json_decode((string) $response->getBody(), true);
295 295
 
296 296
 
297
-		$this->assertEquals( 200, $response->getStatusCode() );
298
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
297
+		$this->assertEquals(200, $response->getStatusCode());
298
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
299 299
 
300
-		$this->assertEquals( 28, $result['meta']['total'] );
301
-		$this->assertEquals( 3, count( $result['data'] ) );
302
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
303
-		$this->assertEquals( 0, count( $result['included'] ) );
304
-		$this->assertArrayHasKey( 'first', $result['links'] );
305
-		$this->assertArrayHasKey( 'prev', $result['links'] );
306
-		$this->assertArrayHasKey( 'self', $result['links'] );
300
+		$this->assertEquals(28, $result['meta']['total']);
301
+		$this->assertEquals(3, count($result['data']));
302
+		$this->assertEquals('product', $result['data'][0]['type']);
303
+		$this->assertEquals(0, count($result['included']));
304
+		$this->assertArrayHasKey('first', $result['links']);
305
+		$this->assertArrayHasKey('prev', $result['links']);
306
+		$this->assertArrayHasKey('self', $result['links']);
307 307
 
308
-		$this->assertArrayNotHasKey( 'errors', $result );
308
+		$this->assertArrayNotHasKey('errors', $result);
309 309
 	}
310 310
 
311 311
 
@@ -314,24 +314,24 @@  discard block
 block discarded – undo
314 314
 		$params = array(
315 315
 			'sort' => 'product.label,-product.code'
316 316
 		);
317
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
318
-		$this->view->addHelper( 'param', $helper );
317
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
318
+		$this->view->addHelper('param', $helper);
319 319
 
320
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
321
-		$result = json_decode( (string) $response->getBody(), true );
320
+		$response = $this->object->get($this->view->request(), $this->view->response());
321
+		$result = json_decode((string) $response->getBody(), true);
322 322
 
323 323
 
324
-		$this->assertEquals( 200, $response->getStatusCode() );
325
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
324
+		$this->assertEquals(200, $response->getStatusCode());
325
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
326 326
 
327
-		$this->assertEquals( 28, $result['meta']['total'] );
328
-		$this->assertEquals( 25, count( $result['data'] ) );
329
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
330
-		$this->assertEquals( 'QRST', $result['data'][0]['attributes']['product.code'] );
331
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
332
-		$this->assertEquals( 0, count( $result['included'] ) );
327
+		$this->assertEquals(28, $result['meta']['total']);
328
+		$this->assertEquals(25, count($result['data']));
329
+		$this->assertEquals('product', $result['data'][0]['type']);
330
+		$this->assertEquals('QRST', $result['data'][0]['attributes']['product.code']);
331
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
332
+		$this->assertEquals(0, count($result['included']));
333 333
 
334
-		$this->assertArrayNotHasKey( 'errors', $result );
334
+		$this->assertArrayNotHasKey('errors', $result);
335 335
 	}
336 336
 
337 337
 
@@ -344,262 +344,262 @@  discard block
 block discarded – undo
344 344
 			'sort' => 'product.id',
345 345
 			'include' => 'product'
346 346
 		);
347
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
348
-		$this->view->addHelper( 'param', $helper );
347
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
348
+		$this->view->addHelper('param', $helper);
349 349
 
350
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
351
-		$result = json_decode( (string) $response->getBody(), true );
350
+		$response = $this->object->get($this->view->request(), $this->view->response());
351
+		$result = json_decode((string) $response->getBody(), true);
352 352
 
353 353
 
354
-		$this->assertEquals( 200, $response->getStatusCode() );
355
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
354
+		$this->assertEquals(200, $response->getStatusCode());
355
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
356 356
 
357
-		$this->assertEquals( 28, $result['meta']['total'] );
358
-		$this->assertEquals( 25, count( $result['data'] ) );
359
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
360
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
357
+		$this->assertEquals(28, $result['meta']['total']);
358
+		$this->assertEquals(25, count($result['data']));
359
+		$this->assertEquals('product', $result['data'][0]['type']);
360
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
361 361
 
362
-		$this->assertArrayNotHasKey( 'errors', $result );
362
+		$this->assertArrayNotHasKey('errors', $result);
363 363
 	}
364 364
 
365 365
 
366 366
 	public function testPatch()
367 367
 	{
368
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
368
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
369 369
 
370 370
 		$item = $productManagerStub->createItem();
371
-		$item->setLabel( 'test' );
372
-		$item->setId( '-1' );
371
+		$item->setLabel('test');
372
+		$item->setId('-1');
373 373
 
374
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
375
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
376
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
377
-			->will( $this->returnValue( $item ) );
374
+		$productManagerStub->expects($this->once())->method('saveItem')
375
+			->will($this->returnValue($productManagerStub->createItem()));
376
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
377
+			->will($this->returnValue($item));
378 378
 
379 379
 
380
-		$params = array( 'id' => '-1' );
381
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
382
-		$this->view->addHelper( 'param', $helper );
380
+		$params = array('id' => '-1');
381
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
382
+		$this->view->addHelper('param', $helper);
383 383
 
384 384
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
385
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
385
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
386 386
 
387
-		$response = $this->object->patch( $request, $this->view->response() );
388
-		$result = json_decode( (string) $response->getBody(), true );
387
+		$response = $this->object->patch($request, $this->view->response());
388
+		$result = json_decode((string) $response->getBody(), true);
389 389
 
390 390
 
391
-		$this->assertEquals( 200, $response->getStatusCode() );
392
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
391
+		$this->assertEquals(200, $response->getStatusCode());
392
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
393 393
 
394
-		$this->assertEquals( 1, $result['meta']['total'] );
395
-		$this->assertArrayHasKey( 'data', $result );
396
-		$this->assertEquals( '-1', $result['data']['id'] );
397
-		$this->assertEquals( 'product', $result['data']['type'] );
398
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
394
+		$this->assertEquals(1, $result['meta']['total']);
395
+		$this->assertArrayHasKey('data', $result);
396
+		$this->assertEquals('-1', $result['data']['id']);
397
+		$this->assertEquals('product', $result['data']['type']);
398
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
399 399
 
400
-		$this->assertArrayNotHasKey( 'included', $result );
401
-		$this->assertArrayNotHasKey( 'errors', $result );
400
+		$this->assertArrayNotHasKey('included', $result);
401
+		$this->assertArrayNotHasKey('errors', $result);
402 402
 	}
403 403
 
404 404
 
405 405
 	public function testPatchBulk()
406 406
 	{
407
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
407
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
408 408
 
409 409
 		$item = $productManagerStub->createItem();
410
-		$item->setLabel( 'test' );
411
-		$item->setId( '-1' );
410
+		$item->setLabel('test');
411
+		$item->setId('-1');
412 412
 
413
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' )
414
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
415
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
416
-			->will( $this->returnValue( $item ) );
413
+		$productManagerStub->expects($this->exactly(2))->method('saveItem')
414
+			->will($this->returnValue($productManagerStub->createItem()));
415
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
416
+			->will($this->returnValue($item));
417 417
 
418 418
 
419 419
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
420
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
420
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
421 421
 
422
-		$response = $this->object->patch( $request, $this->view->response() );
423
-		$result = json_decode( (string) $response->getBody(), true );
422
+		$response = $this->object->patch($request, $this->view->response());
423
+		$result = json_decode((string) $response->getBody(), true);
424 424
 
425 425
 
426
-		$this->assertEquals( 200, $response->getStatusCode() );
427
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
426
+		$this->assertEquals(200, $response->getStatusCode());
427
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
428 428
 
429
-		$this->assertEquals( 2, $result['meta']['total'] );
430
-		$this->assertArrayHasKey( 'data', $result );
431
-		$this->assertEquals( 2, count( $result['data'] ) );
432
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
433
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
434
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
429
+		$this->assertEquals(2, $result['meta']['total']);
430
+		$this->assertArrayHasKey('data', $result);
431
+		$this->assertEquals(2, count($result['data']));
432
+		$this->assertEquals('-1', $result['data'][0]['id']);
433
+		$this->assertEquals('product', $result['data'][0]['type']);
434
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
435 435
 
436
-		$this->assertArrayNotHasKey( 'included', $result );
437
-		$this->assertArrayNotHasKey( 'errors', $result );
436
+		$this->assertArrayNotHasKey('included', $result);
437
+		$this->assertArrayNotHasKey('errors', $result);
438 438
 	}
439 439
 
440 440
 
441 441
 	public function testPatchInvalid()
442 442
 	{
443 443
 		$body = '{"data":null}';
444
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
444
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
445 445
 
446
-		$response = $this->object->patch( $request, $this->view->response() );
447
-		$result = json_decode( (string) $response->getBody(), true );
446
+		$response = $this->object->patch($request, $this->view->response());
447
+		$result = json_decode((string) $response->getBody(), true);
448 448
 
449 449
 
450
-		$this->assertEquals( 400, $response->getStatusCode() );
451
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
450
+		$this->assertEquals(400, $response->getStatusCode());
451
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
452 452
 
453
-		$this->assertEquals( 0, $result['meta']['total'] );
454
-		$this->assertArrayHasKey( 'errors', $result );
455
-		$this->assertArrayNotHasKey( 'included', $result );
456
-		$this->assertArrayNotHasKey( 'data', $result );
453
+		$this->assertEquals(0, $result['meta']['total']);
454
+		$this->assertArrayHasKey('errors', $result);
455
+		$this->assertArrayNotHasKey('included', $result);
456
+		$this->assertArrayNotHasKey('data', $result);
457 457
 	}
458 458
 
459 459
 
460 460
 	public function testPatchInvalidId()
461 461
 	{
462 462
 		$body = '{"data":{"id":-1}}';
463
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
463
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
464 464
 
465
-		$response = $this->object->patch( $request, $this->view->response() );
466
-		$result = json_decode( (string) $response->getBody(), true );
465
+		$response = $this->object->patch($request, $this->view->response());
466
+		$result = json_decode((string) $response->getBody(), true);
467 467
 
468 468
 
469
-		$this->assertEquals( 400, $response->getStatusCode() );
470
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
469
+		$this->assertEquals(400, $response->getStatusCode());
470
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
471 471
 
472
-		$this->assertEquals( 0, $result['meta']['total'] );
473
-		$this->assertArrayHasKey( 'errors', $result );
472
+		$this->assertEquals(0, $result['meta']['total']);
473
+		$this->assertArrayHasKey('errors', $result);
474 474
 	}
475 475
 
476 476
 
477 477
 	public function testPatchException()
478 478
 	{
479
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
480
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
479
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
480
+			->will($this->throwException(new \RuntimeException('test exception')));
481 481
 
482 482
 		$body = '{"data":[{"id":-1}]}';
483
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
483
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
484 484
 
485
-		$response = $this->object->patch( $request, $this->view->response() );
486
-		$result = json_decode( (string) $response->getBody(), true );
485
+		$response = $this->object->patch($request, $this->view->response());
486
+		$result = json_decode((string) $response->getBody(), true);
487 487
 
488 488
 
489
-		$this->assertEquals( 500, $response->getStatusCode() );
490
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
491
-		$this->assertArrayHasKey( 'errors', $result );
489
+		$this->assertEquals(500, $response->getStatusCode());
490
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
491
+		$this->assertArrayHasKey('errors', $result);
492 492
 	}
493 493
 
494 494
 
495 495
 	public function testPatchMShopException()
496 496
 	{
497
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
498
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
497
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
498
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
499 499
 
500 500
 		$body = '{"data":[{"id":-1}]}';
501
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
501
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
502 502
 
503
-		$response = $this->object->patch( $request, $this->view->response() );
504
-		$result = json_decode( (string) $response->getBody(), true );
503
+		$response = $this->object->patch($request, $this->view->response());
504
+		$result = json_decode((string) $response->getBody(), true);
505 505
 
506 506
 
507
-		$this->assertEquals( 404, $response->getStatusCode() );
508
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
509
-		$this->assertArrayHasKey( 'errors', $result );
507
+		$this->assertEquals(404, $response->getStatusCode());
508
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
509
+		$this->assertArrayHasKey('errors', $result);
510 510
 	}
511 511
 
512 512
 
513 513
 	public function testPost()
514 514
 	{
515
-		$productManagerStub = $this->getProductMock( array( 'createItem', 'getItem', 'saveItem' ) );
515
+		$productManagerStub = $this->getProductMock(array('createItem', 'getItem', 'saveItem'));
516 516
 
517 517
 		$item = new \Aimeos\MShop\Product\Item\Standard();
518
-		$item->setId( '-1' );
518
+		$item->setId('-1');
519 519
 
520
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'createItem' )
521
-			->will( $this->returnValue( $item ) );
522
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
523
-			->will( $this->returnValue( $item ) );
524
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
525
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
520
+		$productManagerStub->expects($this->exactly(2))->method('createItem')
521
+			->will($this->returnValue($item));
522
+		$productManagerStub->expects($this->any())->method('getItem')
523
+			->will($this->returnValue($item));
524
+		$productManagerStub->expects($this->once())->method('saveItem')
525
+			->will($this->returnValue($productManagerStub->createItem()));
526 526
 
527 527
 
528 528
 		$body = '{"data": {"type": "product", "attributes": {"product.type": "default", "product.label": "test"}}}';
529
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
529
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
530 530
 
531
-		$response = $this->object->post( $request, $this->view->response() );
532
-		$result = json_decode( (string) $response->getBody(), true );
531
+		$response = $this->object->post($request, $this->view->response());
532
+		$result = json_decode((string) $response->getBody(), true);
533 533
 
534
-		$this->assertEquals( 201, $response->getStatusCode() );
535
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
534
+		$this->assertEquals(201, $response->getStatusCode());
535
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
536 536
 
537
-		$this->assertEquals( 1, $result['meta']['total'] );
538
-		$this->assertArrayHasKey( 'data', $result );
539
-		$this->assertEquals( '-1', $result['data']['id'] );
540
-		$this->assertEquals( 'product', $result['data']['type'] );
541
-		$this->assertGreaterThan( 0, $result['data']['attributes']['product.typeid'] );
542
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
537
+		$this->assertEquals(1, $result['meta']['total']);
538
+		$this->assertArrayHasKey('data', $result);
539
+		$this->assertEquals('-1', $result['data']['id']);
540
+		$this->assertEquals('product', $result['data']['type']);
541
+		$this->assertGreaterThan(0, $result['data']['attributes']['product.typeid']);
542
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
543 543
 
544
-		$this->assertArrayNotHasKey( 'included', $result );
545
-		$this->assertArrayNotHasKey( 'errors', $result );
544
+		$this->assertArrayNotHasKey('included', $result);
545
+		$this->assertArrayNotHasKey('errors', $result);
546 546
 	}
547 547
 
548 548
 
549 549
 	public function testPostBulk()
550 550
 	{
551
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
551
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
552 552
 
553 553
 		$item = $productManagerStub->createItem();
554
-		$item->setLabel( 'test' );
555
-		$item->setId( '-1' );
554
+		$item->setLabel('test');
555
+		$item->setId('-1');
556 556
 
557
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' )
558
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
559
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
560
-			->will( $this->returnValue( $item ) );
557
+		$productManagerStub->expects($this->exactly(2))->method('saveItem')
558
+			->will($this->returnValue($productManagerStub->createItem()));
559
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
560
+			->will($this->returnValue($item));
561 561
 
562 562
 
563 563
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
564
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
564
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
565 565
 
566
-		$response = $this->object->post( $request, $this->view->response() );
567
-		$result = json_decode( (string) $response->getBody(), true );
566
+		$response = $this->object->post($request, $this->view->response());
567
+		$result = json_decode((string) $response->getBody(), true);
568 568
 
569 569
 
570
-		$this->assertEquals( 201, $response->getStatusCode() );
571
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
570
+		$this->assertEquals(201, $response->getStatusCode());
571
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
572 572
 
573
-		$this->assertEquals( 2, $result['meta']['total'] );
574
-		$this->assertArrayHasKey( 'data', $result );
575
-		$this->assertEquals( 2, count( $result['data'] ) );
576
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
577
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
578
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
573
+		$this->assertEquals(2, $result['meta']['total']);
574
+		$this->assertArrayHasKey('data', $result);
575
+		$this->assertEquals(2, count($result['data']));
576
+		$this->assertEquals('-1', $result['data'][0]['id']);
577
+		$this->assertEquals('product', $result['data'][0]['type']);
578
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
579 579
 
580
-		$this->assertArrayNotHasKey( 'included', $result );
581
-		$this->assertArrayNotHasKey( 'errors', $result );
580
+		$this->assertArrayNotHasKey('included', $result);
581
+		$this->assertArrayNotHasKey('errors', $result);
582 582
 	}
583 583
 
584 584
 
585 585
 	public function testPostRelationships()
586 586
 	{
587
-		$productManagerStub = $this->getProductMock( array( 'getSubManager', 'createItem', 'getItem', 'saveItem' ) );
588
-		$productManagerListsStub = $this->getProductListsMock( array( 'saveItem' ) );
587
+		$productManagerStub = $this->getProductMock(array('getSubManager', 'createItem', 'getItem', 'saveItem'));
588
+		$productManagerListsStub = $this->getProductListsMock(array('saveItem'));
589 589
 
590 590
 		$item = new \Aimeos\MShop\Product\Item\Standard();
591
-		$item->setId( '-1' );
591
+		$item->setId('-1');
592 592
 
593
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'createItem' )
594
-			->will( $this->returnValue( $item ) );
595
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
596
-			->will( $this->returnValue( $item ) );
597
-		$productManagerStub->expects( $this->once() )->method( 'getSubManager' )
598
-			->will( $this->returnValue( $productManagerListsStub ) );
599
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
600
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
593
+		$productManagerStub->expects($this->exactly(2))->method('createItem')
594
+			->will($this->returnValue($item));
595
+		$productManagerStub->expects($this->any())->method('getItem')
596
+			->will($this->returnValue($item));
597
+		$productManagerStub->expects($this->once())->method('getSubManager')
598
+			->will($this->returnValue($productManagerListsStub));
599
+		$productManagerStub->expects($this->once())->method('saveItem')
600
+			->will($this->returnValue($productManagerStub->createItem()));
601 601
 
602
-		$productManagerListsStub->expects( $this->once() )->method( 'saveItem' );
602
+		$productManagerListsStub->expects($this->once())->method('saveItem');
603 603
 
604 604
 		$body = '{"data": {"type": "product",
605 605
 			"attributes": {"product.label": "test"},
@@ -607,212 +607,212 @@  discard block
 block discarded – undo
607 607
 				{"type": "text", "id": "-2", "attributes": {"product.lists.type": "default"}}
608 608
 			]}}
609 609
 		}}';
610
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
610
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
611 611
 
612
-		$response = $this->object->post( $request, $this->view->response() );
613
-		$result = json_decode( (string) $response->getBody(), true );
612
+		$response = $this->object->post($request, $this->view->response());
613
+		$result = json_decode((string) $response->getBody(), true);
614 614
 
615 615
 
616
-		$this->assertEquals( 201, $response->getStatusCode() );
617
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
616
+		$this->assertEquals(201, $response->getStatusCode());
617
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
618 618
 
619
-		$this->assertEquals( 1, $result['meta']['total'] );
620
-		$this->assertArrayHasKey( 'data', $result );
621
-		$this->assertEquals( '-1', $result['data']['id'] );
622
-		$this->assertEquals( 'product', $result['data']['type'] );
623
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
619
+		$this->assertEquals(1, $result['meta']['total']);
620
+		$this->assertArrayHasKey('data', $result);
621
+		$this->assertEquals('-1', $result['data']['id']);
622
+		$this->assertEquals('product', $result['data']['type']);
623
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
624 624
 
625
-		$this->assertArrayNotHasKey( 'included', $result );
626
-		$this->assertArrayNotHasKey( 'errors', $result );
625
+		$this->assertArrayNotHasKey('included', $result);
626
+		$this->assertArrayNotHasKey('errors', $result);
627 627
 	}
628 628
 
629 629
 
630 630
 	public function testPostInvalid()
631 631
 	{
632 632
 		$body = '{"data":null}';
633
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
633
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
634 634
 
635
-		$response = $this->object->post( $request, $this->view->response() );
636
-		$result = json_decode( (string) $response->getBody(), true );
635
+		$response = $this->object->post($request, $this->view->response());
636
+		$result = json_decode((string) $response->getBody(), true);
637 637
 
638 638
 
639
-		$this->assertEquals( 400, $response->getStatusCode() );
640
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
639
+		$this->assertEquals(400, $response->getStatusCode());
640
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
641 641
 
642
-		$this->assertEquals( 0, $result['meta']['total'] );
643
-		$this->assertArrayHasKey( 'errors', $result );
644
-		$this->assertArrayNotHasKey( 'included', $result );
645
-		$this->assertArrayNotHasKey( 'data', $result );
642
+		$this->assertEquals(0, $result['meta']['total']);
643
+		$this->assertArrayHasKey('errors', $result);
644
+		$this->assertArrayNotHasKey('included', $result);
645
+		$this->assertArrayNotHasKey('data', $result);
646 646
 	}
647 647
 
648 648
 
649 649
 	public function testPostInvalidId()
650 650
 	{
651 651
 		$body = '{"data":{"id":-1}}';
652
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
652
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
653 653
 
654
-		$response = $this->object->post( $request, $this->view->response() );
655
-		$result = json_decode( (string) $response->getBody(), true );
654
+		$response = $this->object->post($request, $this->view->response());
655
+		$result = json_decode((string) $response->getBody(), true);
656 656
 
657 657
 
658
-		$this->assertEquals( 403, $response->getStatusCode() );
659
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
658
+		$this->assertEquals(403, $response->getStatusCode());
659
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
660 660
 
661
-		$this->assertEquals( 0, $result['meta']['total'] );
662
-		$this->assertArrayHasKey( 'errors', $result );
661
+		$this->assertEquals(0, $result['meta']['total']);
662
+		$this->assertArrayHasKey('errors', $result);
663 663
 	}
664 664
 
665 665
 
666 666
 	public function testPostException()
667 667
 	{
668
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
669
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
668
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
669
+			->will($this->throwException(new \RuntimeException('test exception')));
670 670
 
671 671
 		$body = '{"data":{}}';
672
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
672
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
673 673
 
674
-		$response = $this->object->post( $request, $this->view->response() );
675
-		$result = json_decode( (string) $response->getBody(), true );
674
+		$response = $this->object->post($request, $this->view->response());
675
+		$result = json_decode((string) $response->getBody(), true);
676 676
 
677 677
 
678
-		$this->assertEquals( 500, $response->getStatusCode() );
679
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
680
-		$this->assertArrayHasKey( 'errors', $result );
678
+		$this->assertEquals(500, $response->getStatusCode());
679
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
680
+		$this->assertArrayHasKey('errors', $result);
681 681
 	}
682 682
 
683 683
 
684 684
 	public function testPostMShopException()
685 685
 	{
686
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
687
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
686
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
687
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
688 688
 
689 689
 		$body = '{"data":{}}';
690
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
690
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
691 691
 
692
-		$response = $this->object->post( $request, $this->view->response() );
693
-		$result = json_decode( (string) $response->getBody(), true );
692
+		$response = $this->object->post($request, $this->view->response());
693
+		$result = json_decode((string) $response->getBody(), true);
694 694
 
695 695
 
696
-		$this->assertEquals( 404, $response->getStatusCode() );
697
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
698
-		$this->assertArrayHasKey( 'errors', $result );
696
+		$this->assertEquals(404, $response->getStatusCode());
697
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
698
+		$this->assertArrayHasKey('errors', $result);
699 699
 	}
700 700
 
701 701
 
702 702
 	public function testPut()
703 703
 	{
704
-		$response = $this->object->put( $this->view->request(), $this->view->response() );
705
-		$result = json_decode( (string) $response->getBody(), true );
704
+		$response = $this->object->put($this->view->request(), $this->view->response());
705
+		$result = json_decode((string) $response->getBody(), true);
706 706
 
707
-		$this->assertEquals( 501, $response->getStatusCode() );
708
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
709
-		$this->assertArrayHasKey( 'errors', $result );
707
+		$this->assertEquals(501, $response->getStatusCode());
708
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
709
+		$this->assertArrayHasKey('errors', $result);
710 710
 	}
711 711
 
712 712
 
713 713
 	public function testOptions()
714 714
 	{
715
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
716
-		$result = json_decode( (string) $response->getBody(), true );
715
+		$response = $this->object->options($this->view->request(), $this->view->response());
716
+		$result = json_decode((string) $response->getBody(), true);
717 717
 
718 718
 
719
-		$this->assertEquals( 200, $response->getStatusCode() );
720
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
721
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
719
+		$this->assertEquals(200, $response->getStatusCode());
720
+		$this->assertEquals(1, count($response->getHeader('Allow')));
721
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
722 722
 
723
-		$this->assertNull( $result['meta']['prefix'] );
724
-		$this->assertGreaterThan( 59, count( $result['meta']['resources'] ) );
725
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
723
+		$this->assertNull($result['meta']['prefix']);
724
+		$this->assertGreaterThan(59, count($result['meta']['resources']));
725
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
726 726
 
727
-		$this->assertArrayNotHasKey( 'errors', $result );
727
+		$this->assertArrayNotHasKey('errors', $result);
728 728
 	}
729 729
 
730 730
 
731 731
 	public function testOptionsWithPrefix()
732 732
 	{
733
-		$response = $this->object->options( $this->view->request(), $this->view->response(), 'prefix' );
734
-		$result = json_decode( (string) $response->getBody(), true );
733
+		$response = $this->object->options($this->view->request(), $this->view->response(), 'prefix');
734
+		$result = json_decode((string) $response->getBody(), true);
735 735
 
736 736
 
737
-		$this->assertEquals( 200, $response->getStatusCode() );
738
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
739
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
737
+		$this->assertEquals(200, $response->getStatusCode());
738
+		$this->assertEquals(1, count($response->getHeader('Allow')));
739
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
740 740
 
741
-		$this->assertEquals( 'prefix', $result['meta']['prefix'] );
742
-		$this->assertGreaterThan( 59, count( $result['meta']['resources'] ) );
743
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
741
+		$this->assertEquals('prefix', $result['meta']['prefix']);
742
+		$this->assertGreaterThan(59, count($result['meta']['resources']));
743
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
744 744
 
745
-		$this->assertArrayNotHasKey( 'errors', $result );
745
+		$this->assertArrayNotHasKey('errors', $result);
746 746
 	}
747 747
 
748 748
 
749 749
 	public function testOptionsException()
750 750
 	{
751
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
752
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
751
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
752
+			->will($this->throwException(new \RuntimeException('test exception')));
753 753
 
754
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
755
-		$result = json_decode( (string) $response->getBody(), true );
754
+		$response = $this->object->options($this->view->request(), $this->view->response());
755
+		$result = json_decode((string) $response->getBody(), true);
756 756
 
757
-		$this->assertEquals( 500, $response->getStatusCode() );
758
-		$this->assertArrayHasKey( 'errors', $result );
757
+		$this->assertEquals(500, $response->getStatusCode());
758
+		$this->assertArrayHasKey('errors', $result);
759 759
 	}
760 760
 
761 761
 
762 762
 	public function testOptionsMShopException()
763 763
 	{
764
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
765
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
764
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
765
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
766 766
 
767
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
768
-		$result = json_decode( (string) $response->getBody(), true );
767
+		$response = $this->object->options($this->view->request(), $this->view->response());
768
+		$result = json_decode((string) $response->getBody(), true);
769 769
 
770
-		$this->assertEquals( 404, $response->getStatusCode() );
771
-		$this->assertArrayHasKey( 'errors', $result );
770
+		$this->assertEquals(404, $response->getStatusCode());
771
+		$this->assertArrayHasKey('errors', $result);
772 772
 	}
773 773
 
774 774
 
775
-	protected function getProductMock( array $methods )
775
+	protected function getProductMock(array $methods)
776 776
 	{
777 777
 		$name = 'ClientJsonAdmStandard';
778
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
778
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
779 779
 
780
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
781
-			->setConstructorArgs( array( $this->context ) )
782
-			->setMethods( $methods )
780
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
781
+			->setConstructorArgs(array($this->context))
782
+			->setMethods($methods)
783 783
 			->getMock();
784 784
 
785
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
785
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
786 786
 
787 787
 		return $stub;
788 788
 	}
789 789
 
790 790
 
791
-	protected function getProductListsMock( array $methods )
791
+	protected function getProductListsMock(array $methods)
792 792
 	{
793 793
 		$name = 'ClientJsonAdmStandard';
794
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
794
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
795 795
 
796
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
797
-			->setConstructorArgs( array( $this->context ) )
798
-			->setMethods( $methods )
796
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
797
+			->setConstructorArgs(array($this->context))
798
+			->setMethods($methods)
799 799
 			->getMock();
800 800
 
801
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
801
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
802 802
 
803 803
 		return $stub;
804 804
 	}
805 805
 
806 806
 
807
-	protected function getProductItem( $code = 'CNC' )
807
+	protected function getProductItem($code = 'CNC')
808 808
 	{
809
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
809
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
810 810
 		$search = $manager->createSearch();
811
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
812
-		$items = $manager->searchItems( $search );
811
+		$search->setConditions($search->compare('==', 'product.code', $code));
812
+		$items = $manager->searchItems($search);
813 813
 
814
-		if( ( $item = reset( $items ) ) === false ) {
815
-			throw new \RuntimeException( sprintf( 'No product item with code "%1$s" found', $code ) );
814
+		if (($item = reset($items)) === false) {
815
+			throw new \RuntimeException(sprintf('No product item with code "%1$s" found', $code));
816 816
 		}
817 817
 
818 818
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/templates/config-default.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,29 +9,29 @@  discard block
 block discarded – undo
9 9
 
10 10
 
11 11
 $options = 0;
12
-if( defined( 'JSON_PRETTY_PRINT' ) ) {
12
+if (defined('JSON_PRETTY_PRINT')) {
13 13
 	$options = JSON_PRETTY_PRINT;
14 14
 }
15 15
 
16 16
 
17
-$fields = $this->param( 'fields', [] );
17
+$fields = $this->param('fields', []);
18 18
 
19
-foreach( (array) $fields as $resource => $list ) {
20
-	$fields[$resource] = array_flip( explode( ',', $list ) );
19
+foreach ((array) $fields as $resource => $list) {
20
+	$fields[$resource] = array_flip(explode(',', $list));
21 21
 }
22 22
 
23 23
 
24
-$build = function( array $attrItems, $id ) use ( $fields )
24
+$build = function(array $attrItems, $id) use ($fields)
25 25
 {
26 26
 	$result = [];
27 27
 	$type = 'criteria/attribute';
28 28
 
29
-	foreach( $attrItems as $attrItem )
29
+	foreach ($attrItems as $attrItem)
30 30
 	{
31
-		$attributes = $attrItem->toArray( true );
31
+		$attributes = $attrItem->toArray(true);
32 32
 
33
-		if( isset( $fields[$type] ) ) {
34
-			$attributes = array_intersect_key( $attributes, $fields[$type] );
33
+		if (isset($fields[$type])) {
34
+			$attributes = array_intersect_key($attributes, $fields[$type]);
35 35
 		}
36 36
 
37 37
 		$result[] = array(
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 };
46 46
 
47 47
 
48
-$configItems = $this->get( 'configItems', [] );
48
+$configItems = $this->get('configItems', []);
49 49
 
50 50
 
51 51
 ?>
52 52
 {
53 53
 	"meta": {
54
-		"total": <?= count( $configItems ); ?>
54
+		"total": <?= count($configItems); ?>
55 55
 
56 56
 	}
57 57
 
58
-	<?php if( isset( $this->errors ) ) : ?>
58
+	<?php if (isset($this->errors)) : ?>
59 59
 
60
-		, "errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
60
+		, "errors": <?= $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
61 61
 
62 62
 	<?php else : ?>
63 63
 
64
-		, "data": <?= json_encode( $build( $configItems, $this->param( 'id' ) ), $options ); ?>
64
+		, "data": <?= json_encode($build($configItems, $this->param('id')), $options); ?>
65 65
 
66 66
 	<?php endif; ?>
67 67
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,9 +59,12 @@
 block discarded – undo
59 59
 
60 60
 		, "errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
61 61
 
62
-	<?php else : ?>
62
+	<?php else {
63
+	: ?>
63 64
 
64
-		, "data": <?= json_encode( $build( $configItems, $this->param( 'id' ) ), $options ); ?>
65
+		, "data": <?= json_encode( $build( $configItems, $this->param( 'id' ) ), $options );
66
+}
67
+?>
65 68
 
66 69
 	<?php endif; ?>
67 70
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/Config/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJadm::getContext();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard( $this->context, $this->view, $templatePaths, 'service/config' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Service\Config\Standard($this->context, $this->view, $templatePaths, 'service/config');
26 26
 	}
27 27
 
28 28
 
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
 			'id' => 'DirectDebit,Category',
33 33
 			'type' => 'payment',
34 34
 		);
35
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
36
-		$this->view->addHelper( 'param', $helper );
35
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
36
+		$this->view->addHelper('param', $helper);
37 37
 
38
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
39
-		$result = json_decode( (string) $response->getBody(), true );
38
+		$response = $this->object->get($this->view->request(), $this->view->response());
39
+		$result = json_decode((string) $response->getBody(), true);
40 40
 
41
-		$this->assertEquals( 200, $response->getStatusCode() );
42
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
41
+		$this->assertEquals(200, $response->getStatusCode());
42
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
43 43
 
44
-		$this->assertEquals( 6, $result['meta']['total'] );
45
-		$this->assertInternalType( 'array', $result['data'] );
46
-		$this->assertEquals( 'payment.url-success', $result['data'][0]['id'] );
47
-		$this->assertEquals( 'payment.url-failure', $result['data'][1]['id'] );
48
-		$this->assertEquals( 'payment.url-cancel', $result['data'][2]['id'] );
49
-		$this->assertEquals( 'payment.url-update', $result['data'][3]['id'] );
50
-		$this->assertEquals( 'category.include', $result['data'][4]['id'] );
51
-		$this->assertEquals( 'category.exclude', $result['data'][5]['id'] );
44
+		$this->assertEquals(6, $result['meta']['total']);
45
+		$this->assertInternalType('array', $result['data']);
46
+		$this->assertEquals('payment.url-success', $result['data'][0]['id']);
47
+		$this->assertEquals('payment.url-failure', $result['data'][1]['id']);
48
+		$this->assertEquals('payment.url-cancel', $result['data'][2]['id']);
49
+		$this->assertEquals('payment.url-update', $result['data'][3]['id']);
50
+		$this->assertEquals('category.include', $result['data'][4]['id']);
51
+		$this->assertEquals('category.exclude', $result['data'][5]['id']);
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Service/Config/Standard.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		$view = $this->getView();
116 116
 
117 117
 		try
118 118
 		{
119
-			$response = $this->getItems( $view, $request, $response );
119
+			$response = $this->getItems($view, $request, $response);
120 120
 			$status = 200;
121 121
 		}
122
-		catch( \Aimeos\MShop\Exception $e )
122
+		catch (\Aimeos\MShop\Exception $e)
123 123
 		{
124 124
 			$status = 404;
125
-			$view->errors = array( array(
126
-				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
125
+			$view->errors = array(array(
126
+				'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()),
127 127
 				'detail' => $e->getTraceAsString(),
128
-			) );
128
+			));
129 129
 		}
130
-		catch( \Exception $e )
130
+		catch (\Exception $e)
131 131
 		{
132 132
 			$status = 500;
133
-			$view->errors = array( array(
133
+			$view->errors = array(array(
134 134
 				'title' => $e->getMessage(),
135 135
 				'detail' => $e->getTraceAsString(),
136
-			) );
136
+			));
137 137
 		}
138 138
 
139 139
 		/** admin/jsonadm/service/config/template-get
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 		$tplconf = 'admin/jsonadm/service/config/template-get';
159 159
 		$default = 'config-default.php';
160 160
 
161
-		$body = $view->render( $view->config( $tplconf, $default ) );
161
+		$body = $view->render($view->config($tplconf, $default));
162 162
 
163
-		return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' )
164
-			->withBody( $view->response()->createStreamFromString( $body ) )
165
-			->withStatus( $status );
163
+		return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"')
164
+			->withBody($view->response()->createStreamFromString($body))
165
+			->withStatus($status);
166 166
 	}
167 167
 
168 168
 
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
175 175
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
176 176
 	 */
177
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
177
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
178 178
 	{
179
-		if( ( $id = $view->param( 'id' ) ) == null ) {
180
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
179
+		if (($id = $view->param('id')) == null) {
180
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
181 181
 		}
182 182
 
183
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
183
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
184 184
 
185 185
 		// @todo Pass type as second parameter to getProvider()
186 186
 		$values = [
187
-			'service.type' => $view->param( 'type', 'payment' ),
187
+			'service.type' => $view->param('type', 'payment'),
188 188
 			'service.provider' => $id,
189 189
 		];
190
-		$item = new \Aimeos\MShop\Service\Item\Standard( $values );
190
+		$item = new \Aimeos\MShop\Service\Item\Standard($values);
191 191
 
192
-		$view->configItems = $manager->getProvider( $item )->getConfigBE();
192
+		$view->configItems = $manager->getProvider($item)->getConfigBE();
193 193
 
194 194
 		return $response;
195 195
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,16 +118,14 @@
 block discarded – undo
118 118
 		{
119 119
 			$response = $this->getItems( $view, $request, $response );
120 120
 			$status = 200;
121
-		}
122
-		catch( \Aimeos\MShop\Exception $e )
121
+		} catch( \Aimeos\MShop\Exception $e )
123 122
 		{
124 123
 			$status = 404;
125 124
 			$view->errors = array( array(
126 125
 				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
127 126
 				'detail' => $e->getTraceAsString(),
128 127
 			) );
129
-		}
130
-		catch( \Exception $e )
128
+		} catch( \Exception $e )
131 129
 		{
132 130
 			$status = 500;
133 131
 			$view->errors = array( array(
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Plugin/Config/Standard.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		$view = $this->getView();
116 116
 
117 117
 		try
118 118
 		{
119
-			$response = $this->getItems( $view, $request, $response );
119
+			$response = $this->getItems($view, $request, $response);
120 120
 			$status = 200;
121 121
 		}
122
-		catch( \Aimeos\MShop\Exception $e )
122
+		catch (\Aimeos\MShop\Exception $e)
123 123
 		{
124 124
 			$status = 404;
125
-			$view->errors = array( array(
126
-				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
125
+			$view->errors = array(array(
126
+				'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()),
127 127
 				'detail' => $e->getTraceAsString(),
128
-			) );
128
+			));
129 129
 		}
130
-		catch( \Exception $e )
130
+		catch (\Exception $e)
131 131
 		{
132 132
 			$status = 500;
133
-			$view->errors = array( array(
133
+			$view->errors = array(array(
134 134
 				'title' => $e->getMessage(),
135 135
 				'detail' => $e->getTraceAsString(),
136
-			) );
136
+			));
137 137
 		}
138 138
 
139 139
 		/** admin/jsonadm/plugin/config/template-get
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 		$tplconf = 'admin/jsonadm/plugin/config/template-get';
159 159
 		$default = 'config-default.php';
160 160
 
161
-		$body = $view->render( $view->config( $tplconf, $default ) );
161
+		$body = $view->render($view->config($tplconf, $default));
162 162
 
163
-		return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' )
164
-			->withBody( $view->response()->createStreamFromString( $body ) )
165
-			->withStatus( $status );
163
+		return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"')
164
+			->withBody($view->response()->createStreamFromString($body))
165
+			->withStatus($status);
166 166
 	}
167 167
 
168 168
 
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
175 175
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
176 176
 	 */
177
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
177
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
178 178
 	{
179
-		if( ( $id = $view->param( 'id' ) ) == null ) {
180
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
179
+		if (($id = $view->param('id')) == null) {
180
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
181 181
 		}
182 182
 
183
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'plugin' );
183
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin');
184 184
 
185 185
 		// @todo Pass type as second parameter to getProvider()
186 186
 		$values = [
187
-			'plugin.type' => $view->param( 'type', 'order' ),
187
+			'plugin.type' => $view->param('type', 'order'),
188 188
 			'plugin.provider' => $id,
189 189
 		];
190
-		$item = new \Aimeos\MShop\Plugin\Item\Standard( $values );
190
+		$item = new \Aimeos\MShop\Plugin\Item\Standard($values);
191 191
 
192
-		$view->configItems = $manager->getProvider( $item )->getConfigBE();
192
+		$view->configItems = $manager->getProvider($item)->getConfigBE();
193 193
 
194 194
 		return $response;
195 195
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,16 +118,14 @@
 block discarded – undo
118 118
 		{
119 119
 			$response = $this->getItems( $view, $request, $response );
120 120
 			$status = 200;
121
-		}
122
-		catch( \Aimeos\MShop\Exception $e )
121
+		} catch( \Aimeos\MShop\Exception $e )
123 122
 		{
124 123
 			$status = 404;
125 124
 			$view->errors = array( array(
126 125
 				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
127 126
 				'detail' => $e->getTraceAsString(),
128 127
 			) );
129
-		}
130
-		catch( \Exception $e )
128
+		} catch( \Exception $e )
131 129
 		{
132 130
 			$status = 500;
133 131
 			$view->errors = array( array(
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Base.php 1 patch
Spacing   +71 added lines, -71 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/property"
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;
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param array $param List of method parameter
50 50
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed
51 51
 	 */
52
-	public function __call( $name, array $param )
52
+	public function __call($name, array $param)
53 53
 	{
54
-		throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) );
54
+		throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Unable to call method "%1$s"', $name));
55 55
 	}
56 56
 
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param array $include List of resource types that should be fetched
63 63
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
64 64
 	 */
65
-	protected function getChildItems( array $items, array $include )
65
+	protected function getChildItems(array $items, array $include)
66 66
 	{
67 67
 		return [];
68 68
 	}
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
86 86
 	 * @return array List of domain names
87 87
 	 */
88
-	protected function getDomains( \Aimeos\MW\View\Iface $view )
88
+	protected function getDomains(\Aimeos\MW\View\Iface $view)
89 89
 	{
90
-		if( ( $domains = $view->param( 'resource' ) ) == '' )
90
+		if (($domains = $view->param('resource')) == '')
91 91
 		{
92 92
 			/** admin/jsonadm/domains
93 93
 			 * A list of domain names whose clients are available for the JSON API
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 				'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order',
111 111
 				'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text'
112 112
 			);
113
-			$domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default );
113
+			$domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
114 114
 		}
115 115
 
116 116
 		return (array) $domains;
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 * @param \stdClass $request Decoded request body
124 124
 	 * @return array List of item IDs
125 125
 	 */
126
-	protected function getIds( $request )
126
+	protected function getIds($request)
127 127
 	{
128 128
 		$ids = [];
129 129
 
130
-		if( isset( $request->data ) )
130
+		if (isset($request->data))
131 131
 		{
132
-			foreach( (array) $request->data as $entry )
132
+			foreach ((array) $request->data as $entry)
133 133
 			{
134
-				if( isset( $entry->id ) ) {
134
+				if (isset($entry->id)) {
135 135
 					$ids[] = $entry->id;
136 136
 				}
137 137
 			}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param array $include List of resource types that should be fetched
149 149
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
150 150
 	 */
151
-	protected function getListItems( array $items, array $include )
151
+	protected function getListItems(array $items, array $include)
152 152
 	{
153 153
 		return [];
154 154
 	}
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
172 172
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
173 173
 	 */
174
-	protected function getRefItems( array $listItems )
174
+	protected function getRefItems(array $listItems)
175 175
 	{
176 176
 		$list = $map = [];
177 177
 		$context = $this->getContext();
178 178
 
179
-		foreach( $listItems as $listItem ) {
179
+		foreach ($listItems as $listItem) {
180 180
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
181 181
 		}
182 182
 
183
-		foreach( $map as $domain => $ids )
183
+		foreach ($map as $domain => $ids)
184 184
 		{
185
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
185
+			$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
186 186
 
187 187
 			$search = $manager->createSearch();
188
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
188
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
189 189
 
190
-			$list = array_merge( $list, $manager->searchItems( $search ) );
190
+			$list = array_merge($list, $manager->searchItems($search));
191 191
 		}
192 192
 
193 193
 		return $list;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
201 201
 	 * @return array List of domain names
202 202
 	 */
203
-	protected function getResources( \Aimeos\MW\View\Iface $view )
203
+	protected function getResources(\Aimeos\MW\View\Iface $view)
204 204
 	{
205 205
 		/** admin/jsonadm/resources
206 206
 		 * A list of additional resources name whose clients are available for the JSON API
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		 * @category Developer
219 219
 		 * @see admin/jsonadm/domains
220 220
 		 */
221
-		return (array) $view->config( 'admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config'] );
221
+		return (array) $view->config('admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config']);
222 222
 	}
223 223
 
224 224
 
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 	 * @param array $params List of criteria data with condition, sorting and paging
252 252
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
253 253
 	 */
254
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
254
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
255 255
 	{
256
-		$this->initCriteriaConditions( $criteria, $params );
257
-		$this->initCriteriaSortations( $criteria, $params );
258
-		$this->initCriteriaSlice( $criteria, $params );
256
+		$this->initCriteriaConditions($criteria, $params);
257
+		$this->initCriteriaSortations($criteria, $params);
258
+		$this->initCriteriaSlice($criteria, $params);
259 259
 
260 260
 		return $criteria;
261 261
 	}
@@ -267,17 +267,17 @@  discard block
 block discarded – undo
267 267
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
268 268
 	 * @param array $params List of criteria data with condition, sorting and paging
269 269
 	 */
270
-	protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
270
+	protected function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
271 271
 	{
272
-		if( !isset( $params['filter'] ) ) {
272
+		if (!isset($params['filter'])) {
273 273
 			return;
274 274
 		}
275 275
 
276 276
 		$existing = $criteria->getConditions();
277
-		$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
277
+		$criteria->setConditions($criteria->toConditions((array) $params['filter']));
278 278
 
279
-		$expr = array( $criteria->getConditions(), $existing );
280
-		$criteria->setConditions( $criteria->combine( '&&', $expr ) );
279
+		$expr = array($criteria->getConditions(), $existing);
280
+		$criteria->setConditions($criteria->combine('&&', $expr));
281 281
 	}
282 282
 
283 283
 
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
288 288
 	 * @param array $params List of criteria data with condition, sorting and paging
289 289
 	 */
290
-	protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
290
+	protected function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
291 291
 	{
292
-		$start = ( isset( $params['page']['offset'] ) ? (int) $params['page']['offset'] : 0 );
293
-		$size = ( isset( $params['page']['limit'] ) ? (int) $params['page']['limit'] : 25 );
292
+		$start = (isset($params['page']['offset']) ? (int) $params['page']['offset'] : 0);
293
+		$size = (isset($params['page']['limit']) ? (int) $params['page']['limit'] : 25);
294 294
 
295
-		$criteria->setSlice( $start, $size );
295
+		$criteria->setSlice($start, $size);
296 296
 	}
297 297
 
298 298
 
@@ -302,24 +302,24 @@  discard block
 block discarded – undo
302 302
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
303 303
 	 * @param array $params List of criteria data with condition, sorting and paging
304 304
 	 */
305
-	protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
305
+	protected function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
306 306
 	{
307
-		if( !isset( $params['sort'] ) ) {
307
+		if (!isset($params['sort'])) {
308 308
 			return;
309 309
 		}
310 310
 
311 311
 		$sortation = [];
312 312
 
313
-		foreach( explode( ',', $params['sort'] ) as $sort )
313
+		foreach (explode(',', $params['sort']) as $sort)
314 314
 		{
315
-			if( $sort[0] === '-' ) {
316
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
315
+			if ($sort[0] === '-') {
316
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
317 317
 			} else {
318
-				$sortation[] = $criteria->sort( '+', $sort );
318
+				$sortation[] = $criteria->sort('+', $sort);
319 319
 			}
320 320
 		}
321 321
 
322
-		$criteria->setSortations( $sortation );
322
+		$criteria->setSortations($sortation);
323 323
 	}
324 324
 
325 325
 
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
 	 * @param \stdClass $request Object with request body data
331 331
 	 * @return array List of items
332 332
 	 */
333
-	protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request )
333
+	protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request)
334 334
 	{
335 335
 		$data = [];
336 336
 
337
-		if( isset( $request->data ) )
337
+		if (isset($request->data))
338 338
 		{
339
-			foreach( (array) $request->data as $entry ) {
340
-				$data[] = $this->saveEntry( $manager, $entry );
339
+			foreach ((array) $request->data as $entry) {
340
+				$data[] = $this->saveEntry($manager, $entry);
341 341
 			}
342 342
 		}
343 343
 
@@ -352,22 +352,22 @@  discard block
 block discarded – undo
352 352
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
353 353
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
354 354
 	 */
355
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
355
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
356 356
 	{
357
-		if( isset( $entry->id ) ) {
358
-			$item = $manager->getItem( $entry->id );
357
+		if (isset($entry->id)) {
358
+			$item = $manager->getItem($entry->id);
359 359
 		} else {
360 360
 			$item = $manager->createItem();
361 361
 		}
362 362
 
363
-		$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
364
-		$item = $manager->saveItem( $item );
363
+		$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
364
+		$item = $manager->saveItem($item);
365 365
 
366
-		if( isset( $entry->relationships ) ) {
367
-			$this->saveRelationships( $manager, $item, $entry->relationships );
366
+		if (isset($entry->relationships)) {
367
+			$this->saveRelationships($manager, $item, $entry->relationships);
368 368
 		}
369 369
 
370
-		return $manager->getItem( $item->getId() );
370
+		return $manager->getItem($item->getId());
371 371
 	}
372 372
 
373 373
 
@@ -378,28 +378,28 @@  discard block
 block discarded – undo
378 378
 	 * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set
379 379
 	 * @param \stdClass $relationships Object including the <domain>/data/attributes structure
380 380
 	 */
381
-	protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager,
382
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships )
381
+	protected function saveRelationships(\Aimeos\MShop\Common\Manager\Iface $manager,
382
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships)
383 383
 	{
384 384
 		$id = $item->getId();
385
-		$listManager = $manager->getSubManager( 'lists' );
385
+		$listManager = $manager->getSubManager('lists');
386 386
 
387
-		foreach( (array) $relationships as $domain => $list )
387
+		foreach ((array) $relationships as $domain => $list)
388 388
 		{
389
-			if( isset( $list->data ) )
389
+			if (isset($list->data))
390 390
 			{
391
-				foreach( (array) $list->data as $data )
391
+				foreach ((array) $list->data as $data)
392 392
 				{
393
-					$listItem = $this->addItemData( $listManager, $listManager->createItem(), $data, $domain );
393
+					$listItem = $this->addItemData($listManager, $listManager->createItem(), $data, $domain);
394 394
 
395
-					if( isset( $data->id ) ) {
396
-						$listItem->setRefId( $data->id );
395
+					if (isset($data->id)) {
396
+						$listItem->setRefId($data->id);
397 397
 					}
398 398
 
399
-					$listItem->setParentId( $id );
400
-					$listItem->setDomain( $domain );
399
+					$listItem->setParentId($id);
400
+					$listItem->setDomain($domain);
401 401
 
402
-					$listManager->saveItem( $listItem, false );
402
+					$listManager->saveItem($listItem, false);
403 403
 				}
404 404
 			}
405 405
 		}
@@ -416,20 +416,20 @@  discard block
 block discarded – undo
416 416
 	 * @return \Aimeos\MShop\Common\Item\Iface Item including the data
417 417
 	 */
418 418
 	protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager,
419
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain )
419
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain)
420 420
 	{
421
-		if( isset( $data->attributes ) )
421
+		if (isset($data->attributes))
422 422
 		{
423 423
 			$attr = (array) $data->attributes;
424
-			$key = str_replace( '/', '.', $item->getResourceType() );
424
+			$key = str_replace('/', '.', $item->getResourceType());
425 425
 
426
-			if( isset( $attr[$key.'.type'] ) )
426
+			if (isset($attr[$key . '.type']))
427 427
 			{
428
-				$typeItem = $manager->getSubManager( 'type' )->findItem( $attr[$key.'.type'], [], $domain );
429
-				$attr[$key.'.typeid'] = $typeItem->getId();
428
+				$typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], [], $domain);
429
+				$attr[$key . '.typeid'] = $typeItem->getId();
430 430
 			}
431 431
 
432
-			$item->fromArray( $attr );
432
+			$item->fromArray($attr);
433 433
 		}
434 434
 
435 435
 		return $item;
Please login to merge, or discard this patch.