move 'is' method to the str class where it belongs.
This commit is contained in:
@@ -60,26 +60,11 @@ class URI {
|
||||
* Determine if the current URI matches a given pattern.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param string $uri
|
||||
* @return bool
|
||||
*/
|
||||
public static function is($pattern, $uri = null)
|
||||
public static function is($pattern)
|
||||
{
|
||||
$uri = $uri ?: static::current();
|
||||
|
||||
// Asterisks are translated into zero-or-more regular expression wildcards
|
||||
// to make it convenient to check if the URI starts with a given pattern
|
||||
// such as "library/*". This is only done when not root.
|
||||
if ($pattern !== '/')
|
||||
{
|
||||
$pattern = str_replace('*', '(.*)', $pattern).'\z';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pattern = '^/$';
|
||||
}
|
||||
|
||||
return preg_match('#'.$pattern.'#', $uri);
|
||||
return Str::is($pattern, static::current());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user