@@ -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 | } |
@@ -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( |
@@ -143,24 +139,21 @@ discard block |
||
143 | 139 | { |
144 | 140 | $view = $this->getItem( $view ); |
145 | 141 | $status = 200; |
146 | - } |
|
147 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
142 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
148 | 143 | { |
149 | 144 | $status = 404; |
150 | 145 | $view->errors = array( array( |
151 | 146 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
152 | 147 | 'detail' => $e->getTraceAsString(), |
153 | 148 | ) ); |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 150 | { |
157 | 151 | $status = 404; |
158 | 152 | $view->errors = array( array( |
159 | 153 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
160 | 154 | 'detail' => $e->getTraceAsString(), |
161 | 155 | ) ); |
162 | - } |
|
163 | - catch( \Exception $e ) |
|
156 | + } catch( \Exception $e ) |
|
164 | 157 | { |
165 | 158 | $status = 500; |
166 | 159 | $view->errors = array( array( |
@@ -218,32 +211,28 @@ discard block |
||
218 | 211 | { |
219 | 212 | $view = $this->patchItems( $view, $body, $header ); |
220 | 213 | $status = 200; |
221 | - } |
|
222 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
214 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
223 | 215 | { |
224 | 216 | $status = $e->getCode(); |
225 | 217 | $view->errors = array( array( |
226 | 218 | 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
227 | 219 | 'detail' => $e->getTraceAsString(), |
228 | 220 | ) ); |
229 | - } |
|
230 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
221 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
231 | 222 | { |
232 | 223 | $status = 404; |
233 | 224 | $view->errors = array( array( |
234 | 225 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
235 | 226 | 'detail' => $e->getTraceAsString(), |
236 | 227 | ) ); |
237 | - } |
|
238 | - catch( \Aimeos\MShop\Exception $e ) |
|
228 | + } catch( \Aimeos\MShop\Exception $e ) |
|
239 | 229 | { |
240 | 230 | $status = 404; |
241 | 231 | $view->errors = array( array( |
242 | 232 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
243 | 233 | 'detail' => $e->getTraceAsString(), |
244 | 234 | ) ); |
245 | - } |
|
246 | - catch( \Exception $e ) |
|
235 | + } catch( \Exception $e ) |
|
247 | 236 | { |
248 | 237 | $status = 500; |
249 | 238 | $view->errors = array( array( |
@@ -301,32 +290,28 @@ discard block |
||
301 | 290 | { |
302 | 291 | $view = $this->postItems( $view, $body, $header ); |
303 | 292 | $status = 201; |
304 | - } |
|
305 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
293 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
306 | 294 | { |
307 | 295 | $status = $e->getCode(); |
308 | 296 | $view->errors = array( array( |
309 | 297 | 'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
310 | 298 | 'detail' => $e->getTraceAsString(), |
311 | 299 | ) ); |
312 | - } |
|
313 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
300 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
314 | 301 | { |
315 | 302 | $status = 404; |
316 | 303 | $view->errors = array( array( |
317 | 304 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
318 | 305 | 'detail' => $e->getTraceAsString(), |
319 | 306 | ) ); |
320 | - } |
|
321 | - catch( \Aimeos\MShop\Exception $e ) |
|
307 | + } catch( \Aimeos\MShop\Exception $e ) |
|
322 | 308 | { |
323 | 309 | $status = 404; |
324 | 310 | $view->errors = array( array( |
325 | 311 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
326 | 312 | 'detail' => $e->getTraceAsString(), |
327 | 313 | ) ); |
328 | - } |
|
329 | - catch( \Exception $e ) |
|
314 | + } catch( \Exception $e ) |
|
330 | 315 | { |
331 | 316 | $status = 500; |
332 | 317 | $view->errors = array( array( |
@@ -449,24 +434,21 @@ discard block |
||
449 | 434 | 'Allow' => 'DELETE,GET,POST,OPTIONS' |
450 | 435 | ); |
451 | 436 | $status = 200; |
452 | - } |
|
453 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
437 | + } catch( \Aimeos\MAdmin\Exception $e ) |
|
454 | 438 | { |
455 | 439 | $status = 404; |
456 | 440 | $view->errors = array( array( |
457 | 441 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
458 | 442 | 'detail' => $e->getTraceAsString(), |
459 | 443 | ) ); |
460 | - } |
|
461 | - catch( \Aimeos\MShop\Exception $e ) |
|
444 | + } catch( \Aimeos\MShop\Exception $e ) |
|
462 | 445 | { |
463 | 446 | $status = 404; |
464 | 447 | $view->errors = array( array( |
465 | 448 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
466 | 449 | 'detail' => $e->getTraceAsString(), |
467 | 450 | ) ); |
468 | - } |
|
469 | - catch( \Exception $e ) |
|
451 | + } catch( \Exception $e ) |
|
470 | 452 | { |
471 | 453 | $status = 500; |
472 | 454 | $view->errors = array( array( |
@@ -535,8 +517,7 @@ discard block |
||
535 | 517 | |
536 | 518 | $manager->deleteItems( $ids ); |
537 | 519 | $view->total = count( $ids ); |
538 | - } |
|
539 | - else |
|
520 | + } else |
|
540 | 521 | { |
541 | 522 | $manager->deleteItem( $id ); |
542 | 523 | $view->total = 1; |
@@ -564,8 +545,7 @@ discard block |
||
564 | 545 | $view->data = $manager->searchItems( $search, array(), $total ); |
565 | 546 | $view->childItems = $this->getChildItems( $view->data, $include ); |
566 | 547 | $view->listItems = $this->getListItems( $view->data, $include ); |
567 | - } |
|
568 | - else |
|
548 | + } else |
|
569 | 549 | { |
570 | 550 | $view->data = $manager->getItem( $id, array() ); |
571 | 551 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -816,8 +796,7 @@ discard block |
||
816 | 796 | $view->data = $data; |
817 | 797 | $view->total = count( $data ); |
818 | 798 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
819 | - } |
|
820 | - else |
|
799 | + } else |
|
821 | 800 | { |
822 | 801 | if( ( $id = $view->param( 'id' ) ) == null ) { |
823 | 802 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
@@ -862,8 +841,7 @@ discard block |
||
862 | 841 | $view->data = $data; |
863 | 842 | $view->total = count( $data ); |
864 | 843 | $header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"'; |
865 | - } |
|
866 | - else |
|
844 | + } else |
|
867 | 845 | { |
868 | 846 | $request->data->id = null; |
869 | 847 | $data = $this->saveEntry( $manager, $request->data ); |