public function add($middleware)
    {
        $object = $this->marshalMiddleware($middleware);

        if (count($this->stack)) {
            $object->setNext($this->stack->top());
        }

        $this->stack[] = $object;

        return $this;
    }
public function add($middleware)
    {
        $object = $this->marshalMiddleware($middleware);

        if (count($this->stack)) {
            $object->setNext($this->stack->top());
        }

        $this->stack[] = $object;

        return $this;
    }
public function add ( $ middleware ) { $ object = $ this -> marshalMiddleware ( $ middleware ) ; if ( count ( $ this -> stack ) ) { $ object -> setNext ( $ this -> stack -> top ( ) ) ; } $ this -> stack [ ] = $ object ; return $ this ; }
Add a middleware into chain.

@param mixed $middleware The middleware, can be a object, class name, callback, or middleware object.
These type will all convert to middleware object and store in chain.

@return  static Return self to support chaining.
@throws \ReflectionException
Add a middleware into chain .