8000 [Routing] changed CompiledRoute signature to be more consistent · alexpott/symfony@63712e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 63712e9

Browse files
committed
[Routing] changed CompiledRoute signature to be more consistent
1 parent 2d6484a commit 63712e9

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/Symfony/Component/Routing/CompiledRoute.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ class CompiledRoute
3535
* @param string $staticPrefix The static prefix of the compiled route
3636
* @param string $regex The regular expression to use to match this route
3737
* @param array $tokens An array of tokens to use to generate URL for this route
38-
* @param array $variables An array of variables (variables defined in the path and in the hostname patterns)
3938
* @param array $pathVariables An array of path variables
40-
* @param array $hostnameVariables An array of hostname variables
4139
* @param array $hostnameRegex Hostname regex
4240
* @param array $hostnameTokens Hostname tokens
41+
* @param array $hostnameVariables An array of hostname variables
42+
* @param array $variables An array of variables (variables defined in the path and in the hostname patterns)
4343
*/
44-
public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables, array $pathVariables = array(), array $hostnameVariables = array(), $hostnameRegex = null, array $hostnameTokens = array())
44+
public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostnameRegex = null, array $hostnameTokens = array(), array $hostnameVariables = array(), array $variables = array())
4545
{
4646
$this->route = $route;
4747
$this->staticPrefix = $staticPrefix;
4848
$this->regex = $regex;
4949
$this->tokens = $tokens;
50-
$this->variables = $variables;
5150
$this->pathVariables = $pathVariables;
52-
$this->hostnameVariables = $hostnameVariables;
5351
$this->hostnameRegex = $hostnameRegex;
5452
$this->hostnameTokens = $hostnameTokens;
53+
$this->hostnameVariables = $hostnameVariables;
54+
$this->variables = $variables;
5555
}
5656

5757
/**

src/Symfony/Component/Routing/RouteCompiler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function compile(Route $route)
6565
$staticPrefix,
6666
$regex,
6767
$tokens,
68-
array_unique($variables),
6968
$pathVariables,
70-
$hostnameVariables,
7169
$hostnameRegex,
72-
$hostnameTokens
70+
$hostnameTokens,
71+
$hostnameVariables,
72+
array_unique($variables)
7373
);
7474
}
7575

src/Symfony/Component/Routing/Tests/CompiledRouteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public function testAccessors()
2020
{
2121
$route = new Route('/{foo}', array('foo' => 'bar'), array('foo' => '\d+'), array('foo' => 'bar'));
2222

23-
$compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array('variables'));
23+
$compiled = new CompiledRoute($route, 'prefix', 'regex', array('tokens'), array(), array(), array(), array(), array('variables'));
2424
$this->assertEquals($route, $compiled->getRoute(), '__construct() takes a route as its first argument');
2525
$this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument');
2626
$this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument');
2727
$this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument');
28-
$this->assertEquals(array('variables'), $compiled->getVariables(), '__constr A4EE uct() takes an array of variables as its fifth argument');
28+
$this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument');
2929
}
3030

3131
public function testgetPatterngetDefaultsgetOptionsgetRequirements()

src/Symfony/Component/Routing/Tests/RouteCompilerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ public function testCompileExtended($name, $arguments, $prefix, $regex, $variabl
123123
$this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)');
124124
$this->assertEquals($pathVariables, $compiled->getPathVariables(), $name.' (path variables)');
125125
$this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)');
126-
127-
128126
$this->assertEquals($hostnameRegex, str_replace(array("\n", ' '), '', $compiled->getHostnameRegex()), $name.' (hostname regex)');
129127
$this->assertEquals($hostnameVariables, $compiled->getHostnameVariables(), $name.' (hostname variables)');
130128
$this->assertEquals($hostnameTokens, $compiled->getHostnameTokens(), $name.' (hostname tokens)');

0 commit comments

Comments
 (0)
0