lib/Services/BaseService.php
protected function getResourceForResponse($response)
    {
        $api_response = new \GoCardlessPro\Core\ApiResponse($response);
        $unenveloped_body = $this->getUnenvelopedBody($api_response->body);

        if(is_array($unenveloped_body)) {
            return new ListResponse($unenveloped_body, $this->resource_class, $api_response);
        } else {
            $rclass = $this->resource_class;
            return new $rclass($unenveloped_body, $api_response);
        }
    }
protected function getResourceForResponse($response)
    {
        $api_response = new \GoCardlessPro\Core\ApiResponse($response);
        $unenveloped_body = $this->getUnenvelopedBody($api_response->body);

        if(is_array($unenveloped_body)) {
            return new ListResponse($unenveloped_body, $this->resource_class, $api_response);
        } else {
            $rclass = $this->resource_class;
            return new $rclass($unenveloped_body, $api_response);
        }
    }
protected function getResourceForResponse ( $ response ) { $ api_response = new \ GoCardlessPro \ Core \ ApiResponse ( $ response ) ; $ unenveloped_body = $ this -> getUnenvelopedBody ( $ api_response -> body ) ; if ( is_array ( $ unenveloped_body ) ) { return new ListResponse ( $ unenveloped_body , $ this -> resource_class , $ api_response ) ; } else { $ rclass = $ this -> resource_class ; return new $ rclass ( $ unenveloped_body , $ api_response ) ; } }
Takes a raw response and returns either an instantiated resource or a
ListResponse

@param array $response The raw API response

@return ListResponse|\GoCardlessPro\Resources\BaseResource
Takes a raw response and returns either an instantiated resource or a ListResponse