@@ -35,7 +35,7 @@ class RouteCompiler implements RouteCompilerInterface
35
35
* @throws \DomainException If a variable name is numeric because PHP raises an error for such
36
36
* subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)".
37
37
*/
38
- public function compile (Route $ route )
38
+ public static function compile (Route $ route )
39
39
{
40
40
$ staticPrefix = null ;
41
41
$ hostnameVariables = array ();
@@ -47,7 +47,7 @@ public function compile(Route $route)
47
47
$ hostnameTokens = array ();
48
48
49
49
if ('' !== $ hostnamePattern = $ route ->getHostnamePattern ()) {
50
- $ result = $ this -> compilePattern ($ route , $ hostnamePattern , true );
50
+ $ result = self :: compilePattern ($ route , $ hostnamePattern , true );
51
51
52
52
$ hostnameVariables = $ result ['variables ' ];
53
53
$ variables = array_merge ($ variables , $ hostnameVariables );
@@ -58,7 +58,7 @@ public function compile(Route $route)
58
58
59
59
$ pattern = $ route ->getPattern ();
60
60
61
- $ result = $ this -> compilePattern ($ route , $ pattern , false );
61
+ $ result = self :: compilePattern ($ route , $ pattern , false );
62
62
63
63
$ staticPrefix = $ result ['staticPrefix ' ];
64
64
@@ -80,7 +80,7 @@ public function compile(Route $route)
80
80
);
81
81
}
82
82
83
- private function compilePattern (Route $ route , $ pattern , $ isHostname )
83
+ private static function compilePattern (Route $ route , $ pattern , $ isHostname )
84
84
{
85
85
$ tokens = array ();
86
86
$ variables = array ();
@@ -122,7 +122,7 @@ private function compilePattern(Route $route, $pattern, $isHostname)
122
122
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
123
123
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
124
124
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.
125
- $ nextSeparator = $ this -> findNextSeparator ($ followingPattern );
125
+ $ nextSeparator = self :: findNextSeparator ($ followingPattern );
126
126
$ regexp = sprintf (
127
127
'[^%s%s]+ ' ,
128
128
preg_quote ($ defaultSeparator , self ::REGEX_DELIMITER ),
@@ -162,7 +162,7 @@ private function compilePattern(Route $route, $pattern, $isHostname)
162
162
// compute the matching regexp
163
163
$ regexp = '' ;
164
164
for ($ i = 0 , $ nbToken = count ($ tokens ); $ i < $ nbToken ; $ i ++) {
165
- $ regexp .= $ this -> computeRegexp ($ tokens , $ i , $ firstOptional );
165
+ $ regexp .= self :: computeRegexp ($ tokens , $ i , $ firstOptional );
166
166
}
167
167
168
168
return array (
@@ -180,7 +180,7 @@ private function compilePattern(Route $route, $pattern, $isHostname)
180
180
*
181
181
* @return string The next static character that functions as separator (or empty string when none available)
182
182
*/
183
- private function findNextSeparator ($ pattern )
183
+ private static function findNextSeparator ($ pattern )
184
184
{
185
185
if ('' == $ pattern ) {
186
186
// return empty string if pattern is empty or false (false which can be returned by substr)
@@ -201,7 +201,7 @@ private function findNextSeparator($pattern)
201
201
*
202
202
* @return string The regexp pattern for a single token
203
203
*/
204
- private function computeRegexp (array $ tokens , $ index , $ firstOptional )
204
+ private static function computeRegexp (array $ tokens , $ index , $ firstOptional )
205
205
{
206
206
$ token = $ tokens [$ index ];
207
207
if ('text ' === $ token [0 ]) {
0 commit comments