Respect\Rest\Request::processPosRoutines PHP Method

processPosRoutines() protected method

Iterates over routines to find instances of Respect\Rest\Routines\ProxyableThrough and call them, forwarding if necessary
See also: Respect\Rest\Routines\ProxyableThrough
See also: Respect\Rest\Request::routineCall
protected processPosRoutines ( $response ) : mixed
return mixed A route forwarding or false
    protected function processPosRoutines($response)
    {
        $proxyResults = array();
        foreach ($this->route->routines as $routine) {
            if ($routine instanceof ProxyableThrough) {
                $proxyResults[] = $this->routineCall('through', $this->method, $routine, $this->params);
            }
        }
        //Some routine returned a callback as its result. Let's run
        //these callbacks on our actual response.
        //This is mainly used by accept() and similar ones.
        foreach ($proxyResults as $proxyCallback) {
            if (is_callable($proxyCallback)) {
                $response = call_user_func_array($proxyCallback, array($response));
            }
        }
        return $response;
    }