@@ -52,12 +52,10 @@ |
||
52 | 52 | foreach( $data as $item ) { |
53 | 53 | $response[] = $build( $item, $fields, $childItems ); |
54 | 54 | } |
55 | -} |
|
56 | -elseif( $data !== null ) |
|
55 | +} elseif( $data !== null ) |
|
57 | 56 | { |
58 | 57 | $response = $build( $data, $fields, $childItems ); |
59 | -} |
|
60 | -else |
|
58 | +} else |
|
61 | 59 | { |
62 | 60 | $response = null; |
63 | 61 | } |
@@ -52,12 +52,10 @@ |
||
52 | 52 | foreach( $data as $item ) { |
53 | 53 | $response[] = $build( $item, $fields, $childItems ); |
54 | 54 | } |
55 | -} |
|
56 | -elseif( $data !== null ) |
|
55 | +} elseif( $data !== null ) |
|
57 | 56 | { |
58 | 57 | $response = $build( $data, $fields, $childItems ); |
59 | -} |
|
60 | -else |
|
58 | +} else |
|
61 | 59 | { |
62 | 60 | $response = null; |
63 | 61 | } |
@@ -52,12 +52,10 @@ |
||
52 | 52 | foreach( $data as $item ) { |
53 | 53 | $response[] = $build( $item, $fields, $childItems ); |
54 | 54 | } |
55 | -} |
|
56 | -elseif( $data !== null ) |
|
55 | +} elseif( $data !== null ) |
|
57 | 56 | { |
58 | 57 | $response = $build( $data, $fields, $childItems ); |
59 | -} |
|
60 | -else |
|
58 | +} else |
|
61 | 59 | { |
62 | 60 | $response = null; |
63 | 61 | } |
@@ -136,8 +136,7 @@ |
||
136 | 136 | if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) { |
137 | 137 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 ); |
138 | 138 | } |
139 | - } |
|
140 | - else |
|
139 | + } else |
|
141 | 140 | { |
142 | 141 | $client = self::createClientRoot( $context, $view, $templatePaths, $path, $name ); |
143 | 142 | } |
@@ -59,24 +59,21 @@ discard block |
||
59 | 59 | { |
60 | 60 | $view = $this->deleteItems( $view, $body ); |
61 | 61 | $status = 200; |
62 | - } |
|
63 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
62 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
64 | 63 | { |
65 | 64 | $status = $e->getCode(); |
66 | 65 | $view->errors = array( array( |
67 | 66 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
68 | 67 | 'detail' => $e->getTraceAsString(), |
69 | 68 | ) ); |
70 | - } |
|
71 | - catch( \Aimeos\MShop\Exception $e ) |
|
69 | + } catch( \Aimeos\MShop\Exception $e ) |
|
72 | 70 | { |
73 | 71 | $status = 404; |
74 | 72 | $view->errors = array( array( |
75 | 73 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
76 | 74 | 'detail' => $e->getTraceAsString(), |
77 | 75 | ) ); |
78 | - } |
|
79 | - catch( \Exception $e ) |
|
76 | + } catch( \Exception $e ) |
|
80 | 77 | { |
81 | 78 | $status = 500; |
82 | 79 | $view->errors = array( array( |
@@ -133,16 +130,14 @@ discard block |
||
133 | 130 | { |
134 | 131 | $view = $this->getItem( $view ); |
135 | 132 | $status = 200; |
136 | - } |
|
137 | - catch( \Aimeos\MShop\Exception $e ) |
|
133 | + } catch( \Aimeos\MShop\Exception $e ) |
|
138 | 134 | { |
139 | 135 | $status = 404; |
140 | 136 | $view->errors = array( array( |
141 | 137 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
142 | 138 | 'detail' => $e->getTraceAsString(), |
143 | 139 | ) ); |
144 | - } |
|
145 | - catch( \Exception $e ) |
|
140 | + } catch( \Exception $e ) |
|
146 | 141 | { |
147 | 142 | $status = 500; |
148 | 143 | $view->errors = array( array( |
@@ -199,24 +194,21 @@ discard block |
||
199 | 194 | { |
200 | 195 | $view = $this->patchItems( $view, $body, $header ); |
201 | 196 | $status = 200; |
202 | - } |
|
203 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
197 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
204 | 198 | { |
205 | 199 | $status = $e->getCode(); |
206 | 200 | $view->errors = array( array( |
207 | 201 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
208 | 202 | 'detail' => $e->getTraceAsString(), |
209 | 203 | ) ); |
210 | - } |
|
211 | - catch( \Aimeos\MShop\Exception $e ) |
|
204 | + } catch( \Aimeos\MShop\Exception $e ) |
|
212 | 205 | { |
213 | 206 | $status = 404; |
214 | 207 | $view->errors = array( array( |
215 | 208 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
216 | 209 | 'detail' => $e->getTraceAsString(), |
217 | 210 | ) ); |
218 | - } |
|
219 | - catch( \Exception $e ) |
|
211 | + } catch( \Exception $e ) |
|
220 | 212 | { |
221 | 213 | $status = 500; |
222 | 214 | $view->errors = array( array( |
@@ -273,24 +265,21 @@ discard block |
||
273 | 265 | { |
274 | 266 | $view = $this->postItems( $view, $body, $header ); |
275 | 267 | $status = 201; |
276 | - } |
|
277 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
268 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
278 | 269 | { |
279 | 270 | $status = $e->getCode(); |
280 | 271 | $view->errors = array( array( |
281 | 272 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
282 | 273 | 'detail' => $e->getTraceAsString(), |
283 | 274 | ) ); |
284 | - } |
|
285 | - catch( \Aimeos\MShop\Exception $e ) |
|
275 | + } catch( \Aimeos\MShop\Exception $e ) |
|
286 | 276 | { |
287 | 277 | $status = 404; |
288 | 278 | $view->errors = array( array( |
289 | 279 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
290 | 280 | 'detail' => $e->getTraceAsString(), |
291 | 281 | ) ); |
292 | - } |
|
293 | - catch( \Exception $e ) |
|
282 | + } catch( \Exception $e ) |
|
294 | 283 | { |
295 | 284 | $status = 500; |
296 | 285 | $view->errors = array( array( |
@@ -411,16 +400,14 @@ discard block |
||
411 | 400 | 'Allow' => 'DELETE,GET,POST,OPTIONS' |
412 | 401 | ); |
413 | 402 | $status = 200; |
414 | - } |
|
415 | - catch( \Aimeos\MShop\Exception $e ) |
|
403 | + } catch( \Aimeos\MShop\Exception $e ) |
|
416 | 404 | { |
417 | 405 | $status = 404; |
418 | 406 | $view->errors = array( array( |
419 | 407 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
420 | 408 | 'detail' => $e->getTraceAsString(), |
421 | 409 | ) ); |
422 | - } |
|
423 | - catch( \Exception $e ) |
|
410 | + } catch( \Exception $e ) |
|
424 | 411 | { |
425 | 412 | $status = 500; |
426 | 413 | $view->errors = array( array( |
@@ -481,8 +468,7 @@ discard block |
||
481 | 468 | $ids = $this->getIds( $request ); |
482 | 469 | $manager->deleteItems( $ids ); |
483 | 470 | $view->total = count( $ids ); |
484 | - } |
|
485 | - else |
|
471 | + } else |
|
486 | 472 | { |
487 | 473 | $manager->deleteItem( $id ); |
488 | 474 | $view->total = 1; |
@@ -510,8 +496,7 @@ discard block |
||
510 | 496 | $view->data = $manager->searchItems( $search, array(), $total ); |
511 | 497 | $view->childItems = $this->getChildItems( $view->data, $include ); |
512 | 498 | $view->listItems = $this->getListItems( $view->data, $include ); |
513 | - } |
|
514 | - else |
|
499 | + } else |
|
515 | 500 | { |
516 | 501 | $view->data = $manager->getItem( $id, array() ); |
517 | 502 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -786,16 +771,14 @@ discard block |
||
786 | 771 | $view->data = $data; |
787 | 772 | $view->total = count( $data ); |
788 | 773 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
789 | - } |
|
790 | - elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
774 | + } elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
791 | 775 | { |
792 | 776 | $request->data->id = $id; |
793 | 777 | $data = $this->saveEntry( $manager, $request->data ); |
794 | 778 | |
795 | 779 | $view->data = $data; |
796 | 780 | $view->total = 1; |
797 | - } |
|
798 | - else |
|
781 | + } else |
|
799 | 782 | { |
800 | 783 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
801 | 784 | } |
@@ -832,8 +815,7 @@ discard block |
||
832 | 815 | $view->data = $data; |
833 | 816 | $view->total = count( $data ); |
834 | 817 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
835 | - } |
|
836 | - else |
|
818 | + } else |
|
837 | 819 | { |
838 | 820 | $request->data->id = null; |
839 | 821 | $data = $this->saveEntry( $manager, $request->data ); |
@@ -52,12 +52,10 @@ |
||
52 | 52 | foreach( $data as $item ) { |
53 | 53 | $response[] = $build( $item, $fields, $childItems ); |
54 | 54 | } |
55 | -} |
|
56 | -elseif( $data !== null ) |
|
55 | +} elseif( $data !== null ) |
|
57 | 56 | { |
58 | 57 | $response = $build( $data, $fields, $childItems ); |
59 | -} |
|
60 | -else |
|
58 | +} else |
|
61 | 59 | { |
62 | 60 | $response = null; |
63 | 61 | } |
@@ -171,8 +171,7 @@ discard block |
||
171 | 171 | $view->data = $manager->searchItems( $search, array(), $total ); |
172 | 172 | $view->listItems = $this->getListItems( $view->data, $include ); |
173 | 173 | $view->childItems = $this->getChildItems( $view->data, $include ); |
174 | - } |
|
175 | - else |
|
174 | + } else |
|
176 | 175 | { |
177 | 176 | $view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search ); |
178 | 177 | $view->listItems = $this->getListItems( array( $id => $view->data ), $include ); |
@@ -229,8 +228,7 @@ discard block |
||
229 | 228 | if( isset( $entry->parentid ) && $targetId !== null ) { |
230 | 229 | $manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId ); |
231 | 230 | } |
232 | - } |
|
233 | - else |
|
231 | + } else |
|
234 | 232 | { |
235 | 233 | $item = $manager->createItem(); |
236 | 234 | $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |