Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify route variable injection

  • Loading branch information...
commit dfe3273bf270f570dc994651ba9971917048c792 1 parent 61d024f
@bergie bergie authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 route.php
View
9 route.php
@@ -87,7 +87,7 @@ public function set_variables(array $arguments)
$key = "token:{$key}";
}
- $path_backup = (string)$path;
+ $path_backup = (string) $path;
$type = gettype($value);
switch($type)
{
@@ -102,13 +102,12 @@ public function set_variables(array $arguments)
if (mgd_is_guid($value))
{
$path = str_replace(array("{\${$key}}", "{\$guid:{$key}}"), $value, $path);
+ break;
}
- else
- {
- $path = str_replace(array("{\${$key}}", "{\$string:{$key}}"), $value, $path);
- }
+ $path = str_replace(array("{\${$key}}", "{\$string:{$key}}"), $value, $path);
break;
}
+
if ($path_backup === $path)
{
throw new InvalidArgumentException("Argument '{$key}' could not be placed, likely the value is of wrong type");
Please sign in to comment.
Something went wrong with that request. Please try again.