src/Valkyrja/Routing/Commands/RoutesListCommand.php
protected function setRoute(Route $route, array &$routes, array &$lengths): void
    {
        $requestMethod = implode(' | ', $route->getRequestMethods());
        $dispatch      = 'Closure';

        if (null !== $route->getFunction()) {
            $dispatch = $route->getFunction();
        } elseif (null !== $route->getClass()) {
            $dispatch = $route->getClass()
                . ($route->isStatic() ? '::' : '->')
                . ($route->getMethod()
                    ? $route->getMethod() . '()'
                    : $route->getProperty());
        }

        $lengths[0] = max($lengths[0], \strlen($requestMethod));
        $lengths[1] = max($lengths[1], \strlen($route->getPath()));
        $lengths[2] = max($lengths[2], \strlen($route->getName()));
        $lengths[3] = max($lengths[3], \strlen($dispatch));

        $routes[] = [
            $requestMethod,
            $route->getPath(),
            $route->getName() ?? '',
            $dispatch,
        ];
    }
protected function setRoute(Route $route, array &$routes, array &$lengths): void
    {
        $requestMethod = implode(' | ', $route->getRequestMethods());
        $dispatch      = 'Closure';

        if (null !== $route->getFunction()) {
            $dispatch = $route->getFunction();
        } elseif (null !== $route->getClass()) {
            $dispatch = $route->getClass()
                . ($route->isStatic() ? '::' : '->')
                . ($route->getMethod()
                    ? $route->getMethod() . '()'
                    : $route->getProperty());
        }

        $lengths[0] = max($lengths[0], \strlen($requestMethod));
        $lengths[1] = max($lengths[1], \strlen($route->getPath()));
        $lengths[2] = max($lengths[2], \strlen($route->getName()));
        $lengths[3] = max($lengths[3], \strlen($dispatch));

        $routes[] = [
            $requestMethod,
            $route->getPath(),
            $route->getName() ?? '',
            $dispatch,
        ];
    }
Set a route as an array from a route object.

@param Route $route   The route object
@param array $routes  The flat routes
@param array $lengths The longest string lengths

@throws \InvalidArgumentException

@return void