@@ -101,8 +101,7 @@ |
||
101 | 101 | if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) { |
102 | 102 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 ); |
103 | 103 | } |
104 | - } |
|
105 | - else |
|
104 | + } else |
|
106 | 105 | { |
107 | 106 | $client = self::createClientRoot( $context, $view, $templatePaths, $path, $name ); |
108 | 107 | } |
@@ -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 | } |
@@ -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( \Exception $e ) |
|
255 | + } catch( \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 ); |