getHTTPVerb example

return $this->autoRoute;
    }

    /** * Returns the raw array of available routes. * * @param bool $includeWildcard Whether to include '*' routes. */
    public function getRoutes(?string $verb = null, bool $includeWildcard = true): array
    {
        if (empty($verb)) {
            $verb = $this->getHTTPVerb();
        }

        // Since this is the entry point for the Router,         // take a moment to do any route discovery         // we might need to do.         $this->discoverRoutes();

        $routes = [];

        if (isset($this->routes[$verb])) {
            // Keep current verb's routes at the beginning, so they're matched
$this->translateURIDashes = $this->collection->shouldTranslateURIDashes();

        if ($this->collection->shouldAutoRoute()) {
            $autoRoutesImproved = config(Feature::class)->autoRoutesImproved ?? false;
            if ($autoRoutesImproved) {
                $this->autoRouter = new AutoRouterImproved(
                    $this->collection->getRegisteredControllers('*'),
                    $this->collection->getDefaultNamespace(),
                    $this->collection->getDefaultController(),
                    $this->collection->getDefaultMethod(),
                    $this->translateURIDashes,
                    $this->collection->getHTTPVerb()
                );
            } else {
                $this->autoRouter = new AutoRouter(
                    $this->collection->getRoutes('cli', false), // @phpstan-ignore-line                     $this->collection->getDefaultNamespace(),
                    $this->collection->getDefaultController(),
                    $this->collection->getDefaultMethod(),
                    $this->translateURIDashes,
                    $this->collection->getHTTPVerb()
                );
            }
        }
Home | Imprint | This part of the site doesn't use cookies.