Completed
Push — master ( b74ec1...901166 )
by Aimeos
02:08
created
admin/jsonadm/src/Admin/JsonAdm/Catalog/Standard.php 2 patches
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->getChildren() );
149
+			foreach ($items as $item) {
150
+				$list = array_merge($list, $item->getChildren());
151 151
 			}
152 152
 		}
153 153
 
@@ -162,35 +162,35 @@  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 );
184
-			$view->childItems = $this->getChildItems( $view->data, $include );
182
+			$view->data = $manager->searchItems($search, [], $total);
183
+			$view->listItems = $this->getListItems($view->data, $include);
184
+			$view->childItems = $this->getChildItems($view->data, $include);
185 185
 		}
186 186
 		else
187 187
 		{
188
-			$view->data = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
189
-			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
190
-			$view->childItems = $this->getChildItems( array( $view->data ), $include );
188
+			$view->data = $manager->getTree($id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
189
+			$view->listItems = $this->getListItems(array($id => $view->data), $include);
190
+			$view->childItems = $this->getChildItems(array($view->data), $include);
191 191
 		}
192 192
 
193
-		$view->refItems = $this->getRefItems( $view->listItems );
193
+		$view->refItems = $this->getRefItems($view->listItems);
194 194
 		$view->total = $total;
195 195
 
196 196
 		return $response;
@@ -204,18 +204,18 @@  discard block
 block discarded – undo
204 204
 	 * @param array $include List of resource types that should be fetched
205 205
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
206 206
 	 */
207
-	protected function getListItems( array $items, array $include )
207
+	protected function getListItems(array $items, array $include)
208 208
 	{
209
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
209
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists');
210 210
 
211 211
 		$search = $manager->createSearch();
212 212
 		$expr = array(
213
-			$search->compare( '==', 'catalog.lists.parentid', array_keys( $items ) ),
214
-			$search->compare( '==', 'catalog.lists.domain', $include ),
213
+			$search->compare('==', 'catalog.lists.parentid', array_keys($items)),
214
+			$search->compare('==', 'catalog.lists.domain', $include),
215 215
 		);
216
-		$search->setConditions( $search->combine( '&&', $expr ) );
216
+		$search->setConditions($search->combine('&&', $expr));
217 217
 
218
-		return $manager->searchItems( $search );
218
+		return $manager->searchItems($search);
219 219
 	}
220 220
 
221 221
 
@@ -226,32 +226,32 @@  discard block
 block discarded – undo
226 226
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
227 227
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
228 228
 	 */
229
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
229
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
230 230
 	{
231
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
232
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
231
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
232
+		$refId = (isset($entry->refid) ? $entry->refid : null);
233 233
 
234
-		if( isset( $entry->id ) )
234
+		if (isset($entry->id))
235 235
 		{
236
-			$item = $manager->getItem( $entry->id );
237
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
238
-			$manager->saveItem( $item );
236
+			$item = $manager->getItem($entry->id);
237
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
238
+			$manager->saveItem($item);
239 239
 
240
-			if( isset( $entry->parentid ) && $targetId !== null ) {
241
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
240
+			if (isset($entry->parentid) && $targetId !== null) {
241
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
242 242
 			}
243 243
 		}
244 244
 		else
245 245
 		{
246 246
 			$item = $manager->createItem();
247
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
248
-			$manager->insertItem( $item, $targetId, $refId );
247
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
248
+			$manager->insertItem($item, $targetId, $refId);
249 249
 		}
250 250
 
251
-		if( isset( $entry->relationships ) ) {
252
-			$this->saveRelationships( $manager, $item, $entry->relationships );
251
+		if (isset($entry->relationships)) {
252
+			$this->saveRelationships($manager, $item, $entry->relationships);
253 253
 		}
254 254
 
255
-		return $manager->getItem( $item->getId() );
255
+		return $manager->getItem($item->getId());
256 256
 	}
257 257
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -182,8 +182,7 @@  discard block
 block discarded – undo
182 182
 			$view->data = $manager->searchItems( $search, [], $total );
183 183
 			$view->listItems = $this->getListItems( $view->data, $include );
184 184
 			$view->childItems = $this->getChildItems( $view->data, $include );
185
-		}
186
-		else
185
+		} else
187 186
 		{
188 187
 			$view->data = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
189 188
 			$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
@@ -240,8 +239,7 @@  discard block
 block discarded – undo
240 239
 			if( isset( $entry->parentid ) && $targetId !== null ) {
241 240
 				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
242 241
 			}
243
-		}
244
-		else
242
+		} else
245 243
 		{
246 244
 			$item = $manager->createItem();
247 245
 			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Product/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 	 * @param array $include List of resource types that should be fetched
108 108
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = [];
113
-		$prodIds = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'product/property' ) );
113
+		$prodIds = array_keys($items);
114
+		$include = array_intersect($include, array('product/property'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $prodIds ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $prodIds));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @param array $include List of resource types that should be fetched
135 135
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
136 136
 	 */
