protected function getRoutes(): array
    {
        $routes = [];

        foreach ($this->routes as $route) {
            if (($routeInfo = $this->getRouteInformation($route)) !== null) {
                $routes[] = $routeInfo;
            }
        }

        if ($sort = $this->option('sort')) {
            $routes = self::sort($routes, static function ($route) use ($sort) {
                return $route[$sort];
            });
        }

        if ($this->option('reverse')) {
            $routes = \array_reverse($routes);
        }

        return \array_filter($routes);
    }