public function isCollection($middleware): bool
    {
        $isArray = is_array($middleware) && ! is_callable($middleware);
        return $isArray || $middleware instanceof Traversable || $middleware instanceof ArrayAccess;
    }