137
-	protected function getListItems( array $items, array $include )
137
+	protected function getListItems(array $items, array $include)
138 138
 	{
139
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' );
139
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists');
140 140
 
141 141
 		$search = $manager->createSearch();
142 142
 		$expr = array(
143
-			$search->compare( '==', 'product.lists.parentid', array_keys( $items ) ),
144
-			$search->compare( '==', 'product.lists.domain', $include ),
143
+			$search->compare('==', 'product.lists.parentid', array_keys($items)),
144
+			$search->compare('==', 'product.lists.domain', $include),
145 145
 		);
146
-		$search->setConditions( $search->combine( '&&', $expr ) );
146
+		$search->setConditions($search->combine('&&', $expr));
147 147
 
148
-		return $manager->searchItems( $search );
148
+		return $manager->searchItems($search);
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Base.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param array $templatePaths List of file system paths where the templates are stored
34 34
 	 * @param string $path Name of the client separated by slashes, e.g "product/property"
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
36
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
37 37
 	{
38 38
 		$this->view = $view;
39 39
 		$this->context = $context;
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param array $param List of method parameter
50 50
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed
51 51
 	 */
52
-	public function __call( $name, array $param )
52
+	public function __call($name, array $param)
53 53
 	{
54
-		throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) );
54
+		throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Unable to call method "%1$s"', $name));
55 55
 	}
56 56
 
57 57
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param array $include List of resource types that should be fetched
63 63
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
64 64
 	 */
65
-	protected function getChildItems( array $items, array $include )
65
+	protected function getChildItems(array $items, array $include)
66 66
 	{
67 67
 		return [];
68 68
 	}
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
86 86
 	 * @return array List of domain names
87 87
 	 */
