fixed CS
This commit is contained in:
parent
a270458d40
commit
1489021552
@ -45,7 +45,7 @@ class DumperCollection implements \IteratorAggregate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets children
|
* Sets children.
|
||||||
*
|
*
|
||||||
* @param array $children The 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
|
* @param string $name The attribute name
|
||||||
|
*
|
||||||
* @return Boolean true if the attribute is defined, false otherwise
|
* @return Boolean true if the attribute is defined, false otherwise
|
||||||
*/
|
*/
|
||||||
public function hasAttribute($name)
|
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
|
* @return mixed The attribute value
|
||||||
*/
|
*/
|
||||||
public function getAttribute($name, $default = null)
|
public function getAttribute($name, $default = null)
|
||||||
{
|
{
|
||||||
if ($this->hasAttribute($name)) {
|
return $this->hasAttribute($name) ? $this->attributes[$name] : $default;
|
||||||
return $this->attributes[$name];
|
|
||||||
} else {
|
|
||||||
return $default;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an attribute by name
|
* Sets an attribute by name.
|
||||||
*
|
*
|
||||||
* @param string $name The attribute name
|
* @param string $name The attribute name
|
||||||
* @param mixed $value The attribute value
|
* @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
|
* @param array $attributes The attributes
|
||||||
*/
|
*/
|
||||||
|
@ -117,7 +117,6 @@ EOF;
|
|||||||
|
|
||||||
foreach ($groups as $collection) {
|
foreach ($groups as $collection) {
|
||||||
if (null !== $regex = $collection->getAttribute('hostname_regex')) {
|
if (null !== $regex = $collection->getAttribute('hostname_regex')) {
|
||||||
|
|
||||||
if (!$fetchedHostname) {
|
if (!$fetchedHostname) {
|
||||||
$code .= " \$hostname = \$this->context->getHost();\n\n";
|
$code .= " \$hostname = \$this->context->getHost();\n\n";
|
||||||
$fetchedHostname = true;
|
$fetchedHostname = true;
|
||||||
@ -296,7 +295,6 @@ EOF;
|
|||||||
|
|
||||||
// optimize parameters array
|
// optimize parameters array
|
||||||
if (($matches || $hostnameMatches) && $route->getDefaults()) {
|
if (($matches || $hostnameMatches) && $route->getDefaults()) {
|
||||||
|
|
||||||
$vars = array();
|
$vars = array();
|
||||||
if ($matches) {
|
if ($matches) {
|
||||||
$vars[] = '$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 RouteCollection $routes Collection of routes
|
||||||
* @param DumperCollection $to A DumperCollection to add routes to
|
* @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
|
* The results is a collection of collections of routes having the same hostname regex.
|
||||||
* hostnameRegex
|
|
||||||
*
|
*
|
||||||
* @param DumperCollection $routes Flat collection of DumperRoutes
|
* @param DumperCollection $routes Flat collection of DumperRoutes
|
||||||
*
|
*
|
||||||
|
@ -47,7 +47,6 @@ class RouteCompiler implements RouteCompilerInterface
|
|||||||
$hostnameTokens = array();
|
$hostnameTokens = array();
|
||||||
|
|
||||||
if (null !== $hostnamePattern = $route->getHostnamePattern()) {
|
if (null !== $hostnamePattern = $route->getHostnamePattern()) {
|
||||||
|
|
||||||
$result = $this->compilePattern($route, $hostnamePattern, true);
|
$result = $this->compilePattern($route, $hostnamePattern, true);
|
||||||
|
|
||||||
$hostnameVariables = $result['variables'];
|
$hostnameVariables = $result['variables'];
|
||||||
|
@ -15,7 +15,6 @@ use Symfony\Component\Routing\RouteCollection;
|
|||||||
use Symfony\Component\Routing\Route;
|
use Symfony\Component\Routing\Route;
|
||||||
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
|
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
|
||||||
use Symfony\Component\Routing\RequestContext;
|
use Symfony\Component\Routing\RequestContext;
|
||||||
use Symfony\Component\Routing\Matcher\Dumper\DumperCollection;
|
|
||||||
|
|
||||||
class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user