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

Skip to content

Commit 92f9c15

Browse files
fabpotarnaud-lb
authored andcommitted
[Routing] changed CompiledRoute signature to be more consistent
1 parent d91e5a2 commit 92f9c15

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

src/Symfony/Component/Routing/CompiledRoute.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ class CompiledRoute
3333
* @param string $staticPrefix The static prefix of the compiled route
3434
* @param string $regex The regular expression to use to match this route
3535
* @param array $tokens An array of tokens to use to generate URL for this route
36-
* @param array $variables An array of variables (variables defined in the path and in the hostname patterns)
3736
* @param array $pathVariables An array of path variables
38-
* @param array $hostnameVariables An array of hostname variables
3937
* @param array $hostnameRegex Hostname regex
4038
* @param array $hostnameTokens Hostname tokens
39+
* @param array $hostnameVariables An array of hostname variables
40+
* @param array $variables An array of variables (variables defined in the path and in the hostname patterns)
4141
*/
42-
public function __construct($staticPrefix, $regex, array $tokens, array $variables, array $pathVariables = array(), array $hostnameVariables = array(), $hostnameRegex = null, array $hostnameTokens = array())
42+
public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostnameRegex = null, array $hostnameTokens = array(), array $hostnameVariables = array(), array $variables = array())
4343
{
4444
$this->staticPrefix = $staticPrefix;
4545
$this->regex = $regex;
4646
$this->tokens = $tokens;
47-
$this->variables = $variables;
4847
$this->pathVariables = $pathVariables;
49-
$this->hostnameVariables = $hostnameVariables;
5048
$this->hostnameRegex = $hostnameRegex;
5149
$this->hostnameTokens = $hostnameTokens;
50+
$this->hostnameVariables = $hostnameVariables;
51+
$this->variables = $variables;
5252
}
5353

5454
/**

src/Symfony/Component/Routing/RouteCompiler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public function compile(Route $route)
7373
$staticPrefix,
7474
$regex,
7575
$tokens,
76-
array_unique($variables),
7776
$pathVariables,
78-
$hostnameVariables,
7977
$hostnameRegex,
80-
$hostnameTokens
78+
$hostnameTokens,
79+
$hostnameVariables,
80+
array_unique($variables)
8181
);
8282
}
8383

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class CompiledRouteTest extends \PHPUnit_Framework_TestCase
1717
{
1818
public function testAccessors()
1919
{
20-
$compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array('variables'));
21-
$this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its first argument');
22-
$this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its second argument');
23-
$this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its third argument');
24-
$this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its forth argument');
20+
$compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), array(), array(), array(), array('variables'));
21+
$this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument');
22+
$this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument');
23+
$this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument');
24+
$this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument');
2525
}
2626
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ public function testCompileWithHostname($name, $arguments, $prefix, $regex, $var
194194
$this->assertEquals($variables, $compiled->getVariables(), $name.' (variables)');
195195
$this->assertEquals($pathVariables, $compiled->getPathVariables(), $name.' (path variables)');
196196
$this->assertEquals($tokens, $compiled->getTokens(), $name.' (tokens)');
197-
198-
199197
$this->assertEquals($hostnameRegex, str_replace(array("\n", ' '), '', $compiled->getHostnameRegex()), $name.' (hostname regex)');
200198
$this->assertEquals($hostnameVariables, $compiled->getHostnameVariables(), $name.' (hostname variables)');
201199
$this->assertEquals($hostnameTokens, $compiled->getHostnameTokens(), $name.' (hostname tokens)');

0 commit comments

Comments
 (0)
0