| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Bedard\Shop\Controllers; |
||
| 19 | public function validate() |
||
| 20 | { |
||
| 21 | $data = input('option'); |
||
| 22 | if (!$data || !is_array($data)) { |
||
| 23 | return Response::make('Error', 422); |
||
| 24 | } |
||
| 25 | |||
| 26 | try { |
||
| 27 | $option = new Option($data); |
||
| 28 | $option->validate(); |
||
| 29 | } catch (Exception $e) { |
||
| 30 | return Response::make($e->getMessage(), 400); |
||
| 31 | } |
||
| 32 | |||
| 33 | return Response::make($option, 200); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |