@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string $path Name of the client separated by slashes, e.g "product/stock" |
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) |
|
| 37 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path) |
|
| 38 | 38 | { |
| 39 | 39 | $this->view = $view; |
| 40 | 40 | $this->context = $context; |
@@ -51,48 +51,48 @@ discard block |
||
| 51 | 51 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 52 | 52 | * @return string Content for response body |
| 53 | 53 | */ |
| 54 | - public function delete( $body, array &$header, &$status ) |
|
| 54 | + public function delete($body, array &$header, &$status) |
|
| 55 | 55 | { |
| 56 | - $header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' ); |
|
| 56 | + $header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"'); |
|
| 57 | 57 | $context = $this->getContext(); |
| 58 | 58 | $view = $this->getView(); |
| 59 | 59 | |
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | - $view = $this->deleteItems( $view, $body ); |
|
| 62 | + $view = $this->deleteItems($view, $body); |
|
| 63 | 63 | $status = 200; |
| 64 | 64 | } |
| 65 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 65 | + catch (\Aimeos\Admin\JsonAdm\Exception $e) |
|
| 66 | 66 | { |
| 67 | 67 | $status = $e->getCode(); |
| 68 | - $view->errors = array( array( |
|
| 69 | - 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
|
| 68 | + $view->errors = array(array( |
|
| 69 | + 'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()), |
|
| 70 | 70 | 'detail' => $e->getTraceAsString(), |
| 71 | - ) ); |
|
| 71 | + )); |
|
| 72 | 72 | } |
| 73 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 73 | + catch (\Aimeos\MAdmin\Exception $e) |
|
| 74 | 74 | { |
| 75 | 75 | $status = 404; |
| 76 | - $view->errors = array( array( |
|
| 77 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 76 | + $view->errors = array(array( |
|
| 77 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 78 | 78 | 'detail' => $e->getTraceAsString(), |
| 79 | - ) ); |
|
| 79 | + )); |
|
| 80 | 80 | } |
| 81 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 81 | + catch (\Aimeos\MShop\Exception $e) |
|
| 82 | 82 | { |
| 83 | 83 | $status = 404; |
| 84 | - $view->errors = array( array( |
|
| 85 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 84 | + $view->errors = array(array( |
|
| 85 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 86 | 86 | 'detail' => $e->getTraceAsString(), |
| 87 | - ) ); |
|
| 87 | + )); |
|
| 88 | 88 | } |
| 89 | - catch( \Exception $e ) |
|
| 89 | + catch (\Exception $e) |
|
| 90 | 90 | { |
| 91 | 91 | $status = 500; |
| 92 | - $view->errors = array( array( |
|
| 92 | + $view->errors = array(array( |
|
| 93 | 93 | 'title' => $e->getMessage(), |
| 94 | 94 | 'detail' => $e->getTraceAsString(), |
| 95 | - ) ); |
|
| 95 | + )); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** admin/jsonadm/standard/template-delete |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $tplconf = 'admin/jsonadm/standard/template-delete'; |
| 123 | 123 | $default = 'delete-default.php'; |
| 124 | 124 | |
| 125 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 125 | + return $view->render($view->config($tplconf, $default)); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,60 +134,60 @@ discard block |
||
| 134 | 134 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 135 | 135 | * @return string Content for response body |
| 136 | 136 | */ |
| 137 | - public function get( $body, array &$header, &$status ) |
|
| 137 | + public function get($body, array &$header, &$status) |
|
| 138 | 138 | { |
| 139 | - $header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' ); |
|
| 139 | + $header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"'); |
|
| 140 | 140 | $context = $this->getContext(); |
| 141 | 141 | $view = $this->getView(); |
| 142 | 142 | $total = 1; |
| 143 | 143 | |
| 144 | 144 | try |
| 145 | 145 | { |
| 146 | - $manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() ); |
|
| 147 | - $include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() ); |
|
| 146 | + $manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath()); |
|
| 147 | + $include = (($include = $view->param('include')) !== null ? explode(',', $include) : array()); |
|
| 148 | 148 | |
| 149 | - if( ( $id = $view->param( 'id' ) ) == null ) |
|
| 149 | + if (($id = $view->param('id')) == null) |
|
| 150 | 150 | { |
| 151 | - $search = $this->initCriteria( $manager->createSearch(), $view->param() ); |
|
| 152 | - $view->data = $manager->searchItems( $search, array(), $total ); |
|
| 153 | - $view->childItems = $this->getChildItems( $view->data, $include ); |
|
| 154 | - $view->listItems = $this->getListItems( $view->data, $include ); |
|
| 151 | + $search = $this->initCriteria($manager->createSearch(), $view->param()); |
|
| 152 | + $view->data = $manager->searchItems($search, array(), $total); |
|
| 153 | + $view->childItems = $this->getChildItems($view->data, $include); |
|
| 154 | + $view->listItems = $this->getListItems($view->data, $include); |
|
| 155 | 155 | } |
| 156 | 156 | else |
| 157 | 157 | { |
| 158 | - $view->data = $manager->getItem( $id, array() ); |
|
| 159 | - $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
|
| 160 | - $view->listItems = $this->getListItems( array( $id => $view->data ), $include ); |
|
| 158 | + $view->data = $manager->getItem($id, array()); |
|
| 159 | + $view->childItems = $this->getChildItems(array($id => $view->data), $include); |
|
| 160 | + $view->listItems = $this->getListItems(array($id => $view->data), $include); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $view->refItems = $this->getRefItems( $view->listItems ); |
|
| 163 | + $view->refItems = $this->getRefItems($view->listItems); |
|
| 164 | 164 | |
| 165 | 165 | $view->total = $total; |
| 166 | 166 | $status = 200; |
| 167 | 167 | } |
| 168 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 168 | + catch (\Aimeos\MAdmin\Exception $e) |
|
| 169 | 169 | { |
| 170 | 170 | $status = 404; |
| 171 | - $view->errors = array( array( |
|
| 172 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 171 | + $view->errors = array(array( |
|
| 172 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 173 | 173 | 'detail' => $e->getTraceAsString(), |
| 174 | - ) ); |
|
| 174 | + )); |
|
| 175 | 175 | } |
| 176 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 176 | + catch (\Aimeos\MShop\Exception $e) |
|
| 177 | 177 | { |
| 178 | 178 | $status = 404; |
| 179 | - $view->errors = array( array( |
|
| 180 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 179 | + $view->errors = array(array( |
|
| 180 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 181 | 181 | 'detail' => $e->getTraceAsString(), |
| 182 | - ) ); |
|
| 182 | + )); |
|
| 183 | 183 | } |
| 184 | - catch( \Exception $e ) |
|
| 184 | + catch (\Exception $e) |
|
| 185 | 185 | { |
| 186 | 186 | $status = 500; |
| 187 | - $view->errors = array( array( |
|
| 187 | + $view->errors = array(array( |
|
| 188 | 188 | 'title' => $e->getMessage(), |
| 189 | 189 | 'detail' => $e->getTraceAsString(), |
| 190 | - ) ); |
|
| 190 | + )); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** admin/jsonadm/standard/template-get |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $tplconf = 'admin/jsonadm/standard/template-get'; |
| 218 | 218 | $default = 'get-default.php'; |
| 219 | 219 | |
| 220 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 220 | + return $view->render($view->config($tplconf, $default)); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
@@ -229,48 +229,48 @@ discard block |
||
| 229 | 229 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 230 | 230 | * @return string Content for response body |
| 231 | 231 | */ |
| 232 | - public function patch( $body, array &$header, &$status ) |
|
| 232 | + public function patch($body, array &$header, &$status) |
|
| 233 | 233 | { |
| 234 | - $header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' ); |
|
| 234 | + $header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"'); |
|
| 235 | 235 | $context = $this->getContext(); |
| 236 | 236 | $view = $this->getView(); |
| 237 | 237 | |
| 238 | 238 | try |
| 239 | 239 | { |
| 240 | - $view = $this->patchItems( $view, $body, $header ); |
|
| 240 | + $view = $this->patchItems($view, $body, $header); |
|
| 241 | 241 | $status = 200; |
| 242 | 242 | } |
| 243 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 243 | + catch (\Aimeos\Admin\JsonAdm\Exception $e) |
|
| 244 | 244 | { |
| 245 | 245 | $status = $e->getCode(); |
| 246 | - $view->errors = array( array( |
|
| 247 | - 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
|
| 246 | + $view->errors = array(array( |
|
| 247 | + 'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()), |
|
| 248 | 248 | 'detail' => $e->getTraceAsString(), |
| 249 | - ) ); |
|
| 249 | + )); |
|
| 250 | 250 | } |
| 251 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 251 | + catch (\Aimeos\MAdmin\Exception $e) |
|
| 252 | 252 | { |
| 253 | 253 | $status = 404; |
| 254 | - $view->errors = array( array( |
|
| 255 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 254 | + $view->errors = array(array( |
|
| 255 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 256 | 256 | 'detail' => $e->getTraceAsString(), |
| 257 | - ) ); |
|
| 257 | + )); |
|
| 258 | 258 | } |
| 259 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 259 | + catch (\Aimeos\MShop\Exception $e) |
|
| 260 | 260 | { |
| 261 | 261 | $status = 404; |
| 262 | - $view->errors = array( array( |
|
| 263 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 262 | + $view->errors = array(array( |
|
| 263 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 264 | 264 | 'detail' => $e->getTraceAsString(), |
| 265 | - ) ); |
|
| 265 | + )); |
|
| 266 | 266 | } |
| 267 | - catch( \Aimeos\MW\Exception $e ) |
|
| 267 | + catch (\Aimeos\MW\Exception $e) |
|
| 268 | 268 | { |
| 269 | 269 | $status = 500; |
| 270 | - $view->errors = array( array( |
|
| 270 | + $view->errors = array(array( |
|
| 271 | 271 | 'title' => $e->getMessage(), |
| 272 | 272 | 'detail' => $e->getTraceAsString(), |
| 273 | - ) ); |
|
| 273 | + )); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** admin/jsonadm/standard/template-patch |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $tplconf = 'admin/jsonadm/standard/template-patch'; |
| 301 | 301 | $default = 'patch-default.php'; |
| 302 | 302 | |
| 303 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 303 | + return $view->render($view->config($tplconf, $default)); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | |
@@ -312,48 +312,48 @@ discard block |
||
| 312 | 312 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 313 | 313 | * @return string Content for response body |
| 314 | 314 | */ |
| 315 | - public function post( $body, array &$header, &$status ) |
|
| 315 | + public function post($body, array &$header, &$status) |
|
| 316 | 316 | { |
| 317 | - $header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' ); |
|
| 317 | + $header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"'); |
|
| 318 | 318 | $context = $this->getContext(); |
| 319 | 319 | $view = $this->getView(); |
| 320 | 320 | |
| 321 | 321 | try |
| 322 | 322 | { |
| 323 | - $view = $this->postItems( $view, $body, $header ); |
|
| 323 | + $view = $this->postItems($view, $body, $header); |
|
| 324 | 324 | $status = 201; |
| 325 | 325 | } |
| 326 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 326 | + catch (\Aimeos\Admin\JsonAdm\Exception $e) |
|
| 327 | 327 | { |
| 328 | 328 | $status = $e->getCode(); |
| 329 | - $view->errors = array( array( |
|
| 330 | - 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
|
| 329 | + $view->errors = array(array( |
|
| 330 | + 'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()), |
|
| 331 | 331 | 'detail' => $e->getTraceAsString(), |
| 332 | - ) ); |
|
| 332 | + )); |
|
| 333 | 333 | } |
| 334 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 334 | + catch (\Aimeos\MAdmin\Exception $e) |
|
| 335 | 335 | { |
| 336 | 336 | $status = 404; |
| 337 | - $view->errors = array( array( |
|
| 338 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 337 | + $view->errors = array(array( |
|
| 338 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 339 | 339 | 'detail' => $e->getTraceAsString(), |
| 340 | - ) ); |
|
| 340 | + )); |
|
| 341 | 341 | } |
| 342 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 342 | + catch (\Aimeos\MShop\Exception $e) |
|
| 343 | 343 | { |
| 344 | 344 | $status = 404; |
| 345 | - $view->errors = array( array( |
|
| 346 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 345 | + $view->errors = array(array( |
|
| 346 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 347 | 347 | 'detail' => $e->getTraceAsString(), |
| 348 | - ) ); |
|
| 348 | + )); |
|
| 349 | 349 | } |
| 350 | - catch( \Exception $e ) |
|
| 350 | + catch (\Exception $e) |
|
| 351 | 351 | { |
| 352 | 352 | $status = 500; |
| 353 | - $view->errors = array( array( |
|
| 353 | + $view->errors = array(array( |
|
| 354 | 354 | 'title' => $e->getMessage(), |
| 355 | 355 | 'detail' => $e->getTraceAsString(), |
| 356 | - ) ); |
|
| 356 | + )); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** admin/jsonadm/standard/template-post |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $tplconf = 'admin/jsonadm/standard/template-post'; |
| 384 | 384 | $default = 'post-default.php'; |
| 385 | 385 | |
| 386 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 386 | + return $view->render($view->config($tplconf, $default)); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -395,17 +395,17 @@ discard block |
||
| 395 | 395 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 396 | 396 | * @return string Content for response body |
| 397 | 397 | */ |
| 398 | - public function put( $body, array &$header, &$status ) |
|
| 398 | + public function put($body, array &$header, &$status) |
|
| 399 | 399 | { |
| 400 | - $header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' ); |
|
| 400 | + $header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"'); |
|
| 401 | 401 | $status = 501; |
| 402 | 402 | |
| 403 | 403 | $context = $this->getContext(); |
| 404 | 404 | $view = $this->getView(); |
| 405 | 405 | |
| 406 | - $view->errors = array( array( |
|
| 407 | - 'title' => $context->getI18n()->dt( 'admin/jsonadm', 'Not implemented, use PATCH instead' ), |
|
| 408 | - ) ); |
|
| 406 | + $view->errors = array(array( |
|
| 407 | + 'title' => $context->getI18n()->dt('admin/jsonadm', 'Not implemented, use PATCH instead'), |
|
| 408 | + )); |
|
| 409 | 409 | |
| 410 | 410 | /** admin/jsonadm/standard/template-put |
| 411 | 411 | * Relative path to the JSON API template for PUT requests |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $tplconf = 'admin/jsonadm/standard/template-put'; |
| 435 | 435 | $default = 'put-default.php'; |
| 436 | 436 | |
| 437 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 437 | + return $view->render($view->config($tplconf, $default)); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @param integer &$status Variable which contains the HTTP status afterwards |
| 447 | 447 | * @return string Content for response body |
| 448 | 448 | */ |
| 449 | - public function options( $body, array &$header, &$status ) |
|
| 449 | + public function options($body, array &$header, &$status) |
|
| 450 | 450 | { |
| 451 | 451 | $context = $this->getContext(); |
| 452 | 452 | $view = $this->getView(); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | { |
| 456 | 456 | $resources = $attributes = array(); |
| 457 | 457 | |
| 458 | - if( ( $domains = $view->param( 'resource' ) ) == '' ) |
|
| 458 | + if (($domains = $view->param('resource')) == '') |
|
| 459 | 459 | { |
| 460 | 460 | /** admin/jsonadm/domains |
| 461 | 461 | * A list of domain names whose clients are available for the JSON API |
@@ -477,14 +477,14 @@ discard block |
||
| 477 | 477 | 'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', |
| 478 | 478 | 'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text' |
| 479 | 479 | ); |
| 480 | - $domains = $context->getConfig()->get( 'admin/jsonadm/domains', $default ); |
|
| 480 | + $domains = $context->getConfig()->get('admin/jsonadm/domains', $default); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - foreach( (array) $domains as $domain ) |
|
| 483 | + foreach ((array) $domains as $domain) |
|
| 484 | 484 | { |
| 485 | - $manager = \Aimeos\MShop\Factory::createManager( $context, $domain ); |
|
| 486 | - $resources = array_merge( $resources, $manager->getResourceType( true ) ); |
|
| 487 | - $attributes = array_merge( $attributes, $manager->getSearchAttributes( true ) ); |
|
| 485 | + $manager = \Aimeos\MShop\Factory::createManager($context, $domain); |
|
| 486 | + $resources = array_merge($resources, $manager->getResourceType(true)); |
|
| 487 | + $attributes = array_merge($attributes, $manager->getSearchAttributes(true)); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $view->resources = $resources; |
@@ -496,29 +496,29 @@ discard block |
||
| 496 | 496 | ); |
| 497 | 497 | $status = 200; |
| 498 | 498 | } |
| 499 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 499 | + catch (\Aimeos\MAdmin\Exception $e) |
|
| 500 | 500 | { |
| 501 | 501 | $status = 404; |
| 502 | - $view->errors = array( array( |
|
| 503 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 502 | + $view->errors = array(array( |
|
| 503 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 504 | 504 | 'detail' => $e->getTraceAsString(), |
| 505 | - ) ); |
|
| 505 | + )); |
|
| 506 | 506 | } |
| 507 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 507 | + catch (\Aimeos\MShop\Exception $e) |
|
| 508 | 508 | { |
| 509 | 509 | $status = 404; |
| 510 | - $view->errors = array( array( |
|
| 511 | - 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
|
| 510 | + $view->errors = array(array( |
|
| 511 | + 'title' => $context->getI18n()->dt('mshop', $e->getMessage()), |
|
| 512 | 512 | 'detail' => $e->getTraceAsString(), |
| 513 | - ) ); |
|
| 513 | + )); |
|
| 514 | 514 | } |
| 515 | - catch( \Exception $e ) |
|
| 515 | + catch (\Exception $e) |
|
| 516 | 516 | { |
| 517 | 517 | $status = 500; |
| 518 | - $view->errors = array( array( |
|
| 518 | + $view->errors = array(array( |
|
| 519 | 519 | 'title' => $e->getMessage(), |
| 520 | 520 | 'detail' => $e->getTraceAsString(), |
| 521 | - ) ); |
|
| 521 | + )); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | /** admin/jsonadm/standard/template-options |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | $tplconf = 'admin/jsonadm/standard/template-options'; |
| 549 | 549 | $default = 'options-default.php'; |
| 550 | 550 | |
| 551 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 551 | + return $view->render($view->config($tplconf, $default)); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | |
@@ -560,31 +560,31 @@ discard block |
||
| 560 | 560 | * @return \Aimeos\MW\View\Iface $view View object that will contain the "total" property afterwards |
| 561 | 561 | * @throws \Aimeos\Admin\JsonAdm\Exception If the request body is invalid |
| 562 | 562 | */ |
| 563 | - protected function deleteItems( \Aimeos\MW\View\Iface $view, $body ) |
|
| 563 | + protected function deleteItems(\Aimeos\MW\View\Iface $view, $body) |
|
| 564 | 564 | { |
| 565 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() ); |
|
| 565 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath()); |
|
| 566 | 566 | |
| 567 | - if( ( $id = $view->param( 'id' ) ) == null ) |
|
| 567 | + if (($id = $view->param('id')) == null) |
|
| 568 | 568 | { |
| 569 | - if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) || !is_array( $request->data ) ) { |
|
| 570 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); |
|
| 569 | + if (($request = json_decode($body)) === null || !isset($request->data) || !is_array($request->data)) { |
|
| 570 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | $ids = array(); |
| 574 | 574 | |
| 575 | - foreach( $request->data as $entry ) |
|
| 575 | + foreach ($request->data as $entry) |
|
| 576 | 576 | { |
| 577 | - if( isset( $entry->id ) ) { |
|
| 577 | + if (isset($entry->id)) { |
|
| 578 | 578 | $ids[] = $entry->id; |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - $manager->deleteItems( $ids ); |
|
| 583 | - $view->total = count( $ids ); |
|
| 582 | + $manager->deleteItems($ids); |
|
| 583 | + $view->total = count($ids); |
|
| 584 | 584 | } |
| 585 | 585 | else |
| 586 | 586 | { |
| 587 | - $manager->deleteItem( $id ); |
|
| 587 | + $manager->deleteItem($id); |
|
| 588 | 588 | $view->total = 1; |
| 589 | 589 | } |
| 590 | 590 | |
@@ -610,11 +610,11 @@ discard block |
||
| 610 | 610 | * @param array $params List of criteria data with condition, sorting and paging |
| 611 | 611 | * @return \Aimeos\MW\Criteria\Iface Initialized criteria object |
| 612 | 612 | */ |
| 613 | - protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
| 613 | + protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
| 614 | 614 | { |
| 615 | - $this->initCriteriaConditions( $criteria, $params ); |
|
| 616 | - $this->initCriteriaSortations( $criteria, $params ); |
|
| 617 | - $this->initCriteriaSlice( $criteria, $params ); |
|
| 615 | + $this->initCriteriaConditions($criteria, $params); |
|
| 616 | + $this->initCriteriaSortations($criteria, $params); |
|
| 617 | + $this->initCriteriaSlice($criteria, $params); |
|
| 618 | 618 | |
| 619 | 619 | return $criteria; |
| 620 | 620 | } |
@@ -626,15 +626,15 @@ discard block |
||
| 626 | 626 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
| 627 | 627 | * @param array $params List of criteria data with condition, sorting and paging |
| 628 | 628 | */ |
| 629 | - private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
| 629 | + private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
| 630 | 630 | { |
| 631 | - if( isset( $params['filter'] ) && is_array( $params['filter'] ) ) |
|
| 631 | + if (isset($params['filter']) && is_array($params['filter'])) |
|
| 632 | 632 | { |
| 633 | 633 | $existing = $criteria->getConditions(); |
| 634 | - $criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) ); |
|
| 634 | + $criteria->setConditions($criteria->toConditions((array) $params['filter'])); |
|
| 635 | 635 | |
| 636 | - $expr = array( $criteria->getConditions(), $existing ); |
|
| 637 | - $criteria->setConditions( $criteria->combine( '&&', $expr ) ); |
|
| 636 | + $expr = array($criteria->getConditions(), $existing); |
|
| 637 | + $criteria->setConditions($criteria->combine('&&', $expr)); |
|
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | |
@@ -645,12 +645,12 @@ discard block |
||
| 645 | 645 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
| 646 | 646 | * @param array $params List of criteria data with condition, sorting and paging |
| 647 | 647 | */ |
| 648 | - private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
| 648 | + private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
| 649 | 649 | { |
| 650 | - $start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 ); |
|
| 651 | - $size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 25 ); |
|
| 650 | + $start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0); |
|
| 651 | + $size = (isset($params['page']['limit']) ? $params['page']['limit'] : 25); |
|
| 652 | 652 | |
| 653 | - $criteria->setSlice( $start, $size ); |
|
| 653 | + $criteria->setSlice($start, $size); |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | |
@@ -660,24 +660,24 @@ discard block |
||
| 660 | 660 | * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object |
| 661 | 661 | * @param array $params List of criteria data with condition, sorting and paging |
| 662 | 662 | */ |
| 663 | - private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params ) |
|
| 663 | + private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params) |
|
| 664 | 664 | { |
| 665 | - if( !isset( $params['sort'] ) ) { |
|
| 665 | + if (!isset($params['sort'])) { |
|
| 666 | 666 | return; |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | $sortation = array(); |
| 670 | 670 | |
| 671 | - foreach( explode( ',', $params['sort'] ) as $sort ) |
|
| 671 | + foreach (explode(',', $params['sort']) as $sort) |
|
| 672 | 672 | { |
| 673 | - if( $sort[0] === '-' ) { |
|
| 674 | - $sortation[] = $criteria->sort( '-', substr( $sort, 1 ) ); |
|
| 673 | + if ($sort[0] === '-') { |
|
| 674 | + $sortation[] = $criteria->sort('-', substr($sort, 1)); |
|
| 675 | 675 | } else { |
| 676 | - $sortation[] = $criteria->sort( '+', $sort ); break; |
|
| 676 | + $sortation[] = $criteria->sort('+', $sort); break; |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | - $criteria->setSortations( $sortation ); |
|
| 680 | + $criteria->setSortations($sortation); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | * @param array $include List of resource types that should be fetched |
| 689 | 689 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 690 | 690 | */ |
| 691 | - protected function getChildItems( array $items, array $include ) |
|
| 691 | + protected function getChildItems(array $items, array $include) |
|
| 692 | 692 | { |
| 693 | 693 | return array(); |
| 694 | 694 | } |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | * @param array $include List of resource types that should be fetched |
| 702 | 702 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 703 | 703 | */ |
| 704 | - protected function getListItems( array $items, array $include ) |
|
| 704 | + protected function getListItems(array $items, array $include) |
|
| 705 | 705 | { |
| 706 | 706 | return array(); |
| 707 | 707 | } |
@@ -713,22 +713,22 @@ discard block |
||
| 713 | 713 | * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 714 | 714 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 715 | 715 | */ |
| 716 | - protected function getRefItems( array $listItems ) |
|
| 716 | + protected function getRefItems(array $listItems) |
|
| 717 | 717 | { |
| 718 | 718 | $list = $map = array(); |
| 719 | 719 | |
| 720 | - foreach( $listItems as $listItem ) { |
|
| 720 | + foreach ($listItems as $listItem) { |
|
| 721 | 721 | $map[$listItem->getDomain()][] = $listItem->getRefId(); |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - foreach( $map as $domain => $ids ) |
|
| 724 | + foreach ($map as $domain => $ids) |
|
| 725 | 725 | { |
| 726 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain ); |
|
| 726 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain); |
|
| 727 | 727 | |
| 728 | 728 | $search = $manager->createSearch(); |
| 729 | - $search->setConditions( $search->compare( '==', $domain . '.id', $ids ) ); |
|
| 729 | + $search->setConditions($search->compare('==', $domain . '.id', $ids)); |
|
| 730 | 730 | |
| 731 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 731 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | return $list; |
@@ -777,30 +777,30 @@ discard block |
||
| 777 | 777 | * @throws \Aimeos\Admin\JsonAdm\Exception If "id" parameter isn't available or the body is invalid |
| 778 | 778 | * @return \Aimeos\MW\View\Iface Updated view instance |
| 779 | 779 | */ |
| 780 | - protected function patchItems( \Aimeos\MW\View\Iface $view, $body, array &$header ) |
|
| 780 | + protected function patchItems(\Aimeos\MW\View\Iface $view, $body, array &$header) |
|
| 781 | 781 | { |
| 782 | - if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) { |
|
| 783 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); |
|
| 782 | + if (($request = json_decode($body)) === null || !isset($request->data)) { |
|
| 783 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() ); |
|
| 786 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath()); |
|
| 787 | 787 | |
| 788 | - if( is_array( $request->data ) ) |
|
| 788 | + if (is_array($request->data)) |
|
| 789 | 789 | { |
| 790 | - $data = $this->saveData( $manager, $request ); |
|
| 790 | + $data = $this->saveData($manager, $request); |
|
| 791 | 791 | |
| 792 | 792 | $view->data = $data; |
| 793 | - $view->total = count( $data ); |
|
| 793 | + $view->total = count($data); |
|
| 794 | 794 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
| 795 | 795 | } |
| 796 | 796 | else |
| 797 | 797 | { |
| 798 | - if( ( $id = $view->param( 'id' ) ) == null ) { |
|
| 799 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
|
| 798 | + if (($id = $view->param('id')) == null) { |
|
| 799 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | $request->data->id = $id; |
| 803 | - $data = $this->saveEntry( $manager, $request->data ); |
|
| 803 | + $data = $this->saveEntry($manager, $request->data); |
|
| 804 | 804 | |
| 805 | 805 | $view->data = $data; |
| 806 | 806 | $view->total = 1; |
@@ -818,31 +818,31 @@ discard block |
||
| 818 | 818 | * @param array &$header Associative list of HTTP headers as value/result parameter |
| 819 | 819 | * @return \Aimeos\MW\View\Iface Updated view instance |
| 820 | 820 | */ |
| 821 | - protected function postItems( \Aimeos\MW\View\Iface $view, $body, array &$header ) |
|
| 821 | + protected function postItems(\Aimeos\MW\View\Iface $view, $body, array &$header) |
|
| 822 | 822 | { |
| 823 | - if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) { |
|
| 824 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 ); |
|
| 823 | + if (($request = json_decode($body)) === null || !isset($request->data)) { |
|
| 824 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | - if( isset( $request->data->id ) || $view->param( 'id' ) != null ) { |
|
| 828 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Client generated IDs are not supported' ), 403 ); |
|
| 827 | + if (isset($request->data->id) || $view->param('id') != null) { |
|
| 828 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Client generated IDs are not supported'), 403); |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | |
| 832 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $this->getPath() ); |
|
| 832 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $this->getPath()); |
|
| 833 | 833 | |
| 834 | - if( is_array( $request->data ) ) |
|
| 834 | + if (is_array($request->data)) |
|
| 835 | 835 | { |
| 836 | - $data = $this->saveData( $manager, $request ); |
|
| 836 | + $data = $this->saveData($manager, $request); |
|
| 837 | 837 | |
| 838 | 838 | $view->data = $data; |
| 839 | - $view->total = count( $data ); |
|
| 839 | + $view->total = count($data); |
|
| 840 | 840 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
| 841 | 841 | } |
| 842 | 842 | else |
| 843 | 843 | { |
| 844 | 844 | $request->data->id = null; |
| 845 | - $data = $this->saveEntry( $manager, $request->data ); |
|
| 845 | + $data = $this->saveEntry($manager, $request->data); |
|
| 846 | 846 | |
| 847 | 847 | $view->data = $data; |
| 848 | 848 | $view->total = 1; |
@@ -859,14 +859,14 @@ discard block |
||
| 859 | 859 | * @param \stdClass $request Object with request body data |
| 860 | 860 | * @return array List of items |
| 861 | 861 | */ |
| 862 | - protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) |
|
| 862 | + protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request) |
|
| 863 | 863 | { |
| 864 | 864 | $data = array(); |
| 865 | 865 | |
| 866 | - if( isset( $request->data ) ) |
|
| 866 | + if (isset($request->data)) |
|
| 867 | 867 | { |
| 868 | - foreach( (array) $request->data as $entry ) { |
|
| 869 | - $data[] = $this->saveEntry( $manager, $entry ); |
|
| 868 | + foreach ((array) $request->data as $entry) { |
|
| 869 | + $data[] = $this->saveEntry($manager, $entry); |
|
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | |
@@ -881,19 +881,19 @@ discard block |
||
| 881 | 881 | * @param \stdClass $entry Object including "id" and "attributes" elements |
| 882 | 882 | * @return \Aimeos\MShop\Common\Item\Iface New or updated item |
| 883 | 883 | */ |
| 884 | - protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry ) |
|
| 884 | + protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry) |
|
| 885 | 885 | { |
| 886 | - $attr = ( isset( $entry->attributes ) ? (array) $entry->attributes : array() ); |
|
| 886 | + $attr = (isset($entry->attributes) ? (array) $entry->attributes : array()); |
|
| 887 | 887 | |
| 888 | - if( isset( $entry->id ) && $entry->id !== null ) { |
|
| 889 | - $item = $manager->getItem( $entry->id ); |
|
| 888 | + if (isset($entry->id) && $entry->id !== null) { |
|
| 889 | + $item = $manager->getItem($entry->id); |
|
| 890 | 890 | } else { |
| 891 | 891 | $item = $manager->createItem(); |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | - $item->fromArray( $attr ); |
|
| 895 | - $manager->saveItem( $item ); |
|
| 894 | + $item->fromArray($attr); |
|
| 895 | + $manager->saveItem($item); |
|
| 896 | 896 | |
| 897 | - return $manager->getItem( $item->getId() ); |
|
| 897 | + return $manager->getItem($item->getId()); |
|
| 898 | 898 | } |
| 899 | 899 | } |
@@ -61,32 +61,28 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $view = $this->deleteItems( $view, $body ); |
| 63 | 63 | $status = 200; |
| 64 | - } |
|
| 65 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 64 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 66 | 65 | { |
| 67 | 66 | $status = $e->getCode(); |
| 68 | 67 | $view->errors = array( array( |
| 69 | 68 | 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 70 | 69 | 'detail' => $e->getTraceAsString(), |
| 71 | 70 | ) ); |
| 72 | - } |
|
| 73 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 71 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
| 74 | 72 | { |
| 75 | 73 | $status = 404; |
| 76 | 74 | $view->errors = array( array( |
| 77 | 75 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 78 | 76 | 'detail' => $e->getTraceAsString(), |
| 79 | 77 | ) ); |
| 80 | - } |
|
| 81 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 78 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 82 | 79 | { |
| 83 | 80 | $status = 404; |
| 84 | 81 | $view->errors = array( array( |
| 85 | 82 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 86 | 83 | 'detail' => $e->getTraceAsString(), |
| 87 | 84 | ) ); |
| 88 | - } |
|
| 89 | - catch( \Exception $e ) |
|
| 85 | + } catch( \Exception $e ) |
|
| 90 | 86 | { |
| 91 | 87 | $status = 500; |
| 92 | 88 | $view->errors = array( array( |
@@ -152,8 +148,7 @@ discard block |
||
| 152 | 148 | $view->data = $manager->searchItems( $search, array(), $total ); |
| 153 | 149 | $view->childItems = $this->getChildItems( $view->data, $include ); |
| 154 | 150 | $view->listItems = $this->getListItems( $view->data, $include ); |
| 155 | - } |
|
| 156 | - else |
|
| 151 | + } else |
|
| 157 | 152 | { |
| 158 | 153 | $view->data = $manager->getItem( $id, array() ); |
| 159 | 154 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -164,24 +159,21 @@ discard block |
||
| 164 | 159 | |
| 165 | 160 | $view->total = $total; |
| 166 | 161 | $status = 200; |
| 167 | - } |
|
| 168 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 162 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
| 169 | 163 | { |
| 170 | 164 | $status = 404; |
| 171 | 165 | $view->errors = array( array( |
| 172 | 166 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 173 | 167 | 'detail' => $e->getTraceAsString(), |
| 174 | 168 | ) ); |
| 175 | - } |
|
| 176 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 169 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 177 | 170 | { |
| 178 | 171 | $status = 404; |
| 179 | 172 | $view->errors = array( array( |
| 180 | 173 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 181 | 174 | 'detail' => $e->getTraceAsString(), |
| 182 | 175 | ) ); |
| 183 | - } |
|
| 184 | - catch( \Exception $e ) |
|
| 176 | + } catch( \Exception $e ) |
|
| 185 | 177 | { |
| 186 | 178 | $status = 500; |
| 187 | 179 | $view->errors = array( array( |
@@ -239,32 +231,28 @@ discard block |
||
| 239 | 231 | { |
| 240 | 232 | $view = $this->patchItems( $view, $body, $header ); |
| 241 | 233 | $status = 200; |
| 242 | - } |
|
| 243 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 234 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 244 | 235 | { |
| 245 | 236 | $status = $e->getCode(); |
| 246 | 237 | $view->errors = array( array( |
| 247 | 238 | 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 248 | 239 | 'detail' => $e->getTraceAsString(), |
| 249 | 240 | ) ); |
| 250 | - } |
|
| 251 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 241 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
| 252 | 242 | { |
| 253 | 243 | $status = 404; |
| 254 | 244 | $view->errors = array( array( |
| 255 | 245 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 256 | 246 | 'detail' => $e->getTraceAsString(), |
| 257 | 247 | ) ); |
| 258 | - } |
|
| 259 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 248 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 260 | 249 | { |
| 261 | 250 | $status = 404; |
| 262 | 251 | $view->errors = array( array( |
| 263 | 252 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 264 | 253 | 'detail' => $e->getTraceAsString(), |
| 265 | 254 | ) ); |
| 266 | - } |
|
| 267 | - catch( \Aimeos\MW\Exception $e ) |
|
| 255 | + } catch( \Aimeos\MW\Exception $e ) |
|
| 268 | 256 | { |
| 269 | 257 | $status = 500; |
| 270 | 258 | $view->errors = array( array( |
@@ -322,32 +310,28 @@ discard block |
||
| 322 | 310 | { |
| 323 | 311 | $view = $this->postItems( $view, $body, $header ); |
| 324 | 312 | $status = 201; |
| 325 | - } |
|
| 326 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 313 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 327 | 314 | { |
| 328 | 315 | $status = $e->getCode(); |
| 329 | 316 | $view->errors = array( array( |
| 330 | 317 | 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 331 | 318 | 'detail' => $e->getTraceAsString(), |
| 332 | 319 | ) ); |
| 333 | - } |
|
| 334 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 320 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
| 335 | 321 | { |
| 336 | 322 | $status = 404; |
| 337 | 323 | $view->errors = array( array( |
| 338 | 324 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 339 | 325 | 'detail' => $e->getTraceAsString(), |
| 340 | 326 | ) ); |
| 341 | - } |
|
| 342 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 327 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 343 | 328 | { |
| 344 | 329 | $status = 404; |
| 345 | 330 | $view->errors = array( array( |
| 346 | 331 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 347 | 332 | 'detail' => $e->getTraceAsString(), |
| 348 | 333 | ) ); |
| 349 | - } |
|
| 350 | - catch( \Exception $e ) |
|
| 334 | + } catch( \Exception $e ) |
|
| 351 | 335 | { |
| 352 | 336 | $status = 500; |
| 353 | 337 | $view->errors = array( array( |
@@ -495,24 +479,21 @@ discard block |
||
| 495 | 479 | 'Allow' => 'DELETE,GET,POST,OPTIONS' |
| 496 | 480 | ); |
| 497 | 481 | $status = 200; |
| 498 | - } |
|
| 499 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
| 482 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
| 500 | 483 | { |
| 501 | 484 | $status = 404; |
| 502 | 485 | $view->errors = array( array( |
| 503 | 486 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 504 | 487 | 'detail' => $e->getTraceAsString(), |
| 505 | 488 | ) ); |
| 506 | - } |
|
| 507 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 489 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 508 | 490 | { |
| 509 | 491 | $status = 404; |
| 510 | 492 | $view->errors = array( array( |
| 511 | 493 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 512 | 494 | 'detail' => $e->getTraceAsString(), |
| 513 | 495 | ) ); |
| 514 | - } |
|
| 515 | - catch( \Exception $e ) |
|
| 496 | + } catch( \Exception $e ) |
|
| 516 | 497 | { |
| 517 | 498 | $status = 500; |
| 518 | 499 | $view->errors = array( array( |
@@ -581,8 +562,7 @@ discard block |
||
| 581 | 562 | |
| 582 | 563 | $manager->deleteItems( $ids ); |
| 583 | 564 | $view->total = count( $ids ); |
| 584 | - } |
|
| 585 | - else |
|
| 565 | + } else |
|
| 586 | 566 | { |
| 587 | 567 | $manager->deleteItem( $id ); |
| 588 | 568 | $view->total = 1; |
@@ -792,8 +772,7 @@ discard block |
||
| 792 | 772 | $view->data = $data; |
| 793 | 773 | $view->total = count( $data ); |
| 794 | 774 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
| 795 | - } |
|
| 796 | - else |
|
| 775 | + } else |
|
| 797 | 776 | { |
| 798 | 777 | if( ( $id = $view->param( 'id' ) ) == null ) { |
| 799 | 778 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
@@ -838,8 +817,7 @@ discard block |
||
| 838 | 817 | $view->data = $data; |
| 839 | 818 | $view->total = count( $data ); |
| 840 | 819 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
| 841 | - } |
|
| 842 | - else |
|
| 820 | + } else |
|
| 843 | 821 | { |
| 844 | 822 | $request->data->id = null; |
| 845 | 823 | $data = $this->saveEntry( $manager, $request->data ); |