Skip to content

Commit 23feb37

Browse files
committed
[Routing] added hostname matching support to CompiledRoute
1 parent f4c05e3 commit 23feb37

File tree

1 file changed

+58
-5
lines changed

1 file changed

+58
-5
lines changed

src/Symfony/Component/Routing/CompiledRoute.php

+58-5
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,33 @@ class CompiledRoute
2222
private $tokens;
2323
private $staticPrefix;
2424
private $regex;
25+
private $pathVariables;
26+
private $hostnameVariables;
27+
private $hostnameRegex;
28+
private $hostnameTokens;
2529

2630
/**
2731
* Constructor.
2832
*
29-
* @param string $staticPrefix The static prefix of the compiled route
30-
* @param string $regex The regular expression to use to match this route
31-
* @param array $tokens An array of tokens to use to generate URL for this route
32-
* @param array $variables An array of variables
33+
* @param string $staticPrefix The static prefix of the compiled route
34+
* @param string $regex The regular expression to use to match this route
35+
* @param array $tokens An array of tokens to use to generate URL for this route
36+
* @param array $variables An array of variables
37+
* @param array $pathVariables An array of path variables
38+
* @param array $hostnameVariables An array of hostname variables
39+
* @param array $hostnameRegex Hostname regex
40+
* @param array $hostnameTokens Hostname tokens
3341
*/
34-
public function __construct($staticPrefix, $regex, array $tokens, array $variables)
42+
public function __construct($staticPrefix, $regex, array $tokens, array $variables, array $pathVariables = array(), array $hostnameVariables = array(), $hostnameRegex = null, array $hostnameTokens = array())
3543
{
3644
$this->staticPrefix = $staticPrefix;
3745
$this->regex = $regex;
3846
$this->tokens = $tokens;
3947
$this->variables = $variables;
48+
$this->pathVariables = $pathVariables;
49+
$this->hostnameVariables = $hostnameVariables;
50+
$this->hostnameRegex = $hostnameRegex;
51+
$this->hostnameTokens = $hostnameTokens;
4052
}
4153

4254
/**
@@ -59,6 +71,16 @@ public function getRegex()
5971
return $this->regex;
6072
}
6173

74+
/**
75+
* Returns the hostname regex
76+
*
77+
* @return string The hostname regex
78+
*/
79+
public function getHostnameRegex()
80+
{
81+
return $this->hostnameRegex;
82+
}
83+
6284
/**
6385
* Returns the tokens.
6486
*
@@ -69,6 +91,16 @@ public function getTokens()
6991
return $this->tokens;
7092
}
7193

94+
/**
95+
* Returns the hostname tokens.
96+
*
97+
* @return array The tokens
98+
*/
99+
public function getHostnameTokens()
100+
{
101+
return $this->hostnameTokens;
102+
}
103+
72104
/**
73105
* Returns the variables.
74106
*
@@ -78,4 +110,25 @@ public function getVariables()
78110
{
79111
return $this->variables;
80112
}
113+
114+
/**
115+
* Returns the path variables.
116+
*
117+
* @return array The variables
118+
*/
119+
public function getPathVariables()
120+
{
121+
return $this->pathVariables;
122+
}
123+
124+
/**
125+
* Returns the hostname variables.
126+
*
127+
* @return array The variables
128+
*/
129+
public function getHostnameVariables()
130+
{
131+
return $this->hostnameVariables;
132+
}
133+
81134
}

0 commit comments

Comments
 (0)