| Conditions | 3 |
| Paths | 1 |
| Total Lines | 42 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 24 | public function getCollection() |
||
| 25 | { |
||
| 26 | $collection = [ |
||
| 27 | 'variables' => [], |
||
| 28 | 'info' => [ |
||
| 29 | 'name' => '', |
||
| 30 | '_postman_id' => Uuid::uuid1()->toString(), |
||
| 31 | 'description' => '', |
||
| 32 | 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json' |
||
| 33 | ], |
||
| 34 | 'item' => $this->routeGroups->map(function ($routes, $groupName) { |
||
| 35 | return [ |
||
| 36 | 'name' => $groupName, |
||
| 37 | 'description' => '', |
||
| 38 | 'item' => $routes->map(function ($route) { |
||
| 39 | return [ |
||
| 40 | 'name' => $route['title'] != '' ? $route['title'] : url($route['uri']), |
||
| 41 | 'request' => [ |
||
| 42 | 'url' => url($route['uri']), |
||
| 43 | 'method' => $route['methods'][0], |
||
| 44 | 'body' => [ |
||
| 45 | 'mode' => 'formdata', |
||
| 46 | 'formdata' => collect($route['parameters'])->map(function ($parameter, $key) { |
||
| 47 | return [ |
||
| 48 | 'key' => $key, |
||
| 49 | 'value' => isset($parameter['value']) ? $parameter['value'] : '', |
||
| 50 | 'type' => 'text', |
||
| 51 | 'enabled' => true |
||
| 52 | ]; |
||
| 53 | })->values()->toArray(), |
||
| 54 | ], |
||
| 55 | 'description' => $route['description'], |
||
| 56 | 'response' => [] |
||
| 57 | ] |
||
| 58 | ]; |
||
| 59 | })->toArray() |
||
| 60 | ]; |
||
| 61 | })->values()->toArray() |
||
| 62 | ]; |
||
| 63 | |||
| 64 | return json_encode($collection); |
||
| 65 | } |
||
| 66 | |||
| 67 | } |