public function is($pattern, $value)
{
// 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 . '#', $value);
}