This commit is contained in:
Fabien Potencier 2012-04-25 04:24:43 +02:00 committed by Arnaud Le Blanc
parent a270458d40
commit 1489021552
4 changed files with 13 additions and 20 deletions

View File

@ -45,7 +45,7 @@ class DumperCollection implements \IteratorAggregate
}
/**
* Sets children
* Sets children.
*
* @param array $children The children
*/
@ -100,9 +100,10 @@ class DumperCollection implements \IteratorAggregate
}
/**
* Returns true if the attribute is defined
* Returns true if the attribute is defined.
*
* @param string $name The attribute name
*
* @return Boolean true if the attribute is defined, false otherwise
*/
public function hasAttribute($name)
@ -111,23 +112,20 @@ class DumperCollection implements \IteratorAggregate
}
/**
* Returns an attribute by name
* Returns an attribute by name.
*
* @param string $name The attribute name
* @param mixed $default Default value is the attribute doesn't exist
*
* @param string $name The attribute name
* @param mixed $default Default value is the attribute doesn't exist
* @return mixed The attribute value
*/
public function getAttribute($name, $default = null)
{
if ($this->hasAttribute($name)) {
return $this->attributes[$name];
} else {
return $default;
}
return $this->hasAttribute($name) ? $this->attributes[$name] : $default;
}
/**
* Sets an attribute by name
* Sets an attribute by name.
*
* @param string $name The attribute name
* @param mixed $value The attribute value
@ -138,7 +136,7 @@ class DumperCollection implements \IteratorAggregate
}
/**
* Sets multiple attributes
* Sets multiple attributes.
*
* @param array $attributes The attributes
*/

View File

@ -117,7 +117,6 @@ EOF;
foreach ($groups as $collection) {
if (null !== $regex = $collection->getAttribute('hostname_regex')) {
if (!$fetchedHostname) {
$code .= " \$hostname = \$this->context->getHost();\n\n";
$fetchedHostname = true;
@ -296,7 +295,6 @@ EOF;
// optimize parameters array
if (($matches || $hostnameMatches) && $route->getDefaults()) {
$vars = array();
if ($matches) {
$vars[] = '$matches';
@ -336,7 +334,7 @@ EOF;
}
/**
* Flattens a tree of routes to a single collection
* Flattens a tree of routes to a single collection.
*
* @param RouteCollection $routes Collection of routes
* @param DumperCollection $to A DumperCollection to add routes to
@ -361,10 +359,9 @@ EOF;
}
/**
* Groups consecutive routes having the same hostname regex
* Groups consecutive routes having the same hostname regex.
*
* The results is a collection of collections of routes having the same
* hostnameRegex
* The results is a collection of collections of routes having the same hostname regex.
*
* @param DumperCollection $routes Flat collection of DumperRoutes
*

View File

@ -47,7 +47,6 @@ class RouteCompiler implements RouteCompilerInterface
$hostnameTokens = array();
if (null !== $hostnamePattern = $route->getHostnamePattern()) {
$result = $this->compilePattern($route, $hostnamePattern, true);
$hostnameVariables = $result['variables'];

View File

@ -15,7 +15,6 @@ use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Matcher\Dumper\DumperCollection;
class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
{