88
-	protected function getDomains( \Aimeos\MW\View\Iface $view )
88
+	protected function getDomains(\Aimeos\MW\View\Iface $view)
89 89
 	{
90
-		if( ( $domains = $view->param( 'resource' ) ) == '' )
90
+		if (($domains = $view->param('resource')) == '')
91 91
 		{
92 92
 			/** admin/jsonadm/domains
93 93
 			 * A list of domain names whose clients are available for the JSON API
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order',
110 110
 				'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text'
111 111
 			);
112
-			$domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default );
112
+			$domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
113 113
 		}
114 114
 
115 115
 		return (array) $domains;
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 * @param \stdClass $request Decoded request body
123 123
 	 * @return array List of item IDs
124 124
 	 */
125
-	protected function getIds( $request )
125
+	protected function getIds($request)
126 126
 	{
127 127
 		$ids = [];
128 128
 
129
-		if( isset( $request->data ) )
129
+		if (isset($request->data))
130 130
 		{
131
-			foreach( (array) $request->data as $entry )
131
+			foreach ((array) $request->data as $entry)
132 132
 			{
133
-				if( isset( $entry->id ) ) {
133
+				if (isset($entry->id)) {
134 134
 					$ids[] = $entry->id;
135 135
 				}
136 136
 			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @param array $include List of resource types that should be fetched
148 148
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
149 149
 	 */
150
-	protected function getListItems( array $items, array $include )
150
+	protected function getListItems(array $items, array $include)
151 151
 	{
152 152
 		return [];
153 153
 	}
@@ -170,23 +170,23 @@  discard block
 block discarded – undo
170 170
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
171 171
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
172 172
 	 */
173
-	protected function getRefItems( array $listItems )
173
+	protected function getRefItems(array $listItems)
174 174
 	{
175 175
 		$list = $map = [];
176 176
 		$context = $this->getContext();
177 177
 
178
-		foreach( $listItems as $listItem ) {
178
+		foreach ($listItems as $listItem) {
179 179
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
180 180
 		}
181 181
 
182
-		foreach( $map as $domain => $ids )
182
+		foreach ($map as $domain => $ids)
183 183
 		{
184
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
184
+			$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
185 185
 
186 186
 			$search = $manager->createSearch();
187
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
187
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
188 188
 
189
-			$list = array_merge( $list, $manager->searchItems( $search ) );
189
+			$list = array_merge($list, $manager->searchItems($search));
190 190
 		}
191 191
 
192 192
 		return $list;
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 * @param array $params List of criteria data with condition, sorting and paging
223 223
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
224 224
 	 */
225
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
225
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
226 226
 	{
227
-		$this->initCriteriaConditions( $criteria, $params );
228
-		$this->initCriteriaSortations( $criteria, $params );
229
-		$this->initCriteriaSlice( $criteria, $params );
227
+		$this->initCriteriaConditions($criteria, $params);
228
+		$this->initCriteriaSortations($criteria, $params);
229
+		$this->initCriteriaSlice($criteria, $params);
230 230
 
231 231
 		return $criteria;
232 232
 	}
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
239 239
 	 * @param array $params List of criteria data with condition, sorting and paging
240 240
 	 */
241
-	protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
241
+	protected function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
242 242
 	{
243
-		if( !isset( $params['filter'] ) ) {
243
+		if (!isset($params['filter'])) {
244 244
 			return;
245 245
 		}
246 246
 
247 247
 		$existing = $criteria->getConditions();
248
-		$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
248
+		$criteria->setConditions($criteria->toConditions((array) $params['filter']));
249 249
 
250
-		$expr = array( $criteria->getConditions(), $existing );
251
-		$criteria->setConditions( $criteria->combine( '&&', $expr ) );
250
+		$expr = array($criteria->getConditions(), $existing);
251
+		$criteria->setConditions($criteria->combine('&&', $expr));
252 252
 	}
253 253
 
254 254
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
259 259
 	 * @param array $params List of criteria data with condition, sorting and paging
260 260
 	 */
261
-	protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
261
+	protected function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
262 262
 	{
263
-		$start = ( isset( $params['page']['offset'] ) ? (int) $params['page']['offset'] : 0 );
264
-		$size = ( isset( $params['page']['limit'] ) ? (int) $params['page']['limit'] : 25 );
263
+		$start = (isset($params['page']['offset']) ? (int) $params['page']['offset'] : 0);
264
+		$size = (isset($params['page']['limit']) ? (int) $params['page']['limit'] : 25);
265 265
 
266
-		$criteria->setSlice( $start, $size );
266
+		$criteria->setSlice($start, $size);
267 267
 	}
268 268
 
269 269
 
@@ -273,24 +273,24 @@  discard block
 block discarded – undo
273 273
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
274 274
 	 * @param array $params List of criteria data with condition, sorting and paging
275 275
 	 */
276
-	protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
276
+	protected function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
277 277
 	{
278
-		if( !isset( $params['sort'] ) ) {
278
+		if (!isset($params['sort'])) {
279 279
 			return;
280 280
 		}
281 281
 
282 282
 		$sortation = [];
283 283
 
284
-		foreach( explode( ',', $params['sort'] ) as $sort )
284
+		foreach (explode(',', $params['sort']) as $sort)
285 285
 		{
286
-			if( $sort[0] === '-' ) {
287
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
286
+			if ($sort[0] === '-') {
287
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
288 288
 			} else {
289
-				$sortation[] = $criteria->sort( '+', $sort );
289
+				$sortation[] = $criteria->sort('+', $sort);
290 290
 			}
291 291
 		}
292 292
 
293
-		$criteria->setSortations( $sortation );
293
+		$criteria->setSortations($sortation);
294 294
 	}
295 295
 
296 296
 
@@ -301,14 +301,14 @@  discard block
 block discarded – undo
301 301
 	 * @param \stdClass $request Object with request body data
302 302
 	 * @return array List of items
303 303
 	 */
304
-	protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request )
304
+	protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request)
305 305
 	{
306 306
 		$data = [];
307 307
 
308
-		if( isset( $request->data ) )
308
+		if (isset($request->data))
309 309
 		{
310
-			foreach( (array) $request->data as $entry ) {
311
-				$data[] = $this->saveEntry( $manager, $entry );
310
+			foreach ((array) $request->data as $entry) {
311
+				$data[] = $this->saveEntry($manager, $entry);
312 312
 			}
313 313
 		}
314 314
 
@@ -323,22 +323,22 @@  discard block
 block discarded – undo
323 323
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
324 324
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
325 325
 	 */
326
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
326
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
327 327
 	{
328
-		if( isset( $entry->id ) ) {
329
-			$item = $manager->getItem( $entry->id );
328
+		if (isset($entry->id)) {
329
+			$item = $manager->getItem($entry->id);
330 330
 		} else {
331 331
 			$item = $manager->createItem();
332 332
 		}
333 333
 
334
-		$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
335
-		$manager->saveItem( $item );
334
+		$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
335
+		$manager->saveItem($item);
336 336
 
337
-		if( isset( $entry->relationships ) ) {
338
-			$this->saveRelationships( $manager, $item, $entry->relationships );
337
+		if (isset($entry->relationships)) {
338
+			$this->saveRelationships($manager, $item, $entry->relationships);
339 339
 		}
340 340
 
341
-		return $manager->getItem( $item->getId() );
341
+		return $manager->getItem($item->getId());
342 342
 	}
343 343
 
344 344
 
@@ -349,28 +349,28 @@  discard block
 block discarded – undo
349 349
 	 * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set
350 350
 	 * @param \stdClass $relationships Object including the <domain>/data/attributes structure
351 351
 	 */
352
-	protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager,
353
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships )
352
+	protected function saveRelationships(\Aimeos\MShop\Common\Manager\Iface $manager,
353
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships)
354 354
 	{
355 355
 		$id = $item->getId();
356
-		$listManager = $manager->getSubManager( 'lists' );
356
+		$listManager = $manager->getSubManager('lists');
357 357
 
358
-		foreach( (array) $relationships as $domain => $list )
358
+		foreach ((array) $relationships as $domain => $list)
359 359
 		{
360
-			if( isset( $list->data ) )
360
+			if (isset($list->data))
361 361
 			{
362
-				foreach( (array) $list->data as $data )
362
+				foreach ((array) $list->data as $data)
363 363
 				{
364
-					$listItem = $this->addItemData( $listManager, $listManager->createItem(), $data, $domain );
364
+					$listItem = $this->addItemData($listManager, $listManager->createItem(), $data, $domain);
365 365
 
366
-					if( isset( $data->id ) ) {
367
-						$listItem->setRefId( $data->id );
366
+					if (isset($data->id)) {
367
+						$listItem->setRefId($data->id);
368 368
 					}
369 369
 
370
-					$listItem->setParentId( $id );
371
-					$listItem->setDomain( $domain );
370
+					$listItem->setParentId($id);
371
+					$listItem->setDomain($domain);
372 372
 
373
-					$listManager->saveItem( $listItem, false );
373
+					$listManager->saveItem($listItem, false);
374 374
 				}
375 375
 			}
376 376
 		}
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
 	 * @return \Aimeos\MShop\Common\Item\Iface Item including the data
388 388
 	 */
389 389
 	protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager,
390
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain )
390
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain)
391 391
 	{
392
-		if( isset( $data->attributes ) )
392
+		if (isset($data->attributes))
393 393
 		{
394 394
 			$attr = (array) $data->attributes;
395
-			$key = str_replace( '/', '.', $item->getResourceType() );
395
+			$key = str_replace('/', '.', $item->getResourceType());
396 396
 
397
-			if( isset( $attr[$key.'.type'] ) )
397
+			if (isset($attr[$key . '.type']))
398 398
 			{
399
-				$typeItem = $manager->getSubManager( 'type' )->findItem( $attr[$key.'.type'], [], $domain );
400
-				$attr[$key.'.typeid'] = $typeItem->getId();
399
+				$typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], [], $domain);
400
+				$attr[$key . '.typeid'] = $typeItem->getId();
401 401
 			}
402 402
 
403
-			$item->fromArray( $attr );
403
+			$item->fromArray($attr);
404 404
 		}
405 405
 
406 406
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Customer/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 	 * @param array $include List of resource types that should be fetched
108 108
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = [];
113
-		$refIds = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'customer/address' ) );
113
+		$refIds = array_keys($items);
114
+		$include = array_intersect($include, array('customer/address'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @param array $include List of resource types that should be fetched
135 135
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
136 136
 	 */
137
-	protected function getListItems( array $items, array $include )
137
+	protected function getListItems(array $items, array $include)
138 138
 	{
139
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
139
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
140 140
 
141 141
 		$search = $manager->createSearch();
142 142
 		$expr = array(
143
-			$search->compare( '==', 'customer.lists.parentid', array_keys( $items ) ),
144
-			$search->compare( '==', 'customer.lists.domain', $include ),
143
+			$search->compare('==', 'customer.lists.parentid', array_keys($items)),
144
+			$search->compare('==', 'customer.lists.domain', $include),
145 145
 		);
146
-		$search->setConditions( $search->combine( '&&', $expr ) );
146
+		$search->setConditions($search->combine('&&', $expr));
147 147
 
148
-		return $manager->searchItems( $search );
148
+		return $manager->searchItems($search);
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Supplier/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 	 * @param array $include List of resource types that should be fetched
108 108
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = [];
113
-		$refIds = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'supplier/address' ) );
113
+		$refIds = array_keys($items);
114
+		$include = array_intersect($include, array('supplier/address'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @param array $include List of resource types that should be fetched
135 135
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
136 136
 	 */
137
-	protected function getListItems( array $items, array $include )
137
+	protected function getListItems(array $items, array $include)
138 138
 	{
139
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier/lists' );
139
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier/lists');
140 140
 
141 141
 		$search = $manager->createSearch();
142 142
 		$expr = array(
143
-			$search->compare( '==', 'supplier.lists.parentid', array_keys( $items ) ),
144
-			$search->compare( '==', 'supplier.lists.domain', $include ),
143
+			$search->compare('==', 'supplier.lists.parentid', array_keys($items)),
144
+			$search->compare('==', 'supplier.lists.domain', $include),
145 145
 		);
146
-		$search->setConditions( $search->combine( '&&', $expr ) );
146
+		$search->setConditions($search->combine('&&', $expr));
147 147
 
148
-		return $manager->searchItems( $search );
148
+		return $manager->searchItems($search);
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Common/Factory/Base.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $classname Full name of the class for which the object should be returned
32 32
 	 * @param \Aimeos\Admin\JsonAdm\Iface|null $client JSON API client object
33 33
 	 */
34
-	public static function injectClient( $classname, \Aimeos\Admin\JsonAdm\Iface $client = null )
34
+	public static function injectClient($classname, \Aimeos\Admin\JsonAdm\Iface $client = null)
35 35
 	{
36 36
 		self::$objects[$classname] = $client;
37 37
 	}
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param string $path Name of the client separated by slashes, e.g "product/property"
48 48
 	 * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object
49 49
 	 */
50
-	protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client,
51
-		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
50
+	protected static function addClientDecorators(\Aimeos\Admin\JsonAdm\Iface $client,
51
+		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
52 52
 	{
53 53
 		$config = $context->getConfig();
54 54
 
@@ -74,38 +74,38 @@  discard block
 block discarded – undo
74 74
 		 * @since 2015.12
75 75
 		 * @category Developer
76 76
 		 */
77
-		$decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] );
77
+		$decorators = $config->get('admin/jsonadm/common/decorators/default', []);
78 78
 
79
-		if( $path !== null && is_string( $path ) )
79
+		if ($path !== null && is_string($path))
80 80
 		{
81
-			$dpath = trim( $path, '/' );
82
-			$dpath = ( $dpath !== '' ? $dpath . '/' : $dpath );
81
+			$dpath = trim($path, '/');
82
+			$dpath = ($dpath !== '' ? $dpath . '/' : $dpath);
83 83
 
84
-			$excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] );
85
-			$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) );
84
+			$excludes = $config->get('admin/jsonadm/' . $dpath . 'decorators/excludes', []);
85
+			$localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path)));
86 86
 
87
-			foreach( $decorators as $key => $name )
87
+			foreach ($decorators as $key => $name)
88 88
 			{
89
-				if( in_array( $name, $excludes ) ) {
90
-					unset( $decorators[$key] );
89
+				if (in_array($name, $excludes)) {
90
+					unset($decorators[$key]);
91 91
 				}
92 92
 			}
93 93
 
94 94
 			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
95
-			$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] );
96
-			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
95
+			$decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/global', []);
96
+			$client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path);
97 97
 
98
-			if( !empty( $path ) )
98
+			if (!empty($path))
99 99
 			{
100
-				$classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\';
101
-				$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] );
102
-				$client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
100
+				$classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst($localClass) . '\\Decorator\\';
101
+				$decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/local', []);
102
+				$client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path);
103 103
 			}
104 104
 		}
105 105
 		else
106 106
 		{
107 107
 			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
108
-			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
108
+			$client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path);
109 109
 		}
