Skip to content

Commit

Permalink
Additional fixes to RouteGenerator::is()
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Dec 12, 2013
1 parent 29af27c commit 2dd79b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Orchestra/Extension/RouteGenerator.php
Expand Up @@ -103,13 +103,16 @@ public function domain($forceBase = false)
*/
public function is($pattern)
{
$path = $this->path();
$prefix = $this->prefix();

foreach (func_get_args() as $pattern) {
$pattern = ($pattern === '*' ? $this->prefix() : $this->prefix()."/{$pattern}");
$pattern = ($pattern === '*' ? "{$prefix}*" : "{$prefix}/{$pattern}");
$pattern = trim($pattern, '/');

empty($pattern) and $pattern = '/';

if (str_is($pattern, $this->path())) {
if (str_is($pattern, $path)) {
return true;
}
}
Expand Down

0 comments on commit 2dd79b1

Please sign in to comment.