From 148902155295aa65f1607d2bc9d7e308722c2e81 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 25 Apr 2012 04:24:43 +0200 Subject: [PATCH] fixed CS --- .../Matcher/Dumper/DumperCollection.php | 22 +++++++++---------- .../Matcher/Dumper/PhpMatcherDumper.php | 9 +++----- .../Component/Routing/RouteCompiler.php | 1 - .../Dumper/PhpGeneratorDumperTest.php | 1 - 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php index cab4ad27c0..67d1170109 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php @@ -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 */ diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index f245818998..942809f2e5 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -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 * diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php index b57e0ed657..b6805276ac 100644 --- a/src/Symfony/Component/Routing/RouteCompiler.php +++ b/src/Symfony/Component/Routing/RouteCompiler.php @@ -47,7 +47,6 @@ class RouteCompiler implements RouteCompilerInterface $hostnameTokens = array(); if (null !== $hostnamePattern = $route->getHostnamePattern()) { - $result = $this->compilePattern($route, $hostnamePattern, true); $hostnameVariables = $result['variables']; diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index dee68b1957..6a86736abb 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -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 {