updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -46,10 +46,10 @@ class RouteCompiler implements RouteCompilerInterface
*/
public static function compile(Route $route)
{
$hostVariables = array();
$variables = array();
$hostVariables = [];
$variables = [];
$hostRegex = null;
$hostTokens = array();
$hostTokens = [];
if ('' !== $host = $route->getHost()) {
$result = self::compilePattern($route, $host, true);
@@ -94,9 +94,9 @@ class RouteCompiler implements RouteCompilerInterface
private static function compilePattern(Route $route, $pattern, $isHost)
{
$tokens = array();
$variables = array();
$matches = array();
$tokens = [];
$variables = [];
$matches = [];
$pos = 0;
$defaultSeparator = $isHost ? '.' : '/';
$useUtf8 = preg_match('//u', $pattern);
@@ -142,9 +142,9 @@ class RouteCompiler implements RouteCompilerInterface
}
if ($isSeparator && $precedingText !== $precedingChar) {
$tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar)));
$tokens[] = ['text', substr($precedingText, 0, -\strlen($precedingChar))];
} elseif (!$isSeparator && \strlen($precedingText) > 0) {
$tokens[] = array('text', $precedingText);
$tokens[] = ['text', $precedingText];
}
$regexp = $route->getRequirement($varName);
@@ -153,7 +153,7 @@ class RouteCompiler implements RouteCompilerInterface
// Find the next static character after the variable that functions as a separator. By default, this separator and '/'
// are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all
// and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are
// the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html'))
// the same that will be matched. Example: new Route('/{page}.{_format}', ['_format' => 'html'])
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.
@@ -183,12 +183,12 @@ class RouteCompiler implements RouteCompilerInterface
$regexp = self::transformCapturingGroupsToNonCapturings($regexp);
}
$tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName);
$tokens[] = ['variable', $isSeparator ? $precedingChar : '', $regexp, $varName];
$variables[] = $varName;
}
if ($pos < \strlen($pattern)) {
$tokens[] = array('text', substr($pattern, $pos));
$tokens[] = ['text', substr($pattern, $pos)];
}
// find the first optional token
@@ -221,12 +221,12 @@ class RouteCompiler implements RouteCompilerInterface
}
}
return array(
return [
'staticPrefix' => self::determineStaticPrefix($route, $tokens),
'regex' => $regexp,
'tokens' => array_reverse($tokens),
'variables' => $variables,
);
];
}
/**