src/Daursu/Xero/models/BaseModel.php
protected function parseResponse($response, $setAttributes = true)
	{
		if ($response['code'] == 200)
		{
			$data = $this->api->parseResponse($response['response'], $response['format']);

			if ($response['format'] == 'xml') {
				$data = json_encode($data);
				$data = json_decode($data, true);
			}

			// print_r($data);

			if ($setAttributes && is_array($data))
				$this->setAttributes($data);

			return $data;
		}
		elseif ($response['code'] == 404)
		{
			return false;
		}
		else
		{
			throw new XeroGeneralException('Error from Xero: ' . $response['response']);
		}
	}
protected function parseResponse($response, $setAttributes = true)
	{
		if ($response['code'] == 200)
		{
			$data = $this->api->parseResponse($response['response'], $response['format']);

			if ($response['format'] == 'xml') {
				$data = json_encode($data);
				$data = json_decode($data, true);
			}

			// print_r($data);

			if ($setAttributes && is_array($data))
				$this->setAttributes($data);

			return $data;
		}
		elseif ($response['code'] == 404)
		{
			return false;
		}
		else
		{
			throw new XeroGeneralException('Error from Xero: ' . $response['response']);
		}
	}
protected function parseResponse ( $ response , $ setAttributes = true ) { if ( $ response [ 'code' ] == 200 ) { $ data = $ this -> api -> parseResponse ( $ response [ 'response' ] , $ response [ 'format' ] ) ; if ( $ response [ 'format' ] == 'xml' ) { $ data = json_encode ( $ data ) ; $ data = json_decode ( $ data , true ) ; } // print_r($data); if ( $ setAttributes && is_array ( $ data ) ) $ this -> setAttributes ( $ data ) ; return $ data ; } elseif ( $ response [ 'code' ] == 404 ) { return false ; } else { throw new XeroGeneralException ( 'Error from Xero: ' . $ response [ 'response' ] ) ; } }
Parses the response retrieved from Xero,
or throws an exception if it fails.

@param  array $response
@return array
Parses the response retrieved from Xero or throws an exception if it fails .