src/Viserio/Component/HttpFoundation/DataCollector/ViserioHttpDataCollector.php
protected function getRouteInformation(RouteContract $route): array
    {
        $routesPath = \realpath($this->routeDirPath);
        $action     = $route->getAction();
        $reflector  = null;

        $result = [
            'uri'     => $route->getUri() ?: '-',
            'methods' => \count($route->getMethods()) > 1 ?
                 \implode(' | ', $route->getMethods()) :
                 $route->getMethods()[0],
        ];

        $result = \array_merge($result, $action);

        if (isset($action['controller']) && \mb_strpos($action['controller'], '@') !== false) {
            [$controller, $method] = \explode('@', $action['controller']);

            if (\class_exists($controller) && \method_exists($controller, $method)) {
                $reflector = new ReflectionMethod($controller, $method);
            }

            unset($result['uses']);
        } elseif (isset($action['uses']) && $action['uses'] instanceof Closure) {
            $reflector      = new ReflectionFunction($action['uses']);
            $result['uses'] = $this->cloneVar($result['uses']);
        }

        if ($reflector !== null) {
            $filename       = \ltrim(\str_replace($routesPath, '', $reflector->getFileName()), '/');
            $result['file'] = $filename . ': ' . $reflector->getStartLine() . ' - ' . $reflector->getEndLine();
        }

        $result['middleware']         = \implode(', ', $route->gatherMiddleware());
        $result['without_middleware'] = \implode(', ', $route->gatherDisabledMiddleware());

        return $result;
    }
protected function getRouteInformation(RouteContract $route): array
    {
        $routesPath = \realpath($this->routeDirPath);
        $action     = $route->getAction();
        $reflector  = null;

        $result = [
            'uri'     => $route->getUri() ?: '-',
            'methods' => \count($route->getMethods()) > 1 ?
                 \implode(' | ', $route->getMethods()) :
                 $route->getMethods()[0],
        ];

        $result = \array_merge($result, $action);

        if (isset($action['controller']) && \mb_strpos($action['controller'], '@') !== false) {
            [$controller, $method] = \explode('@', $action['controller']);

            if (\class_exists($controller) && \method_exists($controller, $method)) {
                $reflector = new ReflectionMethod($controller, $method);
            }

            unset($result['uses']);
        } elseif (isset($action['uses']) && $action['uses'] instanceof Closure) {
            $reflector      = new ReflectionFunction($action['uses']);
            $result['uses'] = $this->cloneVar($result['uses']);
        }

        if ($reflector !== null) {
            $filename       = \ltrim(\str_replace($routesPath, '', $reflector->getFileName()), '/');
            $result['file'] = $filename . ': ' . $reflector->getStartLine() . ' - ' . $reflector->getEndLine();
        }

        $result['middleware']         = \implode(', ', $route->gatherMiddleware());
        $result['without_middleware'] = \implode(', ', $route->gatherDisabledMiddleware());

        return $result;
    }
Get the route information for a given route.

@param \Viserio\Component\Contract\Routing\Route $route

@return array