Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make URLpattern mapping functionality available statically
  • Loading branch information
bergie committed Feb 4, 2011
1 parent 9b3f9cf commit a6ee90a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions route.php
Expand Up @@ -57,7 +57,11 @@ public function __construct($id, $path, $controller, $action, array $template_al

public function set_variables(array $arguments)
{
$path = $this->path;
return self::set_variables_to_urlpattern($this->path, $arguments);
}

public static function set_variables_to_urlpattern($path, array $arguments)
{
foreach ($arguments as $key => $value)
{
if (is_array($value))
Expand Down Expand Up @@ -118,7 +122,7 @@ public function set_variables(array $arguments)
//if (mb_ereg_match('\{\$([^}]+)\}', $path))
if (preg_match('%\{\$[^}]+\}%', $path))
{
throw new UnexpectedValueException("Missing arguments for route '{$this->id}'");
throw new UnexpectedValueException("Missing arguments for route");
}

return explode('/', $path);
Expand Down

0 comments on commit a6ee90a

Please sign in to comment.