Skip to content

Commit

Permalink
Web\Url: add matches() function
Browse files Browse the repository at this point in the history
fixes #6992
  • Loading branch information
Thomas-Gelf committed Sep 4, 2014
1 parent 201c241 commit f91892c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions library/Icinga/Web/Url.php
Expand Up @@ -385,6 +385,23 @@ public function shift($param, $default = null)
return $this->params->shift($param, $default);
}

/**
* Whether the given URL matches this URL object
*
* This does an exact match, parameters MUST be in the same order
*
* @param Url|string $url the URL to compare against
*
* @return bool whether the URL matches
*/
public function matches($url)
{
if (! $url instanceof Url) {
$url = Url::fromPath($url);
}
return (string) $url === (string) $this;
}

/**
* Return a copy of this url without the parameter given
*
Expand Down

0 comments on commit f91892c

Please sign in to comment.