minor #18227 [Routing] small refactoring for scheme requirement (Tobion)

This PR was merged into the 2.7 branch.

Discussion
----------

[Routing] small refactoring for scheme requirement

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | refactoring
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18106
| License       | MIT
| Doc PR        |

Commits
-------

85f5e01 [Routing] small refactoring for scheme requirement
This commit is contained in:
Fabien Potencier 2016-03-21 06:55:59 -07:00
commit 46e82299e2
1 changed files with 1 additions and 10 deletions

View File

@ -202,16 +202,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
$scheme = $this->context->getScheme();
if ($requiredSchemes) {
$schemeMatched = false;
foreach ($requiredSchemes as $requiredScheme) {
if ($scheme === $requiredScheme) {
$schemeMatched = true;
break;
}
}
if (!$schemeMatched) {
if (!in_array($scheme, $requiredSchemes, true)) {
$referenceType = self::ABSOLUTE_URL;
$scheme = current($requiredSchemes);
}