110 110
 
111 111
 		return $client;
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
125 125
 	 * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object
126 126
 	 */
127
-	protected static function addDecorators( \Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix,
128
-			\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path )
127
+	protected static function addDecorators(\Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix,
128
+			\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path)
129 129
 	{
130 130
 		$iface = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\Iface';
131 131
 
132
-		foreach( $decorators as $name )
132
+		foreach ($decorators as $name)
133 133
 		{
134
-			if( ctype_alnum( $name ) === false )
134
+			if (ctype_alnum($name) === false)
135 135
 			{
136
-				$classname = is_string( $name ) ? $classprefix . $name : '<not a string>';
137
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ), 404 );
136
+				$classname = is_string($name) ? $classprefix . $name : '<not a string>';
137
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname), 404);
138 138
 			}
139 139
 
140 140
 			$classname = $classprefix . $name;
141 141
 
142
-			if( class_exists( $classname ) === false ) {
143
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 );
142
+			if (class_exists($classname) === false) {
143
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404);
144 144
 			}
145 145
 
146
-			$client = new $classname( $client, $context, $view, $templatePaths, $path );
146
+			$client = new $classname($client, $context, $view, $templatePaths, $path);
147 147
 
148
-			if( !( $client instanceof $iface ) ) {
149
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ), 404 );
148
+			if (!($client instanceof $iface)) {
149
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface), 404);
150 150
 			}
