public function group(array $flags, Closure $callback)
{
if ($this->isCaching()) {
return;
}
$oldPrefix = $this->currentPrefix;
$oldHooks = $this->currentHooks;
foreach (['before', 'after'] as $when) {
if (isset($flags[$when])) {
foreach ((array) $flags[$when] as $hook) {
$this->currentHooks[] = [$when, $this->getHook($hook)];
}
}
}
if (isset($flags['prefix'])) {
$this->currentPrefix .= '/' . trim($flags['prefix'], '/');
}
$callback($this);
$this->currentPrefix = $oldPrefix;
$this->currentHooks = $oldHooks;
}