public function group(array $params, $callback)
    {
        $prefix = trim($this->getParam($params, 'prefix'), '/');
        $before = $this->getParam($params, 'before');
        $after  = $this->getParam($params, 'after');

        if ($prefix) {
            $this->prefixes[] = $prefix;
            $this->prefix     = '/' . trim(implode('/', $this->prefixes), '/');
        }

        if ($before) {
            $this->befores[] = $before;
            $this->before    = explode('|', implode('|', $this->befores));
        }

        if ($after) {
            $this->afters[] = $after;
            $this->after    = explode('|', implode('|', $this->afters));
        }

        call_user_func_array($callback, [$this]);

        if ($prefix) {
            array_pop($this->prefixes);
            $this->prefix = $this->prefixes ? '/' . trim(implode('/', $this->prefixes), '/') : null;
        }

        if ($before) {
            array_pop($this->befores);
            $this->before = explode('|', implode('|', $this->befores));
        }

        if ($after) {
            array_pop($this->afters);
            $this->after = explode('|', implode('|', $this->afters));
        }

        return $this;
    }