$methods HTTP method to accept; null indicates any. * @param null|non-empty-string $name The name of the route. */ public function route( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?array $methods = null, ?string $name = null ): Route { return $this->collector->route($path, $this->factory->prepare($middleware), $methods, $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function get( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->get($path, $this->factory->prepare($middleware), $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function post( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->post($path, $this->factory->prepare($middleware), $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function put( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->put($path, $this->factory->prepare($middleware), $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function patch( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->patch($path, $this->factory->prepare($middleware), $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function delete( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->delete($path, $this->factory->prepare($middleware), $name); } /** * @param non-empty-string $path * @param null|non-empty-string $name The name of the route. */ public function any( string $path, string|array|callable|MiddlewareInterface|RequestHandlerInterface $middleware, ?string $name = null ): Route { return $this->collector->route($path, $this->factory->prepare($middleware), null, $name); } /** * Retrieve all directly registered routes with the application. * * @return list */ public function getRoutes(): array { return $this->collector->getRoutes(); } }