@@ 18-41 (lines=24) @@ | ||
15 | * |
|
16 | * @return array |
|
17 | */ |
|
18 | public function processRoute(Route $route, $bindings = []) |
|
19 | { |
|
20 | $response = $this->getRouteResponse($route, $bindings); |
|
21 | ||
22 | $routeAction = $route->getAction(); |
|
23 | $routeGroup = $this->getRouteGroup($routeAction['uses']); |
|
24 | $routeDescription = $this->getRouteDescription($routeAction['uses']); |
|
25 | ||
26 | if ($response->headers->get('Content-Type') === 'application/json') { |
|
27 | $content = json_encode(json_decode($response->getContent()), JSON_PRETTY_PRINT); |
|
28 | } else { |
|
29 | $content = $response->getContent(); |
|
30 | } |
|
31 | ||
32 | return $this->getParameters([ |
|
33 | 'resource' => $routeGroup, |
|
34 | 'title' => $routeDescription['short'], |
|
35 | 'description' => $routeDescription['long'], |
|
36 | 'methods' => $route->getMethods(), |
|
37 | 'uri' => $route->getUri(), |
|
38 | 'parameters' => [], |
|
39 | 'response' => $content, |
|
40 | ], $routeAction); |
|
41 | } |
|
42 | ||
43 | ||
44 | /** |
@@ 27-50 (lines=24) @@ | ||
24 | * |
|
25 | * @return array |
|
26 | */ |
|
27 | public function processRoute(Route $route, $bindings = []) |
|
28 | { |
|
29 | $response = $this->getRouteResponse($route, $bindings); |
|
30 | ||
31 | $routeAction = $route->getAction(); |
|
32 | $routeGroup = $this->getRouteGroup($routeAction['uses']); |
|
33 | $routeDescription = $this->getRouteDescription($routeAction['uses']); |
|
34 | ||
35 | if ($response->headers->get('Content-Type') === 'application/json') { |
|
36 | $content = json_encode(json_decode($response->getContent()), JSON_PRETTY_PRINT); |
|
37 | } else { |
|
38 | $content = $response->getContent(); |
|
39 | } |
|
40 | ||
41 | return $this->getParameters([ |
|
42 | 'resource' => $routeGroup, |
|
43 | 'title' => $routeDescription['short'], |
|
44 | 'description' => $routeDescription['long'], |
|
45 | 'methods' => $route->getMethods(), |
|
46 | 'uri' => $route->getUri(), |
|
47 | 'parameters' => [], |
|
48 | 'response' => $content, |
|
49 | ], $routeAction); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * Call the given URI and return the Response. |