Skip to content

Commit

Permalink
minor #18227 [Routing] small refactoring for scheme requirement (Tobion)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabpot committed Mar 21, 2016
2 parents 66f54ff + 85f5e01 commit 46e8229
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/Symfony/Component/Routing/Generator/UrlGenerator.php
Expand Up @@ -202,16 +202,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
$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);
}
Expand Down

0 comments on commit 46e8229

Please sign in to comment.