Completed
Push — master ( f51047...ac2829 )
by Aimeos
02:03
created
admin/jsonadm/src/Admin/JsonAdm/Locale/Site/Standard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  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
 		/** admin/jsonadm/partials/locale/site/template-data
116 116
 		 * Relative path to the data partial template file for the locale site  client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.07
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/locale/site/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/locale/site/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
142 142
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
143 143
 	 */
144
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
144
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
145 145
 	{
146
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/site' );
147
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
146
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/site');
147
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
148 148
 		$total = 1;
149 149
 
150
-		if( ( $id = $view->param( 'id' ) ) == null ) {
151
-			$view->data = $manager->searchItems( $search, [], $total );
150
+		if (($id = $view->param('id')) == null) {
151
+			$view->data = $manager->searchItems($search, [], $total);
152 152
 		} else {
153
-			$view->data = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $search );
153
+			$view->data = $manager->getTree($id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $search);
154 154
 		}
155 155
 
156 156
 		$view->childItems = [];
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
170 170
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
171 171
 	 */
172
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
172
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
173 173
 	{
174
-		if( isset( $entry->id ) )
174
+		if (isset($entry->id))
175 175
 		{
176
-			$item = $manager->getItem( $entry->id );
177
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
178
-			$item = $manager->saveItem( $item );
176
+			$item = $manager->getItem($entry->id);
177
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
178
+			$item = $manager->saveItem($item);
179 179
 		}
180 180
 		else
181 181
 		{
182 182
 			$item = $manager->createItem();
183
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
184
-			$manager->insertItem( $item );
183
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
184
+			$manager->insertItem($item);
185 185
 		}
186 186
 
187
-		if( isset( $entry->relationships ) ) {
188
-			$this->saveRelationships( $manager, $item, $entry->relationships );
187
+		if (isset($entry->relationships)) {
188
+			$this->saveRelationships($manager, $item, $entry->relationships);
189 189
 		}
190 190
 
191
-		return $manager->getItem( $item->getId() );
191
+		return $manager->getItem($item->getId());
192 192
 	}
193 193
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Locale/Site/StandardTest.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -22,32 +22,32 @@  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\Locale\Site\Standard( $this->context, $this->view, $templatePaths, 'locale/site' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard($this->context, $this->view, $templatePaths, 'locale/site');
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testGet()
30 30
 	{
31 31
 		$params = array(
32
-			'id' => $this->getSiteItem( 'unittest' )->getId(),
32
+			'id' => $this->getSiteItem('unittest')->getId(),
33 33
 			'filter' => array(
34
-				'==' => array( 'locale.status' => 0 )
34
+				'==' => array('locale.status' => 0)
35 35
 			),
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals('locale/site', $result['data']['type']);
49 49
 
50
-		$this->assertArrayNotHasKey( 'errors', $result );
50
+		$this->assertArrayNotHasKey('errors', $result);
51 51
 	}
52 52
 
53 53
 
@@ -55,124 +55,124 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$params = array(
57 57
 			'filter' => array(
58
-				'==' => array( 'locale.site.code' => 'unittest' )
58
+				'==' => array('locale.site.code' => 'unittest')
59 59
 			),
60 60
 		);
61
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
62
-		$this->view->addHelper( 'param', $helper );
61
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
62
+		$this->view->addHelper('param', $helper);
63 63
 
64
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
65
-		$result = json_decode( (string) $response->getBody(), true );
64
+		$response = $this->object->get($this->view->request(), $this->view->response());
65
+		$result = json_decode((string) $response->getBody(), true);
66 66
 
67 67
 
68
-		$this->assertEquals( 200, $response->getStatusCode() );
69
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
68
+		$this->assertEquals(200, $response->getStatusCode());
69
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
70 70
 
71
-		$this->assertEquals( 1, $result['meta']['total'] );
72
-		$this->assertEquals( 1, count( $result['data'] ) );
73
-		$this->assertEquals( 'locale/site', $result['data'][0]['type'] );
71
+		$this->assertEquals(1, $result['meta']['total']);
72
+		$this->assertEquals(1, count($result['data']));
73
+		$this->assertEquals('locale/site', $result['data'][0]['type']);
74 74
 
75
-		$this->assertArrayNotHasKey( 'errors', $result );
75
+		$this->assertArrayNotHasKey('errors', $result);
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testPatch()
80 80
 	{
81
-		$stub = $this->getSiteMock( array( 'getItem', 'moveItem', 'saveItem' ) );
81
+		$stub = $this->getSiteMock(array('getItem', 'moveItem', 'saveItem'));
82 82
 		$item = $stub->createItem();
83 83
 
84
-		$stub->expects( $this->once() )->method( 'saveItem' )
85
-			->will( $this->returnValue( $stub->createItem() ) );
86
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
87
-			->will( $this->returnValue( $item ) );
84
+		$stub->expects($this->once())->method('saveItem')
85
+			->will($this->returnValue($stub->createItem()));
86
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
87
+			->will($this->returnValue($item));
88 88
 
89 89
 
90
-		$params = array( 'id' => '-1' );
91
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
92
-		$this->view->addHelper( 'param', $helper );
90
+		$params = array('id' => '-1');
91
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
92
+		$this->view->addHelper('param', $helper);
93 93
 
94 94
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "locale/site", "attributes": {"locale.site.label": "test"}}}';
95
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
95
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
96 96
 
97
-		$response = $this->object->patch( $request, $this->view->response() );
98
-		$result = json_decode( (string) $response->getBody(), true );
97
+		$response = $this->object->patch($request, $this->view->response());
98
+		$result = json_decode((string) $response->getBody(), true);
99 99
 
100 100
 
101
-		$this->assertEquals( 200, $response->getStatusCode() );
102
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
101
+		$this->assertEquals(200, $response->getStatusCode());
102
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
103 103
 
104
-		$this->assertEquals( 1, $result['meta']['total'] );
105
-		$this->assertArrayHasKey( 'data', $result );
106
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
104
+		$this->assertEquals(1, $result['meta']['total']);
105
+		$this->assertArrayHasKey('data', $result);
106
+		$this->assertEquals('locale/site', $result['data']['type']);
107 107
 
108
-		$this->assertArrayNotHasKey( 'included', $result );
109
-		$this->assertArrayNotHasKey( 'errors', $result );
108
+		$this->assertArrayNotHasKey('included', $result);
109
+		$this->assertArrayNotHasKey('errors', $result);
110 110
 	}
111 111
 
112 112
 
113 113
 	public function testPost()
114 114
 	{
115
-		$stub = $this->getSiteMock( array( 'getItem', 'insertItem' ) );
115
+		$stub = $this->getSiteMock(array('getItem', 'insertItem'));
116 116
 		$item = $stub->createItem();
117 117
 
118
-		$stub->expects( $this->any() )->method( 'getItem' )
119
-			->will( $this->returnValue( $item ) );
120
-		$stub->expects( $this->once() )->method( 'insertItem' );
118
+		$stub->expects($this->any())->method('getItem')
119
+			->will($this->returnValue($item));
120
+		$stub->expects($this->once())->method('insertItem');
121 121
 
122 122
 
123 123
 		$body = '{"data": {"type": "locale/site", "attributes": {"locale.site.code": "unittest", "locale.site.label": "Unit test"}}}';
124
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
124
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
125 125
 
126
-		$response = $this->object->post( $request, $this->view->response() );
127
-		$result = json_decode( (string) $response->getBody(), true );
126
+		$response = $this->object->post($request, $this->view->response());
127
+		$result = json_decode((string) $response->getBody(), true);
128 128
 
129 129
 
130
-		$this->assertEquals( 201, $response->getStatusCode() );
131
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
130
+		$this->assertEquals(201, $response->getStatusCode());
131
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
132 132
 
133
-		$this->assertEquals( 1, $result['meta']['total'] );
134
-		$this->assertArrayHasKey( 'data', $result );
135
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
133
+		$this->assertEquals(1, $result['meta']['total']);
134
+		$this->assertArrayHasKey('data', $result);
135
+		$this->assertEquals('locale/site', $result['data']['type']);
136 136
 
137
-		$this->assertArrayNotHasKey( 'included', $result );
138
-		$this->assertArrayNotHasKey( 'errors', $result );
137
+		$this->assertArrayNotHasKey('included', $result);
138
+		$this->assertArrayNotHasKey('errors', $result);
139 139
 	}
140 140
 
141 141
 
142
-	protected function getSiteItem( $code )
142
+	protected function getSiteItem($code)
143 143
 	{
144
-		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $this->context )->getSubManager( 'site' );
144
+		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->context)->getSubManager('site');
145 145
 		$search = $manager->createSearch();
146
-		$search->setConditions( $search->compare( '==', 'locale.site.code', $code ) );
147
-		$items = $manager->searchItems( $search );
146
+		$search->setConditions($search->compare('==', 'locale.site.code', $code));
147
+		$items = $manager->searchItems($search);
148 148
 
149
-		if( ( $item = reset( $items ) ) === false ) {
150
-			throw new \RuntimeException( sprintf( 'No locale site item with code "%1$s" found', $code ) );
149
+		if (($item = reset($items)) === false) {
150
+			throw new \RuntimeException(sprintf('No locale site item with code "%1$s" found', $code));
151 151
 		}
152 152
 
153 153
 		return $item;
154 154
 	}
155 155
 
156 156
 
157
-	protected function getSiteMock( array $methods )
157
+	protected function getSiteMock(array $methods)
158 158
 	{
159 159
 		$name = 'AdminJsonAdmStandard';
160
-		$this->context->getConfig()->set( 'mshop/locale/manager/name', $name );
160
+		$this->context->getConfig()->set('mshop/locale/manager/name', $name);
161 161
 
162
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Standard' )
163
-			->setConstructorArgs( array( $this->context ) )
164
-			->setMethods( array( 'getSubManager' ) )
162
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Standard')
163
+			->setConstructorArgs(array($this->context))
164
+			->setMethods(array('getSubManager'))
165 165
 			->getMock();
166 166
 
167
-		$siteStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard' )
168
-			->setConstructorArgs( array( $this->context ) )
169
-			->setMethods( $methods )
167
+		$siteStub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard')
168
+			->setConstructorArgs(array($this->context))
169
+			->setMethods($methods)
170 170
 			->getMock();
171 171
 
172
-		$stub->expects( $this->once() )->method( 'getSubManager' )
173
-			->will( $this->returnValue( $siteStub ) );
172
+		$stub->expects($this->once())->method('getSubManager')
173
+			->will($this->returnValue($siteStub));
174 174
 
175
-		\Aimeos\MShop\Locale\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub );
175
+		\Aimeos\MShop\Locale\Manager\Factory::injectManager('\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub);
176 176
 
177 177
 		return $siteStub;
178 178
 	}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  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
 		/** admin/jsonadm/partials/catalog/template-data
116 116
 		 * Relative path to the data partial template file for the catalog client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.07
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/catalog/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/catalog/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	 * @param array $include List of resource types that should be fetched
141 141
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
142 142
 	 */
143
-	protected function getChildItems( array $items, array $include )
143
+	protected function getChildItems(array $items, array $include)
144 144
 	{
145 145
 		$list = [];
146 146
 
147
-		if( in_array( 'catalog', $include ) )
147
+		if (in_array('catalog', $include))
148 148
 		{
149
-			foreach( $items as $item ) {
150
-				$list = array_merge( $list, [$item], $this->getChildItems( $item->getChildren(), $include ) );
149
+			foreach ($items as $item) {
150
+				$list = array_merge($list, [$item], $this->getChildItems($item->getChildren(), $include));
151 151
 			}
152 152
 		}
153 153
 
@@ -162,40 +162,40 @@  discard block
 block discarded – undo
162 162
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
163 163
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
164 164
 	 */
165
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
165
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
166 166
 	{
167
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' );
167
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
168 168
 
169
-		if( ( $key = $view->param( 'aggregate' ) ) !== null )
169
+		if (($key = $view->param('aggregate')) !== null)
170 170
 		{
171
-			$search = $this->initCriteria( $manager->createSearch(), $view->param() );
172
-			$view->data = $manager->aggregate( $search, $key );
171
+			$search = $this->initCriteria($manager->createSearch(), $view->param());
172
+			$view->data = $manager->aggregate($search, $key);
173 173
 			return $response;
174 174
 		}
175 175
 
176
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : [] );
177
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
176
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : []);
177
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
178 178
 		$total = 1;
179 179
 
180
-		if( ( $id = $view->param( 'id' ) ) == null )
180
+		if (($id = $view->param('id')) == null)
181 181
 		{
182
-			$view->data = $manager->searchItems( $search, [], $total );
183
-			$view->listItems = $this->getListItems( $view->data, $include );
182
+			$view->data = $manager->searchItems($search, [], $total);
183
+			$view->listItems = $this->getListItems($view->data, $include);
184 184
 			$view->childItems = [];
185 185
 		}
186 186
 		else
187 187
 		{
188 188
 			$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE;
189
-			if( in_array( 'catalog', $include ) ) {
189
+			if (in_array('catalog', $include)) {
190 190
 				$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST;
191 191
 			}
192 192
 
193
-			$view->data = $manager->getTree( $id, $include, $level, $search );
194
-			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
195
-			$view->childItems = $this->getChildItems( $view->data->getChildren(), $include );
193
+			$view->data = $manager->getTree($id, $include, $level, $search);
194
+			$view->listItems = $this->getListItems(array($id => $view->data), $include);
195
+			$view->childItems = $this->getChildItems($view->data->getChildren(), $include);
196 196
 		}
197 197
 
198
-		$view->refItems = $this->getRefItems( $view->listItems );
198
+		$view->refItems = $this->getRefItems($view->listItems);
199 199
 		$view->total = $total;
200 200
 
201 201
 		return $response;
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 	 * @param array $include List of resource types that should be fetched
210 210
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
211 211
 	 */
212
-	protected function getListItems( array $items, array $include )
212
+	protected function getListItems(array $items, array $include)
213 213
 	{
214
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
214
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
215 215
 
216 216
 		$search = $manager->createSearch();
217 217
 		$expr = array(
218
-			$search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ),
219
-			$search->compare( '==', 'catalog.lists.domain', $include ),
218
+			$search->compare('==', 'catalog.lists.parentid', array_keys($items)),
219
+			$search->compare('==', 'catalog.lists.domain', $include),
220 220
 		);
221
-		$search->setConditions( $search->combine( '&&', $expr ) );
221
+		$search->setConditions($search->combine('&&', $expr));
222 222
 
223
-		return $manager->searchItems( $search );
223
+		return $manager->searchItems($search);
224 224
 	}
225 225
 
226 226
 
@@ -231,32 +231,32 @@  discard block
 block discarded – undo
231 231
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
232 232
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
233 233
 	 */
234
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
234
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
235 235
 	{
236
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
237
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
236
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
237
+		$refId = (isset($entry->refid) ? $entry->refid : null);
238 238
 
239
-		if( isset( $entry->id ) )
239
+		if (isset($entry->id))
240 240
 		{
241
-			$item = $manager->getItem( $entry->id );
242
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
243
-			$item = $manager->saveItem( $item );
241
+			$item = $manager->getItem($entry->id);
242
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
243
+			$item = $manager->saveItem($item);
244 244
 
245
-			if( isset( $entry->parentid ) && $targetId !== null ) {
246
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
245
+			if (isset($entry->parentid) && $targetId !== null) {
246
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
247 247
 			}
248 248
 		}
249 249
 		else
250 250
 		{
251 251
 			$item = $manager->createItem();
252
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
253
-			$manager->insertItem( $item, $targetId, $refId );
252
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
253
+			$manager->insertItem($item, $targetId, $refId);
254 254
 		}
255 255
 
256
-		if( isset( $entry->relationships ) ) {
257
-			$this->saveRelationships( $manager, $item, $entry->relationships );
256
+		if (isset($entry->relationships)) {
257
+			$this->saveRelationships($manager, $item, $entry->relationships);
258 258
 		}
259 259
 
260
-		return $manager->getItem( $item->getId() );
260
+		return $manager->getItem($item->getId());
261 261
 	}
262 262
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Catalog/StandardTest.php 1 patch
Spacing   +71 added lines, -71 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\Catalog\Standard( $this->context, $this->view, $templatePaths, 'catalog' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard($this->context, $this->view, $templatePaths, 'catalog');
26 26
 	}
27 27
 
28 28
 
@@ -30,142 +30,142 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'catalog.code' => 'cafe' )
33
+				'==' => array('catalog.code' => 'cafe')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'catalog', $result['data'][0]['type'] );
50
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 6, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('catalog', $result['data'][0]['type']);
50
+		$this->assertEquals(6, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(6, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetTree()
58 58
 	{
59 59
 		$params = array(
60
-			'id' => $this->getCatalogItem( 'root' )->getId(),
60
+			'id' => $this->getCatalogItem('root')->getId(),
61 61
 			'include' => 'catalog,text'
62 62
 		);
63
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
64
-		$this->view->addHelper( 'param', $helper );
63
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
64
+		$this->view->addHelper('param', $helper);
65 65
 
66
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
67
-		$result = json_decode( (string) $response->getBody(), true );
66
+		$response = $this->object->get($this->view->request(), $this->view->response());
67
+		$result = json_decode((string) $response->getBody(), true);
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( 1, $result['meta']['total'] );
73
-		$this->assertEquals( 'catalog', $result['data']['type'] );
74
-		$this->assertEquals( 2, count( $result['data']['relationships']['catalog'] ) );
75
-		$this->assertEquals( 2, count( $result['included'] ) );
72
+		$this->assertEquals(1, $result['meta']['total']);
73
+		$this->assertEquals('catalog', $result['data']['type']);
74
+		$this->assertEquals(2, count($result['data']['relationships']['catalog']));
75
+		$this->assertEquals(2, count($result['included']));
76 76
 
77
-		$this->assertArrayNotHasKey( 'errors', $result );
77
+		$this->assertArrayNotHasKey('errors', $result);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testPatch()
82 82
 	{
83
-		$stub = $this->getCatalogMock( array( 'getItem', 'moveItem', 'saveItem' ) );
83
+		$stub = $this->getCatalogMock(array('getItem', 'moveItem', 'saveItem'));
84 84
 
85
-		$stub->expects( $this->once() )->method( 'moveItem' );
86
-		$stub->expects( $this->once() )->method( 'saveItem' )
87
-			->will( $this->returnValue( $stub->createItem() ) );
88
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
89
-			->will( $this->returnValue( $stub->createItem() ) );
85
+		$stub->expects($this->once())->method('moveItem');
86
+		$stub->expects($this->once())->method('saveItem')
87
+			->will($this->returnValue($stub->createItem()));
88
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
89
+			->will($this->returnValue($stub->createItem()));
90 90
 
91 91
 
92
-		$params = array( 'id' => '-1' );
93
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
94
-		$this->view->addHelper( 'param', $helper );
92
+		$params = array('id' => '-1');
93
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
94
+		$this->view->addHelper('param', $helper);
95 95
 
96 96
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "catalog", "attributes": {"catalog.label": "test"}}}';
97
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
97
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
98 98
 
99
-		$response = $this->object->patch( $request, $this->view->response() );
100
-		$result = json_decode( (string) $response->getBody(), true );
99
+		$response = $this->object->patch($request, $this->view->response());
100
+		$result = json_decode((string) $response->getBody(), true);
101 101
 
102 102
 
103
-		$this->assertEquals( 200, $response->getStatusCode() );
104
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
103
+		$this->assertEquals(200, $response->getStatusCode());
104
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
105 105
 
106
-		$this->assertEquals( 1, $result['meta']['total'] );
107
-		$this->assertArrayHasKey( 'data', $result );
108
-		$this->assertEquals( 'catalog', $result['data']['type'] );
106
+		$this->assertEquals(1, $result['meta']['total']);
107
+		$this->assertArrayHasKey('data', $result);
108
+		$this->assertEquals('catalog', $result['data']['type']);
109 109
 
110
-		$this->assertArrayNotHasKey( 'included', $result );
111
-		$this->assertArrayNotHasKey( 'errors', $result );
110
+		$this->assertArrayNotHasKey('included', $result);
111
+		$this->assertArrayNotHasKey('errors', $result);
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testPost()
116 116
 	{
117
-		$stub = $this->getCatalogMock( array( 'getItem', 'insertItem' ) );
117
+		$stub = $this->getCatalogMock(array('getItem', 'insertItem'));
118 118
 
119
-		$stub->expects( $this->any() )->method( 'getItem' )
120
-			->will( $this->returnValue( $stub->createItem() ) );
121
-		$stub->expects( $this->once() )->method( 'insertItem' );
119
+		$stub->expects($this->any())->method('getItem')
120
+			->will($this->returnValue($stub->createItem()));
121
+		$stub->expects($this->once())->method('insertItem');
122 122
 
123 123
 
124 124
 		$body = '{"data": {"type": "catalog", "attributes": {"catalog.code": "test", "catalog.label": "Test catalog"}}}';
125
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
125
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
126 126
 
127
-		$response = $this->object->post( $request, $this->view->response() );
128
-		$result = json_decode( (string) $response->getBody(), true );
127
+		$response = $this->object->post($request, $this->view->response());
128
+		$result = json_decode((string) $response->getBody(), true);
129 129
 
130 130
 
131
-		$this->assertEquals( 201, $response->getStatusCode() );
132
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
131
+		$this->assertEquals(201, $response->getStatusCode());
132
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
133 133
 
134
-		$this->assertEquals( 1, $result['meta']['total'] );
135
-		$this->assertArrayHasKey( 'data', $result );
136
-		$this->assertEquals( 'catalog', $result['data']['type'] );
134
+		$this->assertEquals(1, $result['meta']['total']);
135
+		$this->assertArrayHasKey('data', $result);
136
+		$this->assertEquals('catalog', $result['data']['type']);
137 137
 
138
-		$this->assertArrayNotHasKey( 'included', $result );
139
-		$this->assertArrayNotHasKey( 'errors', $result );
138
+		$this->assertArrayNotHasKey('included', $result);
139
+		$this->assertArrayNotHasKey('errors', $result);
140 140
 	}
141 141
 
142 142
 
143
-	protected function getCatalogItem( $code )
143
+	protected function getCatalogItem($code)
144 144
 	{
145
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context );
145
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
146 146
 		$search = $manager->createSearch();
147
-		$search->setConditions( $search->compare( '==', 'catalog.code', $code ) );
148
-		$items = $manager->searchItems( $search );
147
+		$search->setConditions($search->compare('==', 'catalog.code', $code));
148
+		$items = $manager->searchItems($search);
149 149
 
150
-		if( ( $item = reset( $items ) ) === false ) {
151
-			throw new \RuntimeException( sprintf( 'No catalog item with code "%1$s" found', $code ) );
150
+		if (($item = reset($items)) === false) {
151
+			throw new \RuntimeException(sprintf('No catalog item with code "%1$s" found', $code));
152 152
 		}
153 153
 
154 154
 		return $item;
155 155
 	}
156 156
 
157 157
 
158
-	protected function getCatalogMock( array $methods )
158
+	protected function getCatalogMock(array $methods)
159 159
 	{
160 160
 		$name = 'ClientJsonAdmStandard';
161
-		$this->context->getConfig()->set( 'mshop/catalog/manager/name', $name );
161
+		$this->context->getConfig()->set('mshop/catalog/manager/name', $name);
162 162
 
163
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Catalog\\Manager\\Standard' )
164
-			->setConstructorArgs( array( $this->context ) )
165
-			->setMethods( $methods )
163
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Catalog\\Manager\\Standard')
164
+			->setConstructorArgs(array($this->context))
165
+			->setMethods($methods)
166 166
 			->getMock();
167 167
 
168
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub );
168
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub);
169 169
 
170 170
 		return $stub;
171 171
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/TestHelperJadm.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop\Factory::setCache( false );
19
-		\Aimeos\Admin\JsonAdm\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(false);
19
+		\Aimeos\Admin\JsonAdm\Factory::setCache(false);
20 20
 	}
21 21
 
22 22
 
23
-	public static function getContext( $site = 'unittest' )
23
+	public static function getContext($site = 'unittest')
24 24
 	{
25
-		if( !isset( self::$context[$site] ) ) {
26
-			self::$context[$site] = self::createContext( $site );
25
+		if (!isset(self::$context[$site])) {
26
+			self::$context[$site] = self::createContext($site);
27 27
 		}
28 28
 
29 29
 		return clone self::$context[$site];
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public static function getAimeos()
34 34
 	{
35
-		if( !isset( self::$aimeos ) )
35
+		if (!isset(self::$aimeos))
36 36
 		{
37 37
 			require_once 'Bootstrap.php';
38
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
38
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
39 39
 
40
-			$extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
41
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
40
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
41
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
42 42
 		}
43 43
 
44 44
 		return self::$aimeos;
@@ -47,88 +47,88 @@  discard block
 block discarded – undo
47 47
 
48 48
 	public static function getJsonadmPaths()
49 49
 	{
50
-		return self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
50
+		return self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
51 51
 	}
52 52
 
53 53
 
54
-	private static function createContext( $site )
54
+	private static function createContext($site)
55 55
 	{
56 56
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
57 57
 		$aimeos = self::getAimeos();
58 58
 
59 59
 
60
-		$paths = $aimeos->getConfigPaths( 'mysql' );
60
+		$paths = $aimeos->getConfigPaths('mysql');
61 61
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
62 62
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
63 63
 
64
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
65
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
66
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
67
-		$ctx->setConfig( $conf );
64
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
65
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
66
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
67
+		$ctx->setConfig($conf);
68 68
 
69 69
 
70
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
71
-		$ctx->setDatabaseManager( $dbm );
70
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
71
+		$ctx->setDatabaseManager($dbm);
72 72
 
73 73
 
74
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
75
-		$ctx->setLogger( $logger );
74
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
75
+		$ctx->setLogger($logger);
76 76
 
77 77
 
78 78
 		$session = new \Aimeos\MW\Session\None();
79
-		$ctx->setSession( $session );
79
+		$ctx->setSession($session);
80 80
 
81 81
 
82
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
83
-		$ctx->setI18n( array( 'de' => $i18n ) );
82
+		$i18n = new \Aimeos\MW\Translation\None('de');
83
+		$ctx->setI18n(array('de' => $i18n));
84 84
 
85 85
 
86
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
87
-		$locale = $localeManager->bootstrap( $site, 'de', '', false );
88
-		$ctx->setLocale( $locale );
86
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
87
+		$locale = $localeManager->bootstrap($site, 'de', '', false);
88
+		$ctx->setLocale($locale);
89 89
 
90 90
 
91
-		$view = self::createView( $conf );
92
-		$ctx->setView( $view );
91
+		$view = self::createView($conf);
92
+		$ctx->setView($view);
93 93
 
94 94
 
95
-		$ctx->setEditor( 'core:admin/jsonadm' );
95
+		$ctx->setEditor('core:admin/jsonadm');
96 96
 
97 97
 		return $ctx;
98 98
 	}
99 99
 
100 100
 
101
-	protected static function createView( \Aimeos\MW\Config\Iface $config )
101
+	protected static function createView(\Aimeos\MW\Config\Iface $config)
102 102
 	{
103
-		$tmplpaths = self::getAimeos()->getCustomPaths( 'admin/jsonadm/templates' );
103
+		$tmplpaths = self::getAimeos()->getCustomPaths('admin/jsonadm/templates');
104 104
 
105
-		$view = new \Aimeos\MW\View\Standard( $tmplpaths );
105
+		$view = new \Aimeos\MW\View\Standard($tmplpaths);
106 106
 
107
-		$helper = new \Aimeos\MW\View\Helper\Access\All( $view );
108
-		$view->addHelper( 'access', $helper );
107
+		$helper = new \Aimeos\MW\View\Helper\Access\All($view);
108
+		$view->addHelper('access', $helper);
109 109
 
110
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
111
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
112
-		$view->addHelper( 'translate', $helper );
110
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
111
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
112
+		$view->addHelper('translate', $helper);
113 113
 
114
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
115
-		$view->addHelper( 'url', $helper );
114
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
115
+		$view->addHelper('url', $helper);
116 116
 
117
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
118
-		$view->addHelper( 'number', $helper );
117
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
118
+		$view->addHelper('number', $helper);
119 119
 
120
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
121
-		$view->addHelper( 'date', $helper );
120
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
121
+		$view->addHelper('date', $helper);
122 122
 
123
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin/jsonadm' ) );
124
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
125
-		$view->addHelper( 'config', $helper );
123
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin/jsonadm'));
124
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
125
+		$view->addHelper('config', $helper);
126 126
 
127
-		$helper = new \Aimeos\MW\View\Helper\Request\Standard( $view, new \Zend\Diactoros\ServerRequest() );
128
-		$view->addHelper( 'request', $helper );
127
+		$helper = new \Aimeos\MW\View\Helper\Request\Standard($view, new \Zend\Diactoros\ServerRequest());
128
+		$view->addHelper('request', $helper);
129 129
 
130
-		$helper = new \Aimeos\MW\View\Helper\Response\Standard( $view, new \Zend\Diactoros\Response() );
131
-		$view->addHelper( 'response', $helper );
130
+		$helper = new \Aimeos\MW\View\Helper\Response\Standard($view, new \Zend\Diactoros\Response());
131
+		$view->addHelper('response', $helper);
132 132
 
133 133
 		return $view;
134 134
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/Config/StandardTest.php 1 patch
Spacing   +12 added lines, -12 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,20 +32,20 @@  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( 2, $result['meta']['total'] );
45
-		$this->assertInternalType( 'array', $result['data'] );
46
-		$this->assertEquals( 'category.include', $result['data'][0]['id'] );
47
-		$this->assertEquals( 'category.exclude', $result['data'][1]['id'] );
44
+		$this->assertEquals(2, $result['meta']['total']);
45
+		$this->assertInternalType('array', $result['data']);
46
+		$this->assertEquals('category.include', $result['data'][0]['id']);
47
+		$this->assertEquals('category.exclude', $result['data'][1]['id']);
48 48
 
49
-		$this->assertArrayNotHasKey( 'errors', $result );
49
+		$this->assertArrayNotHasKey('errors', $result);
50 50
 	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Service/Config/Standard.php 1 patch
Spacing   +19 added lines, -19 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,16 +174,16 @@  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' );
184
-		$item = $manager->createItem()->setProvider( $id );
183
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
184
+		$item = $manager->createItem()->setProvider($id);
185 185
 
186
-		$view->configItems = $manager->getProvider( $item, $view->param( 'type', 'payment' ) )->getConfigBE();
186
+		$view->configItems = $manager->getProvider($item, $view->param('type', 'payment'))->getConfigBE();
187 187
 
188 188
 		return $response;
189 189
 	}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Plugin/Config/Standard.php 1 patch
Spacing   +19 added lines, -19 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,16 +174,16 @@  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' );
184
-		$item = $manager->createItem()->setProvider( $id );
183
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'plugin');
184
+		$item = $manager->createItem()->setProvider($id);
185 185
 
186
-		$view->configItems = $manager->getProvider( $item, 'order' )->getConfigBE();
186
+		$view->configItems = $manager->getProvider($item, 'order')->getConfigBE();
187 187
 
188 188
 		return $response;
189 189
 	}
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,213 +607,213 @@  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 733
 		$this->view->prefix = 'prefix';
734
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
735
-		$result = json_decode( (string) $response->getBody(), true );
734
+		$response = $this->object->options($this->view->request(), $this->view->response());
735
+		$result = json_decode((string) $response->getBody(), true);
736 736
 
737 737
 
738
-		$this->assertEquals( 200, $response->getStatusCode() );
739
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
740
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
738
+		$this->assertEquals(200, $response->getStatusCode());
739
+		$this->assertEquals(1, count($response->getHeader('Allow')));
740
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
741 741
 
742
-		$this->assertEquals( 'prefix', $result['meta']['prefix'] );
743
-		$this->assertGreaterThan( 59, count( $result['meta']['resources'] ) );
744
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
742
+		$this->assertEquals('prefix', $result['meta']['prefix']);
743
+		$this->assertGreaterThan(59, count($result['meta']['resources']));
744
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
745 745
 
746
-		$this->assertArrayNotHasKey( 'errors', $result );
746
+		$this->assertArrayNotHasKey('errors', $result);
747 747
 	}
748 748
 
749 749
 
750 750
 	public function testOptionsException()
751 751
 	{
752
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
753
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
752
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
753
+			->will($this->throwException(new \RuntimeException('test exception')));
754 754
 
755
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
756
-		$result = json_decode( (string) $response->getBody(), true );
755
+		$response = $this->object->options($this->view->request(), $this->view->response());
756
+		$result = json_decode((string) $response->getBody(), true);
757 757
 
758
-		$this->assertEquals( 500, $response->getStatusCode() );
759
-		$this->assertArrayHasKey( 'errors', $result );
758
+		$this->assertEquals(500, $response->getStatusCode());
759
+		$this->assertArrayHasKey('errors', $result);
760 760
 	}
761 761
 
762 762
 
763 763
 	public function testOptionsMShopException()
764 764
 	{
765
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
766
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
765
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
766
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
767 767
 
768
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
769
-		$result = json_decode( (string) $response->getBody(), true );
768
+		$response = $this->object->options($this->view->request(), $this->view->response());
769
+		$result = json_decode((string) $response->getBody(), true);
770 770
 
771
-		$this->assertEquals( 404, $response->getStatusCode() );
772
-		$this->assertArrayHasKey( 'errors', $result );
771
+		$this->assertEquals(404, $response->getStatusCode());
772
+		$this->assertArrayHasKey('errors', $result);
773 773
 	}
774 774
 
775 775
 
776
-	protected function getProductMock( array $methods )
776
+	protected function getProductMock(array $methods)
777 777
 	{
778 778
 		$name = 'ClientJsonAdmStandard';
779
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
779
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
780 780
 
781
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
782
-			->setConstructorArgs( array( $this->context ) )
783
-			->setMethods( $methods )
781
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
782
+			->setConstructorArgs(array($this->context))
783
+			->setMethods($methods)
784 784
 			->getMock();
785 785
 
786
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
786
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
787 787
 
788 788
 		return $stub;
789 789
 	}
790 790
 
791 791
 
792
-	protected function getProductListsMock( array $methods )
792
+	protected function getProductListsMock(array $methods)
793 793
 	{
794 794
 		$name = 'ClientJsonAdmStandard';
795
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
795
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
796 796
 
797
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
798
-			->setConstructorArgs( array( $this->context ) )
799
-			->setMethods( $methods )
797
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
798
+			->setConstructorArgs(array($this->context))
799
+			->setMethods($methods)
800 800
 			->getMock();
801 801
 
802
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
802
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
803 803
 
804 804
 		return $stub;
805 805
 	}
806 806
 
807 807
 
808
-	protected function getProductItem( $code = 'CNC' )
808
+	protected function getProductItem($code = 'CNC')
809 809
 	{
810
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
810
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
811 811
 		$search = $manager->createSearch();
812
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
813
-		$items = $manager->searchItems( $search );
812
+		$search->setConditions($search->compare('==', 'product.code', $code));
813
+		$items = $manager->searchItems($search);
814 814
 
815
-		if( ( $item = reset( $items ) ) === false ) {
816
-			throw new \RuntimeException( sprintf( 'No product item with code "%1$s" found', $code ) );
815
+		if (($item = reset($items)) === false) {
816
+			throw new \RuntimeException(sprintf('No product item with code "%1$s" found', $code));
817 817
 		}
818 818
 
819 819
 		return $item;
Please login to merge, or discard this patch.