8000 [Routing] added hostname matching support to CompiledRoute · jeremymarc/symfony@50c2974 · GitHub
[go: up one dir, main page]

Skip to content

Commit 50c2974

Browse files
committed
[Routing] added hostname matching support to CompiledRoute
1 parent d2fd9ce commit 50c2974

File tree

1 file changed

+68
-6
lines changed

1 file changed

+68
-6
lines changed

src/Symfony/Component/Routing/CompiledRoute.php

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,35 @@ class CompiledRoute
2323
private $tokens;
2424
private $staticPrefix;
2525
private $regex;
26+
private $pathVariables;
27+
private $hostnameVariables;
28+
private $hostnameRegex;
29+
private $hostnameTokens;
2630

2731
/**
2832
* Constructor.
2933
*
30-
* @param Route $route A original Route instance
31-
* @param string $staticPrefix The static prefix of the compiled route
32-
* @param string $regex The regular expression to use to match this route
33-
* @param array $tokens An array of tokens to use to generate URL for this route
34-
* @param array $variables An array of variables
34+
* @param Route $route A original Route instance
35+
* @param string $staticPrefix The static prefix of the compiled route
36+
* @param string $regex The regular expression to use to match this route
37+
* @param array $tokens An array of tokens to use to generate URL for this route
38+
* @param array $variables An array of variables
39+
* @param array $pathVariables An array of path variables
40+
* @param array $hostnameVariables An array of hostname variables
41+
* @param array $hostnameRegex Hostname regex
42+
* @param array $hostnameTokens Hostname tokens
3543
*/
36-
public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables)
44+
public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables, array $pathVariables = array(), array $hostnameVariables = array(), $hostnameRegex = null, array $hostnameTokens = array())
3745
{
3846
$this->route = $route;
3947
$this->staticPrefix = $staticPrefix;
4048
$this->regex = $regex;
4149
$this->tokens = $tokens;
4250
$this->variables = $variables;
51+
$this->pathVariables = $pathVariables;
52+
$this->hostnameVariables = $hostnameVariables;
53+
$this->hostnameRegex = $hostnameRegex;
54+
$this->hostnameTokens = $hostnameTokens;
4355
}
4456

4557
/**
@@ -72,6 +84,16 @@ public function getRegex()
7284
return $this->regex;
7385
}
7486

87+
/**
88+
* Returns the hostname regex
89+
*
90+
* @return string The hostname regex
91+
*/
92+
public function getHostnameRegex()
93+
{
94+
return $this->hostnameRegex;
95+
}
96+
7597
/**
7698
* Returns the tokens.
7799
*
@@ -82,6 +104,16 @@ public function getTokens()
82104
return $this->tokens;
83105
}
84106

107+
/**
108+
* Returns the hostname tokens.
109+
*
110+
* @return array The tokens
111+
*/
112+
public function getHostnameTokens()
113+
{
114+
return $this->hostnameTokens;
115+
}
116+
85117
/**
86118
* Returns the variables.
87119
*
@@ -92,6 +124,26 @@ public function getVariables()
92124
return $this->variables;
93125
}
94126

127+
/**
128+
* Returns the path variables.
129+
*
130+
* @return array The variables
131+
*/
132+
public function getPathVariables()
133+
{
134+
return $this->pathVariables;
135+
}
136+
137+
/**
138+
* Returns the hostname variables.
139+
*
140+
* @return array The variables
141+
*/
142+
public function getHostnameVariables()
143+
{
144+
return $this->hostnameVariables;
145+
}
146+
95147
/**
96148
* Returns the pattern.
97149
*
@@ -102,6 +154,16 @@ public function getPattern()
102154
return $this->route->getPattern();
103155
}
104156

157+
/**
158+
* Returns the hostname pattern.
159+
*
160+
* @return string The pattern
161+
*/
162+
public function getHostnamePattern()
163+
{
164+
return $this->route->getHostnamePattern();
165+
}
166+
105167
/**
106168
* Returns the options.
107169
*

0 commit comments

Comments
 (0)
0