lib/omise/res/OmiseApiResource.php
protected function execute($url, $requestMethod, $key, $params = null)
    {
        // If this class is execute by phpunit > get test mode.
        if (preg_match('/phpunit/', $_SERVER['SCRIPT_NAME'])) {
            $result = $this->_executeTest($url, $requestMethod, $key, $params);
        } else {
            $result = $this->_executeCurl($url, $requestMethod, $key, $params);
        }

        // Decode the JSON response as an associative array.
        $array = json_decode($result, true);

        // If response is invalid or not a JSON.
        if (!$this->isValidAPIResponse($array)) {
            throw new Exception('Unknown error. (Bad Response)');
        }

        // If response is an error object.
        if (!empty($array['object']) && $array['object'] === 'error') {
            throw OmiseException::getInstance($array);
        }

        return $array;
    }
protected function execute($url, $requestMethod, $key, $params = null)
    {
        // If this class is execute by phpunit > get test mode.
        if (preg_match('/phpunit/', $_SERVER['SCRIPT_NAME'])) {
            $result = $this->_executeTest($url, $requestMethod, $key, $params);
        } else {
            $result = $this->_executeCurl($url, $requestMethod, $key, $params);
        }

        // Decode the JSON response as an associative array.
        $array = json_decode($result, true);

        // If response is invalid or not a JSON.
        if (!$this->isValidAPIResponse($array)) {
            throw new Exception('Unknown error. (Bad Response)');
        }

        // If response is an error object.
        if (!empty($array['object']) && $array['object'] === 'error') {
            throw OmiseException::getInstance($array);
        }

        return $array;
    }
protected function execute ( $ url , $ requestMethod , $ key , $ params = null ) { // If this class is execute by phpunit > get test mode. if ( preg_match ( '/phpunit/' , $ _SERVER [ 'SCRIPT_NAME' ] ) ) { $ result = $ this -> _executeTest ( $ url , $ requestMethod , $ key , $ params ) ; } else { $ result = $ this -> _executeCurl ( $ url , $ requestMethod , $ key , $ params ) ; } // Decode the JSON response as an associative array. $ array = json_decode ( $ result , true ) ; // If response is invalid or not a JSON. if ( ! $ this -> isValidAPIResponse ( $ array ) ) { throw new Exception ( 'Unknown error. (Bad Response)' ) ; } // If response is an error object. if ( ! empty ( $ array [ 'object' ] ) && $ array [ 'object' ] === 'error' ) { throw OmiseException :: getInstance ( $ array ) ; } return $ array ; }
Makes a request and returns a decoded JSON data as an associative array.

@param  string $url
@param  string $requestMethod
@param  array  $params

@throws OmiseException

@return array
Makes a request and returns a decoded JSON data as an associative array .