151 151
 		}
152 152
 
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
166 166
 	 * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object
167 167
 	 */
168
-	protected static function createClientBase( $classname, $interface, \Aimeos\MShop\Context\Item\Iface $context,
169
-		\Aimeos\MW\View\Iface $view, array $templatePaths, $path )
168
+	protected static function createClientBase($classname, $interface, \Aimeos\MShop\Context\Item\Iface $context,
169
+		\Aimeos\MW\View\Iface $view, array $templatePaths, $path)
170 170
 	{
171
-		if( isset( self::$objects[$classname] ) ) {
171
+		if (isset(self::$objects[$classname])) {
172 172
 			return self::$objects[$classname];
173 173
 		}
174 174
 
175
-		if( class_exists( $classname ) === false ) {
176
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 );
175
+		if (class_exists($classname) === false) {
176
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404);
177 177
 		}
178 178
 
179
-		$client = new $classname( $context, $view, $templatePaths, $path );
179
+		$client = new $classname($context, $view, $templatePaths, $path);
180 180
 
181
-		if( !( $client instanceof $interface ) ) {
182
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $interface ), 500 );
181
+		if (!($client instanceof $interface)) {
182
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $interface), 500);
183 183
 		}
184 184
 
185 185
 		return $client;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
 				$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] );
