public function transducer(RequestInterface $request)
    {
        $response = null;
        if (count($this->middleware)) {
            $md = array_pop($this->middleware);
            $next = function (RequestInterface $request) {
                return $this->transducer($request);
            };

            if (is_callable($md)) {
                $response = $md($request, $next);
            } elseif (is_array($md)) {
                list($class, $action) = $md;
                $instance = is_object($class) ? $class : new $class();
                $response = $instance->$action($request, $next);
            }

            if ($response instanceof Generator) {
                $response = Poroutine::resolve($response);
            }
        }

        return $response ?? new Response();
    }
public function transducer(RequestInterface $request)
    {
        $response = null;
        if (count($this->middleware)) {
            $md = array_pop($this->middleware);
            $next = function (RequestInterface $request) {
                return $this->transducer($request);
            };

            if (is_callable($md)) {
                $response = $md($request, $next);
            } elseif (is_array($md)) {
                list($class, $action) = $md;
                $instance = is_object($class) ? $class : new $class();
                $response = $instance->$action($request, $next);
            }

            if ($response instanceof Generator) {
                $response = Poroutine::resolve($response);
            }
        }

        return $response ?? new Response();
    }
public function transducer ( RequestInterface $ request ) { $ response = null ; if ( count ( $ this -> middleware ) ) { $ md = array_pop ( $ this -> middleware ) ; $ next = function ( RequestInterface $ request ) { return $ this -> transducer ( $ request ) ; } ; if ( is_callable ( $ md ) ) { $ response = $ md ( $ request , $ next ) ; } elseif ( is_array ( $ md ) ) { list ( $ class , $ action ) = $ md ; $ instance = is_object ( $ class ) ? $ class : new $ class ( ) ; $ response = $ instance -> $ action ( $ request , $ next ) ; } if ( $ response instanceof Generator ) { $ response = Poroutine :: resolve ( $ response ) ; } } return $ response ?? new Response ( ) ; }
Iterative process the request

@param mixed $request
@return mixed|Response
Iterative process the request