| 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; |
||
| 38 | public function validate() |
||
| 39 | { |
||
| 40 | $data = input('option'); |
||
| 41 | if (! $data || ! is_array($data)) { |
||
| 42 | return Response::make('Error', 422); |
||
| 43 | } |
||
| 44 | |||
| 45 | try { |
||
| 46 | $option = new Option($data); |
||
| 47 | $option->validate(); |
||
| 48 | } catch (Exception $e) { |
||
| 49 | return Response::make($e->getMessage(), 400); |
||
| 50 | } |
||
| 51 | |||
| 52 | return Response::make($option, 200); |
||
| 53 | } |
||
| 54 | } |
||
| 55 |