public function call($method, array &$arguments = [])
    {
        try {
            // alias for code readability
            $middle = &$this->middleware;

            if ($middle instanceof MiddlewareInterface) {
                assert(is_string($method));
                $middle->method($method);
                if (is_object($this->result)) {
                    $middle->as($this->result);
                }
                $this->result = $middle->handle($arguments, $this->type);

            } elseif (is_callable($middle)) {
                $callback = $middle;
                $this->result = $callback($method, ...$arguments);

            } elseif (is_array($middle) || $middle instanceof MiddlewareCollection) {
                assert(is_string($method));
                $this->result = Group::wrap($middle)->call($method, $arguments, $this->type, $this->result);
            }

            $this->called = true;

        } catch (HaltPropagationException $exception) {
            $this->halt($exception);
        }
        return $this->result;
    }
public function call($method, array &$arguments = [])
    {
        try {
            // alias for code readability
            $middle = &$this->middleware;

            if ($middle instanceof MiddlewareInterface) {
                assert(is_string($method));
                $middle->method($method);
                if (is_object($this->result)) {
                    $middle->as($this->result);
                }
                $this->result = $middle->handle($arguments, $this->type);

            } elseif (is_callable($middle)) {
                $callback = $middle;
                $this->result = $callback($method, ...$arguments);

            } elseif (is_array($middle) || $middle instanceof MiddlewareCollection) {
                assert(is_string($method));
                $this->result = Group::wrap($middle)->call($method, $arguments, $this->type, $this->result);
            }

            $this->called = true;

        } catch (HaltPropagationException $exception) {
            $this->halt($exception);
        }
        return $this->result;
    }
public function call ( $ method , array & $ arguments = [ ] ) { try { // alias for code readability $ middle = & $ this -> middleware ; if ( $ middle instanceof MiddlewareInterface ) { assert ( is_string ( $ method ) ) ; $ middle -> method ( $ method ) ; if ( is_object ( $ this -> result ) ) { $ middle -> as ( $ this -> result ) ; } $ this -> result = $ middle -> handle ( $ arguments , $ this -> type ) ; } elseif ( is_callable ( $ middle ) ) { $ callback = $ middle ; $ this -> result = $ callback ( $ method , ... $ arguments ) ; } elseif ( is_array ( $ middle ) || $ middle instanceof MiddlewareCollection ) { assert ( is_string ( $ method ) ) ; $ this -> result = Group :: wrap ( $ middle ) -> call ( $ method , $ arguments , $ this -> type , $ this -> result ) ; } $ this -> called = true ; } catch ( HaltPropagationException $ exception ) { $ this -> halt ( $ exception ) ; } return $ this -> result ; }
Calls the given method on the given middleware.

@throws \MichaelRShelton\MiddleMan\Exceptions\HaltPropagationException

@param string|mixed $method or first argument in callable functions
@param array $arguments
@return mixed
Calls the given method on the given middleware .