@@ -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 | } |
@@ -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() ); |
@@ -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() ); |
@@ -38,24 +38,21 @@ discard block |
||
38 | 38 | { |
39 | 39 | $view = $this->deleteItems( $view, $body ); |
40 | 40 | $status = 200; |
41 | - } |
|
42 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
41 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
43 | 42 | { |
44 | 43 | $status = $e->getCode(); |
45 | 44 | $view->errors = array( array( |
46 | 45 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
47 | 46 | 'detail' => $e->getTraceAsString(), |
48 | 47 | ) ); |
49 | - } |
|
50 | - catch( \Aimeos\MShop\Exception $e ) |
|
48 | + } catch( \Aimeos\MShop\Exception $e ) |
|
51 | 49 | { |
52 | 50 | $status = 404; |
53 | 51 | $view->errors = array( array( |
54 | 52 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
55 | 53 | 'detail' => $e->getTraceAsString(), |
56 | 54 | ) ); |
57 | - } |
|
58 | - catch( \Exception $e ) |
|
55 | + } catch( \Exception $e ) |
|
59 | 56 | { |
60 | 57 | $status = 500; |
61 | 58 | $view->errors = array( array( |
@@ -120,16 +117,14 @@ discard block |
||
120 | 117 | } |
121 | 118 | |
122 | 119 | $status = 200; |
123 | - } |
|
124 | - catch( \Aimeos\MShop\Exception $e ) |
|
120 | + } catch( \Aimeos\MShop\Exception $e ) |
|
125 | 121 | { |
126 | 122 | $status = 404; |
127 | 123 | $view->errors = array( array( |
128 | 124 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
129 | 125 | 'detail' => $e->getTraceAsString(), |
130 | 126 | ) ); |
131 | - } |
|
132 | - catch( \Exception $e ) |
|
127 | + } catch( \Exception $e ) |
|
133 | 128 | { |
134 | 129 | $status = 500; |
135 | 130 | $view->errors = array( array( |
@@ -167,8 +162,7 @@ discard block |
||
167 | 162 | */ |
168 | 163 | $tplconf = 'admin/jsonadm/standard/template-aggregate'; |
169 | 164 | $default = 'aggregate-default.php'; |
170 | - } |
|
171 | - else |
|
165 | + } else |
|
172 | 166 | { |
173 | 167 | /** admin/jsonadm/standard/template-get |
174 | 168 | * Relative path to the JSON API template for GET requests |
@@ -220,24 +214,21 @@ discard block |
||
220 | 214 | { |
221 | 215 | $view = $this->patchItems( $view, $body, $header ); |
222 | 216 | $status = 200; |
223 | - } |
|
224 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
217 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
225 | 218 | { |
226 | 219 | $status = $e->getCode(); |
227 | 220 | $view->errors = array( array( |
228 | 221 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
229 | 222 | 'detail' => $e->getTraceAsString(), |
230 | 223 | ) ); |
231 | - } |
|
232 | - catch( \Aimeos\MShop\Exception $e ) |
|
224 | + } catch( \Aimeos\MShop\Exception $e ) |
|
233 | 225 | { |
234 | 226 | $status = 404; |
235 | 227 | $view->errors = array( array( |
236 | 228 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
237 | 229 | 'detail' => $e->getTraceAsString(), |
238 | 230 | ) ); |
239 | - } |
|
240 | - catch( \Exception $e ) |
|
231 | + } catch( \Exception $e ) |
|
241 | 232 | { |
242 | 233 | $status = 500; |
243 | 234 | $view->errors = array( array( |
@@ -295,24 +286,21 @@ discard block |
||
295 | 286 | { |
296 | 287 | $view = $this->postItems( $view, $body, $header ); |
297 | 288 | $status = 201; |
298 | - } |
|
299 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
289 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
300 | 290 | { |
301 | 291 | $status = $e->getCode(); |
302 | 292 | $view->errors = array( array( |
303 | 293 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
304 | 294 | 'detail' => $e->getTraceAsString(), |
305 | 295 | ) ); |
306 | - } |
|
307 | - catch( \Aimeos\MShop\Exception $e ) |
|
296 | + } catch( \Aimeos\MShop\Exception $e ) |
|
308 | 297 | { |
309 | 298 | $status = 404; |
310 | 299 | $view->errors = array( array( |
311 | 300 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
312 | 301 | 'detail' => $e->getTraceAsString(), |
313 | 302 | ) ); |
314 | - } |
|
315 | - catch( \Exception $e ) |
|
303 | + } catch( \Exception $e ) |
|
316 | 304 | { |
317 | 305 | $status = 500; |
318 | 306 | $view->errors = array( array( |
@@ -435,16 +423,14 @@ discard block |
||
435 | 423 | 'Allow' => 'DELETE,GET,PATCH,POST,OPTIONS' |
436 | 424 | ); |
437 | 425 | $status = 200; |
438 | - } |
|
439 | - catch( \Aimeos\MShop\Exception $e ) |
|
426 | + } catch( \Aimeos\MShop\Exception $e ) |
|
440 | 427 | { |
441 | 428 | $status = 404; |
442 | 429 | $view->errors = array( array( |
443 | 430 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
444 | 431 | 'detail' => $e->getTraceAsString(), |
445 | 432 | ) ); |
446 | - } |
|
447 | - catch( \Exception $e ) |
|
433 | + } catch( \Exception $e ) |
|
448 | 434 | { |
449 | 435 | $status = 500; |
450 | 436 | $view->errors = array( array( |
@@ -506,8 +492,7 @@ discard block |
||
506 | 492 | $ids = $this->getIds( $request ); |
507 | 493 | $manager->deleteItems( $ids ); |
508 | 494 | $view->total = count( $ids ); |
509 | - } |
|
510 | - else |
|
495 | + } else |
|
511 | 496 | { |
512 | 497 | $manager->deleteItem( $id ); |
513 | 498 | $view->total = 1; |
@@ -554,8 +539,7 @@ discard block |
||
554 | 539 | $view->data = $manager->searchItems( $search, array(), $total ); |
555 | 540 | $view->childItems = $this->getChildItems( $view->data, $include ); |
556 | 541 | $view->listItems = $this->getListItems( $view->data, $include ); |
557 | - } |
|
558 | - else |
|
542 | + } else |
|
559 | 543 | { |
560 | 544 | $view->data = $manager->getItem( $id, array() ); |
561 | 545 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -605,16 +589,14 @@ discard block |
||
605 | 589 | $view->data = $data; |
606 | 590 | $view->total = count( $data ); |
607 | 591 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
608 | - } |
|
609 | - elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
592 | + } elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
610 | 593 | { |
611 | 594 | $request->data->id = $id; |
612 | 595 | $data = $this->saveEntry( $manager, $request->data ); |
613 | 596 | |
614 | 597 | $view->data = $data; |
615 | 598 | $view->total = 1; |
616 | - } |
|
617 | - else |
|
599 | + } else |
|
618 | 600 | { |
619 | 601 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
620 | 602 | } |
@@ -651,8 +633,7 @@ discard block |
||
651 | 633 | $view->data = $data; |
652 | 634 | $view->total = count( $data ); |
653 | 635 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
654 | - } |
|
655 | - else |
|
636 | + } else |
|
656 | 637 | { |
657 | 638 | $request->data->id = null; |
658 | 639 | $data = $this->saveEntry( $manager, $request->data ); |