Skip to content

Commit 4cd8209

Browse files
committed
Merge pull request #1 from hppycoder/master-fixSpaceRewrite
Updated the code to have proper support for the URL's that have encoding...
2 parents 290e85b + ad0d8d7 commit 4cd8209

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Formatter/LastPassingConditionFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ public function format(
1919
) {
2020
return preg_replace_callback('/%(\d+)/', function(array $matches) use ($matchState)
2121
{
22-
return $matchState->getMatchReference(
22+
$reference = $matchState->getMatchReference(
2323
(int)$matches[1],
2424
MatchState::MATCH_REFERENCE_TYPE_CONDITION
2525
);
26+
27+
return (is_null($reference)) ? $matches[0] : $reference;
2628
}, $value);
2729
}
2830
}

Formatter/RewriteFormatter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ public function format(
1919
) {
2020
return preg_replace_callback('/\$(\d+)/', function(array $matches) use ($matchState)
2121
{
22-
return $matchState->getMatchReference(
22+
$reference = $matchState->getMatchReference(
2323
$matches[1],
2424
MatchState::MATCH_REFERENCE_TYPE_REWRITE
2525
);
26+
27+
return (is_null($reference)) ? $matches[0] : $reference;
2628
}, $value);
2729
}
2830
}

MatchState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function clearMatchReferences($type)
7272

7373
public function getMatchReference($key, $type)
7474
{
75-
return isset($this->matchReferences[$type][$key]) ? $this->matchReferences[$type][$key] : '';
75+
return isset($this->matchReferences[$type][$key]) ? $this->matchReferences[$type][$key] : null;
7676
}
7777

7878
public function getMatchReferences($type)

0 commit comments

Comments
 (0)