public function add($middleware)
        {
            if (!is_string($middleware) && !$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException('Middleware must be a string or an instance of MiddlewareInterface');
            }

            $class = is_string($middleware) ? new $middleware : $middleware;
            array_push($this->middleware, $class);
        }
public function add($middleware)
        {
            if (!is_string($middleware) && !$middleware instanceof MiddlewareInterface) {
                throw new \InvalidArgumentException('Middleware must be a string or an instance of MiddlewareInterface');
            }

            $class = is_string($middleware) ? new $middleware : $middleware;
            array_push($this->middleware, $class);
        }
public function add ( $ middleware ) { if ( ! is_string ( $ middleware ) && ! $ middleware instanceof MiddlewareInterface ) { throw new \ InvalidArgumentException ( 'Middleware must be a string or an instance of MiddlewareInterface' ) ; } $ class = is_string ( $ middleware ) ? new $ middleware : $ middleware ; array_push ( $ this -> middleware , $ class ) ; }
Add a middleware to the end of the queue.

@param string|MiddlewareInterface $middleware
Add a middleware to the end of the queue .