[Routing] tagged the public @api

This commit is contained in:
Fabien Potencier 2011-06-14 15:35:32 +02:00
parent 59301a93d7
commit 72483f946b
16 changed files with 105 additions and 0 deletions

View File

@ -17,6 +17,8 @@ use Symfony\Component\Routing\RouteCollection;
* GeneratorDumperInterface is the interface that all generator dumper classes must implement.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
interface GeneratorDumperInterface
{

View File

@ -17,6 +17,8 @@ use Symfony\Component\Routing\Route;
* PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class PhpGeneratorDumper extends GeneratorDumper
{
@ -31,6 +33,8 @@ class PhpGeneratorDumper extends GeneratorDumper
* @param array $options An array of options
*
* @return string A PHP class representing the generator class
*
* @api
*/
public function dump(array $options = array())
{

View File

@ -22,6 +22,8 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
* UrlGenerator generates URL based on a set of routes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class UrlGenerator implements UrlGeneratorInterface
{
@ -35,6 +37,8 @@ class UrlGenerator implements UrlGeneratorInterface
*
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
*
* @api
*/
public function __construct(RouteCollection $routes, RequestContext $context)
{
@ -47,6 +51,8 @@ class UrlGenerator implements UrlGeneratorInterface
* Sets the request context.
*
* @param RequestContext $context The context
*
* @api
*/
public function setContext(RequestContext $context)
{
@ -73,6 +79,8 @@ class UrlGenerator implements UrlGeneratorInterface
* @return string The generated URL
*
* @throws Symfony\Component\Routing\Exception\RouteNotFoundException When route doesn't exist
*
* @api
*/
public function generate($name, array $parameters = array(), $absolute = false)
{

View File

@ -17,6 +17,8 @@ use Symfony\Component\Routing\RequestContextAwareInterface;
* UrlGeneratorInterface is the interface that all URL generator classes must implements.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
interface UrlGeneratorInterface extends RequestContextAwareInterface
{
@ -28,6 +30,8 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface
* @param Boolean $absolute Whether to generate an absolute URL
*
* @return string The generated URL
*
* @api
*/
function generate($name, array $parameters = array(), $absolute = false);
}

View File

@ -19,6 +19,8 @@ use Symfony\Component\Config\Loader\Loader;
* The Closure must return a RouteCollection instance.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class ClosureLoader extends Loader
{
@ -27,6 +29,8 @@ class ClosureLoader extends Loader
*
* @param \Closure $closure A Closure
* @param string $type The resource type
*
* @api
*/
public function load($closure, $type = null)
{
@ -40,6 +44,8 @@ class ClosureLoader extends Loader
* @param string $type The resource type
*
* @return Boolean True if this class supports the given resource, false otherwise
*
* @api
*/
public function supports($resource, $type = null)
{

View File

@ -20,6 +20,8 @@ use Symfony\Component\Config\Loader\FileLoader;
* The file must return a RouteCollection instance.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class PhpFileLoader extends FileLoader
{
@ -28,6 +30,8 @@ class PhpFileLoader extends FileLoader
*
* @param mixed $file A PHP file path
* @param string $type The resource type
*
* @api
*/
public function load($file, $type = null)
{
@ -50,6 +54,8 @@ class PhpFileLoader extends FileLoader
* @param string $type The resource type
*
* @return Boolean True if this class supports the given resource, false otherwise
*
* @api
*/
public function supports($resource, $type = null)
{

View File

@ -20,6 +20,8 @@ use Symfony\Component\Config\Loader\FileLoader;
* XmlFileLoader loads XML routing files.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class XmlFileLoader extends FileLoader
{
@ -32,6 +34,8 @@ class XmlFileLoader extends FileLoader
* @return RouteCollection A RouteCollection instance
*
* @throws \InvalidArgumentException When a tag can't be parsed
*
* @api
*/
public function load($file, $type = null)
{
@ -87,6 +91,8 @@ class XmlFileLoader extends FileLoader
* @param string $type The resource type
*
* @return Boolean True if this class supports the given resource, false otherwise
*
* @api
*/
public function supports($resource, $type = null)
{

View File

@ -21,6 +21,8 @@ use Symfony\Component\Config\Loader\FileLoader;
* YamlFileLoader loads Yaml routing files.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class YamlFileLoader extends FileLoader
{
@ -37,6 +39,8 @@ class YamlFileLoader extends FileLoader
* @return RouteCollection A RouteCollection instance
*
* @throws \InvalidArgumentException When route can't be parsed
*
* @api
*/
public function load($file, $type = null)
{
@ -80,6 +84,8 @@ class YamlFileLoader extends FileLoader
* @param string $type The resource type
*
* @return Boolean True if this class supports the given resource, false otherwise
*
* @api
*/
public function supports($resource, $type = null)
{

View File

@ -15,6 +15,8 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/**
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface
{
@ -22,6 +24,8 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
/**
* @see UrlMatcher::match()
*
* @api
*/
public function match($pathinfo)
{

View File

@ -15,6 +15,8 @@ namespace Symfony\Component\Routing\Matcher;
* RedirectableUrlMatcherInterface knows how to redirect the user.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
interface RedirectableUrlMatcherInterface
{
@ -26,6 +28,8 @@ interface RedirectableUrlMatcherInterface
* @param string $scheme The URL scheme (null to keep the current one)
*
* @return array An array of parameters
*
* @api
*/
function redirect($path, $route, $scheme = null);
}

View File

@ -21,6 +21,8 @@ use Symfony\Component\Routing\RequestContext;
* UrlMatcher matches URL based on a set of routes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class UrlMatcher implements UrlMatcherInterface
{
@ -33,6 +35,8 @@ class UrlMatcher implements UrlMatcherInterface
*
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
*
* @api
*/
public function __construct(RouteCollection $routes, RequestContext $context)
{
@ -44,6 +48,8 @@ class UrlMatcher implements UrlMatcherInterface
* Sets the request context.
*
* @param RequestContext $context The context
*
* @api
*/
public function setContext(RequestContext $context)
{
@ -69,6 +75,8 @@ class UrlMatcher implements UrlMatcherInterface
*
* @throws ResourceNotFoundException If the resource could not be found
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
*
* @api
*/
public function match($pathinfo)
{

View File

@ -17,6 +17,8 @@ use Symfony\Component\Routing\RequestContextAwareInterface;
* UrlMatcherInterface is the interface that all URL matcher classes must implement.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
interface UrlMatcherInterface extends RequestContextAwareInterface
{
@ -29,6 +31,8 @@ interface UrlMatcherInterface extends RequestContextAwareInterface
*
* @throws ResourceNotFoundException If the resource could not be found
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
*
* @api
*/
function match($pathinfo);
}

View File

@ -15,6 +15,8 @@ namespace Symfony\Component\Routing;
* Holds information about the current request.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class RequestContext
{
@ -35,6 +37,8 @@ class RequestContext
* @param string $scheme The HTTP scheme
* @param integer $httpPort The HTTP port
* @param integer $httpsPort The HTTPS port
*
* @api
*/
public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443)
{
@ -61,6 +65,8 @@ class RequestContext
* Sets the base URL.
*
* @param string $baseUrl The base URL
*
* @api
*/
public function setBaseUrl($baseUrl)
{
@ -83,6 +89,8 @@ class RequestContext
* Sets the HTTP method.
*
* @param string $method The HTTP method
*
* @api
*/
public function setMethod($method)
{
@ -103,6 +111,8 @@ class RequestContext
* Sets the HTTP host.
*
* @param string $host The HTTP host
*
* @api
*/
public function setHost($host)
{
@ -123,6 +133,8 @@ class RequestContext
* Sets the HTTP scheme.
*
* @param string $scheme The HTTP scheme
*
* @api
*/
public function setScheme($scheme)
{
@ -143,6 +155,8 @@ class RequestContext
* Sets the HTTP port.
*
* @param string $httpPort The HTTP port
*
* @api
*/
public function setHttpPort($httpPort)
{
@ -163,6 +177,8 @@ class RequestContext
* Sets the HTTPS port.
*
* @param string $httpsPort The HTTPS port
*
* @api
*/
public function setHttpsPort($httpsPort)
{
@ -224,6 +240,8 @@ class RequestContext
*
* @param string $name A parameter name
* @param mixed $parameter The parameter value
*
* @api
*/
public function setParameter($name, $parameter)
{

View File

@ -11,12 +11,17 @@
namespace Symfony\Component\Routing;
/**
* @api
*/
interface RequestContextAwareInterface
{
/**
* Sets the request context.
*
* @param RequestContext $context The context
*
* @api
*/
function setContext(RequestContext $context);
}

View File

@ -15,6 +15,8 @@ namespace Symfony\Component\Routing;
* A Route describes a route and its parameters.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class Route
{
@ -37,6 +39,8 @@ class Route
* @param array $defaults An array of default parameter values
* @param array $requirements An array of requirements for parameters (regexes)
* @param array $options An array of options
*
* @api
*/
public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array())
{
@ -114,6 +118,8 @@ class Route
* @param mixed $value The option value
*
* @return Route The current Route instance
*
* @api
*/
public function setOption($name, $value)
{
@ -191,6 +197,8 @@ class Route
* @param mixed $default The default value
*
* @return Route The current Route instance
*
* @api
*/
public function setDefault($name, $default)
{
@ -246,6 +254,8 @@ class Route
* @param string $regex The regex
*
* @return Route The current Route instance
*
* @api
*/
public function setRequirement($key, $regex)
{

View File

@ -17,6 +17,8 @@ use Symfony\Component\Config\Resource\ResourceInterface;
* A RouteCollection represents a set of Route instances.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class RouteCollection implements \IteratorAggregate
{
@ -26,6 +28,8 @@ class RouteCollection implements \IteratorAggregate
/**
* Constructor.
*
* @api
*/
public function __construct()
{
@ -46,6 +50,8 @@ class RouteCollection implements \IteratorAggregate
* @param Route $route A Route instance
*
* @throws \InvalidArgumentException When route name contains non valid characters
*
* @api
*/
public function add($name, Route $route)
{
@ -105,6 +111,8 @@ class RouteCollection implements \IteratorAggregate
*
* @param RouteCollection $collection A RouteCollection instance
* @param string $prefix An optional prefix to add before each pattern of the route collection
*
* @api
*/
public function addCollection(RouteCollection $collection, $prefix = '')
{
@ -117,6 +125,8 @@ class RouteCollection implements \IteratorAggregate
* Adds a prefix to all routes in the current set.
*
* @param string $prefix An optional prefix to add before each pattern of the route collection
*
* @api
*/
public function addPrefix($prefix)
{