Permalink
Browse files

Simplify route variable injection

  • Loading branch information...
1 parent 61d024f commit dfe3273bf270f570dc994651ba9971917048c792 @bergie bergie committed Jan 27, 2011
Showing with 4 additions and 5 deletions.
  1. +4 −5 route.php
View
@@ -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");

0 comments on commit dfe3273

Please sign in to comment.