private function getGroupMiddleware() : array
    {
        $middleware = [];

        foreach ($this->groupOptionsStack as $groupOptions) {
            if (isset($groupOptions['middleware'])) {
                if (!is_array($groupOptions['middleware'])) {
                    $groupOptions['middleware'] = [$groupOptions['middleware']];
                }

                $middleware = array_merge($middleware, $groupOptions['middleware']);
            }
        }

        return $middleware;
    }