@@ -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 | } |
@@ -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() ); |
@@ -79,12 +79,10 @@ |
||
| 79 | 79 | foreach( $data as $item ) { |
| 80 | 80 | $response[] = $build( $this, $item, $fields, $childItems, $listItems ); |
| 81 | 81 | } |
| 82 | -} |
|
| 83 | -elseif( $data !== null ) |
|
| 82 | +} elseif( $data !== null ) |
|
| 84 | 83 | { |
| 85 | 84 | $response = $build( $this, $data, $fields, $childItems, $listItems ); |
| 86 | -} |
|
| 87 | -else |
|
| 85 | +} else |
|
| 88 | 86 | { |
| 89 | 87 | $response = null; |
| 90 | 88 | } |
@@ -67,12 +67,10 @@ |
||
| 67 | 67 | foreach( $data as $item ) { |
| 68 | 68 | $response[] = $build( $this, $item, $fields, $childItems ); |
| 69 | 69 | } |
| 70 | -} |
|
| 71 | -elseif( $data !== null ) |
|
| 70 | +} elseif( $data !== null ) |
|
| 72 | 71 | { |
| 73 | 72 | $response = $build( $this, $data, $fields, $childItems ); |
| 74 | -} |
|
| 75 | -else |
|
| 73 | +} else |
|
| 76 | 74 | { |
| 77 | 75 | $response = null; |
| 78 | 76 | } |
@@ -58,12 +58,10 @@ |
||
| 58 | 58 | foreach( $data as $item ) { |
| 59 | 59 | $response[] = $build( $this, $item, $fields ); |
| 60 | 60 | } |
| 61 | -} |
|
| 62 | -elseif( $data !== null ) |
|
| 61 | +} elseif( $data !== null ) |
|
| 63 | 62 | { |
| 64 | 63 | $response = $build( $this, $data, $fields ); |
| 65 | -} |
|
| 66 | -else |
|
| 64 | +} else |
|
| 67 | 65 | { |
| 68 | 66 | $response = null; |
| 69 | 67 | } |
@@ -75,12 +75,10 @@ |
||
| 75 | 75 | foreach( $data as $item ) { |
| 76 | 76 | $response[] = $build( $this, $item, $fields, $listItems ); |
| 77 | 77 | } |
| 78 | -} |
|
| 79 | -elseif( $data !== null ) |
|
| 78 | +} elseif( $data !== null ) |
|
| 80 | 79 | { |
| 81 | 80 | $response = $build( $this, $data, $fields, $listItems ); |
| 82 | -} |
|
| 83 | -else |
|
| 81 | +} else |
|
| 84 | 82 | { |
| 85 | 83 | $response = null; |
| 86 | 84 | } |
@@ -182,8 +182,7 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $view->data = $manager->searchItems( $search, array(), $total ); |
| 184 | 184 | $view->childItems = $this->getChildItems( $view->data, $include ); |
| 185 | - } |
|
| 186 | - else |
|
| 185 | + } else |
|
| 187 | 186 | { |
| 188 | 187 | $view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search ); |
| 189 | 188 | $view->childItems = $this->getChildItems( array( $view->data ), $include ); |
@@ -218,8 +217,7 @@ discard block |
||
| 218 | 217 | if( isset( $entry->parentid ) && $targetId !== null ) { |
| 219 | 218 | $manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId ); |
| 220 | 219 | } |
| 221 | - } |
|
| 222 | - else |
|
| 220 | + } else |
|
| 223 | 221 | { |
| 224 | 222 | $item = $manager->createItem(); |
| 225 | 223 | $item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() ); |
@@ -39,24 +39,21 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $response = $this->deleteItems( $view, $request, $response ); |
| 41 | 41 | $status = 200; |
| 42 | - } |
|
| 43 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 42 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 44 | 43 | { |
| 45 | 44 | $status = $e->getCode(); |
| 46 | 45 | $view->errors = array( array( |
| 47 | 46 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 48 | 47 | 'detail' => $e->getTraceAsString(), |
| 49 | 48 | ) ); |
| 50 | - } |
|
| 51 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 49 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 52 | 50 | { |
| 53 | 51 | $status = 404; |
| 54 | 52 | $view->errors = array( array( |
| 55 | 53 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 56 | 54 | 'detail' => $e->getTraceAsString(), |
| 57 | 55 | ) ); |
| 58 | - } |
|
| 59 | - catch( \Exception $e ) |
|
| 56 | + } catch( \Exception $e ) |
|
| 60 | 57 | { |
| 61 | 58 | $status = 500; |
| 62 | 59 | $view->errors = array( array( |
@@ -116,16 +113,14 @@ discard block |
||
| 116 | 113 | { |
| 117 | 114 | $response = $this->getItems( $view, $request, $response ); |
| 118 | 115 | $status = 200; |
| 119 | - } |
|
| 120 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 116 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 121 | 117 | { |
| 122 | 118 | $status = 404; |
| 123 | 119 | $view->errors = array( array( |
| 124 | 120 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 125 | 121 | 'detail' => $e->getTraceAsString(), |
| 126 | 122 | ) ); |
| 127 | - } |
|
| 128 | - catch( \Exception $e ) |
|
| 123 | + } catch( \Exception $e ) |
|
| 129 | 124 | { |
| 130 | 125 | $status = 500; |
| 131 | 126 | $view->errors = array( array( |
@@ -163,8 +158,7 @@ discard block |
||
| 163 | 158 | */ |
| 164 | 159 | $tplconf = 'admin/jsonadm/standard/template-aggregate'; |
| 165 | 160 | $default = 'aggregate-default.php'; |
| 166 | - } |
|
| 167 | - else |
|
| 161 | + } else |
|
| 168 | 162 | { |
| 169 | 163 | /** admin/jsonadm/standard/template-get |
| 170 | 164 | * Relative path to the JSON API template for GET requests |
@@ -218,24 +212,21 @@ discard block |
||
| 218 | 212 | { |
| 219 | 213 | $response = $this->patchItems( $view, $request, $response ); |
| 220 | 214 | $status = 200; |
| 221 | - } |
|
| 222 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 215 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 223 | 216 | { |
| 224 | 217 | $status = $e->getCode(); |
| 225 | 218 | $view->errors = array( array( |
| 226 | 219 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 227 | 220 | 'detail' => $e->getTraceAsString(), |
| 228 | 221 | ) ); |
| 229 | - } |
|
| 230 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 222 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 231 | 223 | { |
| 232 | 224 | $status = 404; |
| 233 | 225 | $view->errors = array( array( |
| 234 | 226 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 235 | 227 | 'detail' => $e->getTraceAsString(), |
| 236 | 228 | ) ); |
| 237 | - } |
|
| 238 | - catch( \Exception $e ) |
|
| 229 | + } catch( \Exception $e ) |
|
| 239 | 230 | { |
| 240 | 231 | $status = 500; |
| 241 | 232 | $view->errors = array( array( |
@@ -295,24 +286,21 @@ discard block |
||
| 295 | 286 | { |
| 296 | 287 | $response = $this->postItems( $view, $request, $response ); |
| 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( |
@@ -438,16 +426,14 @@ discard block |
||
| 438 | 426 | $view->attributes = $attributes; |
| 439 | 427 | |
| 440 | 428 | $status = 200; |
| 441 | - } |
|
| 442 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 429 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 443 | 430 | { |
| 444 | 431 | $status = 404; |
| 445 | 432 | $view->errors = array( array( |
| 446 | 433 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 447 | 434 | 'detail' => $e->getTraceAsString(), |
| 448 | 435 | ) ); |
| 449 | - } |
|
| 450 | - catch( \Exception $e ) |
|
| 436 | + } catch( \Exception $e ) |
|
| 451 | 437 | { |
| 452 | 438 | $status = 500; |
| 453 | 439 | $view->errors = array( array( |
@@ -517,8 +503,7 @@ discard block |
||
| 517 | 503 | $ids = $this->getIds( $payload ); |
| 518 | 504 | $manager->deleteItems( $ids ); |
| 519 | 505 | $view->total = count( $ids ); |
| 520 | - } |
|
| 521 | - else |
|
| 506 | + } else |
|
| 522 | 507 | { |
| 523 | 508 | $manager->deleteItem( $id ); |
| 524 | 509 | $view->total = 1; |
@@ -556,8 +541,7 @@ discard block |
||
| 556 | 541 | $view->data = $manager->searchItems( $search, array(), $total ); |
| 557 | 542 | $view->childItems = $this->getChildItems( $view->data, $include ); |
| 558 | 543 | $view->listItems = $this->getListItems( $view->data, $include ); |
| 559 | - } |
|
| 560 | - else |
|
| 544 | + } else |
|
| 561 | 545 | { |
| 562 | 546 | $view->data = $manager->getItem( $id, array() ); |
| 563 | 547 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -597,16 +581,14 @@ discard block |
||
| 597 | 581 | $view->data = $data; |
| 598 | 582 | $view->total = count( $data ); |
| 599 | 583 | $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); |
| 600 | - } |
|
| 601 | - elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
| 584 | + } elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
| 602 | 585 | { |
| 603 | 586 | $payload->data->id = $id; |
| 604 | 587 | $data = $this->saveEntry( $manager, $payload->data ); |
| 605 | 588 | |
| 606 | 589 | $view->data = $data; |
| 607 | 590 | $view->total = 1; |
| 608 | - } |
|
| 609 | - else |
|
| 591 | + } else |
|
| 610 | 592 | { |
| 611 | 593 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
| 612 | 594 | } |
@@ -645,8 +627,7 @@ discard block |
||
| 645 | 627 | $view->data = $data; |
| 646 | 628 | $view->total = count( $data ); |
| 647 | 629 | $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); |
| 648 | - } |
|
| 649 | - else |
|
| 630 | + } else |
|
| 650 | 631 | { |
| 651 | 632 | $payload->data->id = null; |
| 652 | 633 | $data = $this->saveEntry( $manager, $payload->data ); |
@@ -67,12 +67,10 @@ |
||
| 67 | 67 | foreach( $data as $item ) { |
| 68 | 68 | $response[] = $build( $this, $item, $fields, $childItems ); |
| 69 | 69 | } |
| 70 | -} |
|
| 71 | -elseif( $data !== null ) |
|
| 70 | +} elseif( $data !== null ) |
|
| 72 | 71 | { |
| 73 | 72 | $response = $build( $this, $data, $fields, $childItems ); |
| 74 | -} |
|
| 75 | -else |
|
| 73 | +} else |
|
| 76 | 74 | { |
| 77 | 75 | $response = null; |
| 78 | 76 | } |