119 lines
3.4 KiB
PHP
119 lines
3.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Slim Framework (https://slimframework.com)
|
|
*
|
|
* @license https://github.com/slimphp/Slim/blob/4.x/LICENSE.md (MIT License)
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Slim\Interfaces;
|
|
|
|
use Psr\Container\ContainerInterface;
|
|
use Psr\Http\Message\ResponseFactoryInterface;
|
|
use Psr\Http\Message\UriInterface;
|
|
|
|
interface RouteCollectorProxyInterface
|
|
{
|
|
public function getResponseFactory(): ResponseFactoryInterface;
|
|
|
|
public function getCallableResolver(): CallableResolverInterface;
|
|
|
|
public function getContainer(): ?ContainerInterface;
|
|
|
|
public function getRouteCollector(): RouteCollectorInterface;
|
|
|
|
/**
|
|
* Get the RouteCollectorProxy's base path
|
|
*/
|
|
public function getBasePath(): string;
|
|
|
|
/**
|
|
* Set the RouteCollectorProxy's base path
|
|
*/
|
|
public function setBasePath(string $basePath): RouteCollectorProxyInterface;
|
|
|
|
/**
|
|
* Add GET route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function get(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add POST route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function post(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add PUT route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function put(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add PATCH route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function patch(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add DELETE route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function delete(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add OPTIONS route
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function options(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add route for any HTTP method
|
|
*
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function any(string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Add route with multiple methods
|
|
*
|
|
* @param string[] $methods Numeric array of HTTP method names
|
|
* @param string $pattern The route URI pattern
|
|
* @param callable|string $callable The route callback routine
|
|
*/
|
|
public function map(array $methods, string $pattern, $callable): RouteInterface;
|
|
|
|
/**
|
|
* Route Groups
|
|
*
|
|
* This method accepts a route pattern and a callback. All route
|
|
* declarations in the callback will be prepended by the group(s)
|
|
* that it is in.
|
|
* @param string|callable $callable
|
|
*/
|
|
public function group(string $pattern, $callable): RouteGroupInterface;
|
|
|
|
/**
|
|
* Add a route that sends an HTTP redirect
|
|
*
|
|
* @param string|UriInterface $to
|
|
*/
|
|
public function redirect(string $from, $to, int $status = 302): RouteInterface;
|
|
}
|