102 102
 				$client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
103 103
 			}
104
-		}
105
-		else
104
+		} else
106 105
 		{
107 106
 			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
108 107
 			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Coupon/Standard.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@
 block discarded – undo
107 107
 	 * @param array $include List of resource types that should be fetched
108 108
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = [];
113
-		$ids = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'coupon/code' ) );
113
+		$ids = array_keys($items);
114
+		$include = array_intersect($include, array('coupon/code'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $ids ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $ids));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Locale/Site/Standard.php 2 patches
Spacing   +30 added lines, -30 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
 
@@ -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( 'locale/site', $include ) )
147
+		if (in_array('locale/site', $include))
148 148
 		{
149
-			foreach( $items as $item ) {
150
-				$list = array_merge( $list, $item->getChildren() );
149
+			foreach ($items as $item) {
150
+				$list = array_merge($list, $item->getChildren());
151 151
 			}
152 152
 		}
153 153
 
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
164 164
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
165 165
 	 */
166
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
166
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
167 167
 	{
168
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/site' );
168
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/site');
169 169
 
170
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : [] );
171
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
170
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : []);
171
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
172 172
 		$total = 1;
173 173
 
174
-		if( ( $id = $view->param( 'id' ) ) == null )
174
+		if (($id = $view->param('id')) == null)
175 175
 		{
176
-			$view->data = $manager->searchItems( $search, [], $total );
177
-			$view->childItems = $this->getChildItems( $view->data, $include );
176
+			$view->data = $manager->searchItems($search, [], $total);
177
+			$view->childItems = $this->getChildItems($view->data, $include);
178 178
 		}
