public function middleware($definition, $prepend = false)
    {
        if ($this->freezed) {
            throw new InvalidCallException('The middleware stack is already called, no middleware can be added');
        }

        if ($prepend) {
            array_unshift($this->middleware, $definition);
        } else {
            $this->middleware[] = $definition;
        }
    }
public function middleware($definition, $prepend = false)
    {
        if ($this->freezed) {
            throw new InvalidCallException('The middleware stack is already called, no middleware can be added');
        }

        if ($prepend) {
            array_unshift($this->middleware, $definition);
        } else {
            $this->middleware[] = $definition;
        }
    }
public function middleware ( $ definition , $ prepend = false ) { if ( $ this -> freezed ) { throw new InvalidCallException ( 'The middleware stack is already called, no middleware can be added' ) ; } if ( $ prepend ) { array_unshift ( $ this -> middleware , $ definition ) ; } else { $ this -> middleware [ ] = $ definition ; } }
Add a new middleware to the middleware stack of the object.

@param $definition
@param $prepend
Add a new middleware to the middleware stack of the object .