protected function runResponseHandler(Result $result, $type, $url, $params) {
        // Check if a status specific handler isset or else fallback to the default
        if (isset($this->responseHandlers[$result->getStatus()])) {
            $handler = $this->responseHandlers[$result->getStatus()];
        } else {
            $handler = $this->responseHandlers['default'];
        }

        // If the handler is a callable run the handler and return the result
        if (is_callable($handler)) {
            return $handler($result, $type, $url, $params);
        }
        // If the handler does not exists, throw exception
        else if (!method_exists($this, $handler)) {
            throw new ResponseHandlerNotFoundException('Response handler not found: ' . $handler);
        }

        // Run the handler and return the result
        return $this->$handler($result, $type, $url, $params);
    }
protected function runResponseHandler(Result $result, $type, $url, $params) {
        // Check if a status specific handler isset or else fallback to the default
        if (isset($this->responseHandlers[$result->getStatus()])) {
            $handler = $this->responseHandlers[$result->getStatus()];
        } else {
            $handler = $this->responseHandlers['default'];
        }

        // If the handler is a callable run the handler and return the result
        if (is_callable($handler)) {
            return $handler($result, $type, $url, $params);
        }
        // If the handler does not exists, throw exception
        else if (!method_exists($this, $handler)) {
            throw new ResponseHandlerNotFoundException('Response handler not found: ' . $handler);
        }

        // Run the handler and return the result
        return $this->$handler($result, $type, $url, $params);
    }
protected function runResponseHandler ( Result $ result , $ type , $ url , $ params ) { // Check if a status specific handler isset or else fallback to the default if ( isset ( $ this -> responseHandlers [ $ result -> getStatus ( ) ] ) ) { $ handler = $ this -> responseHandlers [ $ result -> getStatus ( ) ] ; } else { $ handler = $ this -> responseHandlers [ 'default' ] ; } // If the handler is a callable run the handler and return the result if ( is_callable ( $ handler ) ) { return $ handler ( $ result , $ type , $ url , $ params ) ; } // If the handler does not exists, throw exception else if ( ! method_exists ( $ this , $ handler ) ) { throw new ResponseHandlerNotFoundException ( 'Response handler not found: ' . $ handler ) ; } // Run the handler and return the result return $ this -> $ handler ( $ result , $ type , $ url , $ params ) ; }
Run the correct response handler function

@param   Result      $result
@param   string      $type
@param   string      $url
@param   array       $params
@return  Result
@throws  \Exception
Run the correct response handler function