179 179
 		else
180 180
 		{
181
-			$view->data = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
182
-			$view->childItems = $this->getChildItems( array( $view->data ), $include );
181
+			$view->data = $manager->getTree($id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
182
+			$view->childItems = $this->getChildItems(array($view->data), $include);
183 183
 		}
184 184
 
185 185
 		$view->listItems = [];
@@ -197,32 +197,32 @@  discard block
 block discarded – undo
197 197
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
198 198
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
199 199
 	 */
200
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
200
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
201 201
 	{
202
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
203
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
202
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
203
+		$refId = (isset($entry->refid) ? $entry->refid : null);
204 204
 
205
-		if( isset( $entry->id ) )
205
+		if (isset($entry->id))
206 206
 		{
207
-			$item = $manager->getItem( $entry->id );
208
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
209
-			$manager->saveItem( $item );
207
+			$item = $manager->getItem($entry->id);
208
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
209
+			$manager->saveItem($item);
210 210
 
211
-			if( isset( $entry->parentid ) && $targetId !== null ) {
212
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
211
+			if (isset($entry->parentid) && $targetId !== null) {
212
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
213 213
 			}
214 214
 		}
215 215
 		else
216 216
 		{
217 217
 			$item = $manager->createItem();
218
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
219
-			$manager->insertItem( $item, $targetId, $refId );
218
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
219
+			$manager->insertItem($item, $targetId, $refId);
220 220
 		}
221 221
 
222
-		if( isset( $entry->relationships ) ) {
223
-			$this->saveRelationships( $manager, $item, $entry->relationships );
222
+		if (isset($entry->relationships)) {
223
+			$this->saveRelationships($manager, $item, $entry->relationships);
224 224
 		}
225 225
 
226
-		return $manager->getItem( $item->getId() );
226
+		return $manager->getItem($item->getId());
227 227
 	}
228 228
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -175,8 +175,7 @@  discard block
 block discarded – undo
175 175
 		{
176 176
 			$view->data = $manager->searchItems( $search, [], $total );
177 177
 			$view->childItems = $this->getChildItems( $view->data, $include );
178
-		}
179
-		else
178
+		} else
180 179
 		{
181 180
 			$view->data = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
182 181
 			$view->childItems = $this->getChildItems( array( $view->data ), $include );
@@ -211,8 +210,7 @@  discard block
 block discarded – undo
211 210
 			if( isset( $entry->parentid ) && $targetId !== null ) {
212 211
 				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
213 212
 			}
214
-		}
215
-		else
213
+		} else
216 214
 		{
217 215
 			$item = $manager->createItem();
218 216
 			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Order/Base/Standard.php 1 patch
Spacing   +11 added lines, -11 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/order/base/template-data
116 116
 		 * Relative path to the data partial template file for the order base client
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 		 * @since 2016.01
128 128
 		 * @category Developer
129 129
 		 */
130
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) );
130
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data'));
131 131
 
132
-		return parent::get( $request, $response );
132
+		return parent::get($request, $response);
133 133
 	}
134 134
 
135 135
 
@@ -140,21 +140,21 @@  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
-		$ids = array_keys( $items );
147
-		$keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' );
148
-		$include = array_intersect( $include, $keys );
146
+		$ids = array_keys($items);
147
+		$keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service');
148
+		$include = array_intersect($include, $keys);
149 149
 
150
-		foreach( $include as $type )
150
+		foreach ($include as $type)
151 151
 		{
152
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type );
152
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type);
153 153
 
154 154
 			$search = $manager->createSearch();
155
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) );
155
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids));
156 156
 
157
-			$list = array_merge( $list, $manager->searchItems( $search ) );
157
+			$list = array_merge($list, $manager->searchItems($search));
158 158
 		}
159 159
 
160 160
 		return $list;
Please login to merge, or discard this patch.