Skip to content

Commit

Permalink
merged branch Tobion/routing-phpdoc (PR #5994)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Commits
-------

50e41d2 one space too much
5d9a36f small fix and enhancement
1e1cb13 [Routing] added more phpdoc and  replaced 'array of type' by 'Type[]'

Discussion
----------

[Routing] added more phpdoc and  replaced 'array of type' by 'Type[]'

---------------------------------------------------------------------------

by Tobion at 2012-11-12T17:03:01Z

@fabpot you should squash with your great merging tool ;)
  • Loading branch information
fabpot committed Nov 13, 2012
2 parents ff9051d + 50e41d2 commit 15fd24e
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 59 deletions.
Expand Up @@ -22,7 +22,10 @@
*/
class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface
{
protected $allowedMethods;
/**
* @var array
*/
protected $allowedMethods = array();

public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null)
{
Expand All @@ -31,6 +34,11 @@ public function __construct(array $allowedMethods, $message = null, $code = 0, \
parent::__construct($message, $code, $previous);
}

/**
* Gets the allowed HTTP methods.
*
* @return array
*/
public function getAllowedMethods()
{
return $this->allowedMethods;
Expand Down
Expand Up @@ -20,6 +20,9 @@
*/
abstract class GeneratorDumper implements GeneratorDumperInterface
{
/**
* @var RouteCollection
*/
private $routes;

/**
Expand Down
24 changes: 19 additions & 5 deletions src/Symfony/Component/Routing/Generator/UrlGenerator.php
Expand Up @@ -28,8 +28,24 @@
*/
class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface
{
/**
* @var RouteCollection
*/
protected $routes;

/**
* @var RequestContext
*/
protected $context;

/**
* @var Boolean|null
*/
protected $strictRequirements = true;

/**
* @var LoggerInterface|null
*/
protected $logger;

/**
Expand Down Expand Up @@ -60,14 +76,12 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
'%7C' => '|',
);

protected $routes;

/**
* Constructor.
*
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
* @param LoggerInterface $logger A logger instance
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
* @param LoggerInterface|null $logger A logger instance
*
* @api
*/
Expand Down
17 changes: 14 additions & 3 deletions src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
Expand Up @@ -56,9 +56,20 @@
*/
abstract class AnnotationClassLoader implements LoaderInterface
{
/**
* @var Reader
*/
protected $reader;

/**
* @var string
*/
protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route';
protected $defaultRouteIndex;

/**
* @var integer
*/
protected $defaultRouteIndex = 0;

/**
* Constructor.
Expand All @@ -83,8 +94,8 @@ public function setRouteAnnotationClass($class)
/**
* Loads from annotations from a class.
*
* @param string $class A class name
* @param string $type The resource type
* @param string $class A class name
* @param string|null $type The resource type
*
* @return RouteCollection A RouteCollection instance
*
Expand Down
Expand Up @@ -25,8 +25,8 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
/**
* Loads from annotations from a directory.
*
* @param string $path A directory path
* @param string $type The resource type
* @param string $path A directory path
* @param string|null $type The resource type
*
* @return RouteCollection A RouteCollection instance
*
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\FileLocatorInterface;

/**
* AnnotationFileLoader loads routing information from annotations set
Expand All @@ -29,11 +29,11 @@ class AnnotationFileLoader extends FileLoader
/**
* Constructor.
*
* @param FileLocator $locator A FileLocator instance
* @param FileLocatorInterface $locator A FileLocator instance
* @param AnnotationClassLoader $loader An AnnotationClassLoader instance
* @param string|array $paths A path or an array of paths where to look for resources
*/
public function __construct(FileLocator $locator, AnnotationClassLoader $loader, $paths = array())
public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, $paths = array())
{
if (!function_exists('token_get_all')) {
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
Expand All @@ -47,8 +47,8 @@ public function __construct(FileLocator $locator, AnnotationClassLoader $loader,
/**
* Loads from annotations from a file.
*
* @param string $file A PHP file path
* @param string $type The resource type
* @param string $file A PHP file path
* @param string|null $type The resource type
*
* @return RouteCollection A RouteCollection instance
*
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/Loader/ClosureLoader.php
Expand Up @@ -27,8 +27,8 @@ class ClosureLoader extends Loader
/**
* Loads a Closure.
*
* @param \Closure $closure A Closure
* @param string $type The resource type
* @param \Closure $closure A Closure
* @param string|null $type The resource type
*
* @api
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/Loader/PhpFileLoader.php
Expand Up @@ -28,8 +28,8 @@ class PhpFileLoader extends FileLoader
/**
* Loads a PHP file.
*
* @param mixed $file A PHP file path
* @param string $type The resource type
* @param string $file A PHP file path
* @param string|null $type The resource type
*
* @api
*/
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Component/Routing/Loader/XmlFileLoader.php
Expand Up @@ -28,8 +28,8 @@ class XmlFileLoader extends FileLoader
/**
* Loads an XML file.
*
* @param string $file An XML file path
* @param string $type The resource type
* @param string $file An XML file path
* @param string|null $type The resource type
*
* @return RouteCollection A RouteCollection instance
*
Expand Down Expand Up @@ -65,6 +65,8 @@ public function load($file, $type = null)
* @param \DOMElement $node the node to parse
* @param string $path the path of the XML file being processed
* @param string $file
*
* @throws \InvalidArgumentException When a tag can't be parsed
*/
protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/Loader/YamlFileLoader.php
Expand Up @@ -33,8 +33,8 @@ class YamlFileLoader extends FileLoader
/**
* Loads a Yaml file.
*
* @param string $file A Yaml file path
* @param string $type The resource type
* @param string $file A Yaml file path
* @param string|null $type The resource type
*
* @return RouteCollection A RouteCollection instance
*
Expand Down
Expand Up @@ -18,14 +18,25 @@
*/
class DumperCollection implements \IteratorAggregate
{
/**
* @var DumperCollection|null
*/
private $parent;

/**
* @var (DumperCollection|DumperRoute)[]
*/
private $children = array();

/**
* @var array
*/
private $attributes = array();

/**
* Returns the children routes and collections.
*
* @return array Array of DumperCollection|DumperRoute
* @return (DumperCollection|DumperRoute)[] Array of DumperCollection|DumperRoute
*/
public function all()
{
Expand Down
Expand Up @@ -18,6 +18,9 @@
*/
class DumperPrefixCollection extends DumperCollection
{
/**
* @var string
*/
private $prefix = '';

/**
Expand Down
7 changes: 7 additions & 0 deletions src/Symfony/Component/Routing/Matcher/Dumper/DumperRoute.php
Expand Up @@ -20,7 +20,14 @@
*/
class DumperRoute
{
/**
* @var string
*/
private $name;

/**
* @var Route
*/
private $route;

/**
Expand Down
Expand Up @@ -20,6 +20,9 @@
*/
abstract class MatcherDumper implements MatcherDumperInterface
{
/**
* @var RouteCollection
*/
private $routes;

/**
Expand Down
Expand Up @@ -324,8 +324,8 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
/**
* Flattens a tree of routes to a single collection.
*
* @param RouteCollection $routes Collection of routes
* @param DumperCollection $to A DumperCollection to add routes to
* @param RouteCollection $routes Collection of routes
* @param DumperCollection|null $to A DumperCollection to add routes to
*
* @return DumperCollection
*/
Expand Down
Expand Up @@ -23,9 +23,9 @@ interface RedirectableUrlMatcherInterface
/**
* Redirects the user to another URL.
*
* @param string $path The path info to redirect to.
* @param string $route The route that matched
* @param string $scheme The URL scheme (null to keep the current one)
* @param string $path The path info to redirect to.
* @param string $route The route name that matched
* @param string|null $scheme The URL scheme (null to keep the current one)
*
* @return array An array of parameters
*
Expand Down
12 changes: 11 additions & 1 deletion src/Symfony/Component/Routing/Matcher/UrlMatcher.php
Expand Up @@ -30,9 +30,19 @@ class UrlMatcher implements UrlMatcherInterface
const REQUIREMENT_MISMATCH = 1;
const ROUTE_MATCH = 2;

/**
* @var RequestContext
*/
protected $context;
protected $allow;

/**
* @var array
*/
protected $allow = array();

/**
* @var RouteCollection
*/
private $routes;

/**
Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Component/Routing/RequestContext.php
Expand Up @@ -28,7 +28,11 @@ class RequestContext
private $scheme;
private $httpPort;
private $httpsPort;
private $parameters;

/**
* @var array
*/
private $parameters = array();

/**
* Constructor.
Expand All @@ -50,7 +54,6 @@ public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost',
$this->scheme = strtolower($scheme);
$this->httpPort = $httpPort;
$this->httpsPort = $httpsPort;
$this->parameters = array();
}

public function fromRequest(Request $request)
Expand Down

0 comments on commit 15fd24e

Please sign in to comment.