includes/eduadmin-api-client/rest-client.php
private function execute_request( $curl ) {
		$r   = curl_exec( $curl );
		$i   = curl_getinfo( $curl );
		$obj = array();
		if ( false === $r || ( json_decode( $r ) && isset( json_decode( $r )->error ) ) || ( $i['http_code'] < 200 || $i['http_code'] > 299 ) ) {
			curl_close( $curl );
			if ( null !== json_decode( $r ) ) {
				$obj = json_decode( $r, true );
			} else {
				$obj['data'] = $r;
			}
			$obj['@curl']  = $i;
			$obj['@error'] = $r;

			return $obj;
		}
		curl_close( $curl );
		if ( ( substr( $r, 0, 1 ) === '{' || substr( $r, 0, 1 ) === '[' )
		     && null !== json_decode( $r, true ) ) {
			$obj = json_decode( $r, true );
		} else {
			if ( substr( $r, 0, 1 ) === '"' ) {
				$obj['data'] = json_decode( $r, true );
			} else {
				$obj['data'] = $r;
			}
		}
		$obj['@curl'] = $i;

		return $obj;
	}
private function execute_request( $curl ) {
		$r   = curl_exec( $curl );
		$i   = curl_getinfo( $curl );
		$obj = array();
		if ( false === $r || ( json_decode( $r ) && isset( json_decode( $r )->error ) ) || ( $i['http_code'] < 200 || $i['http_code'] > 299 ) ) {
			curl_close( $curl );
			if ( null !== json_decode( $r ) ) {
				$obj = json_decode( $r, true );
			} else {
				$obj['data'] = $r;
			}
			$obj['@curl']  = $i;
			$obj['@error'] = $r;

			return $obj;
		}
		curl_close( $curl );
		if ( ( substr( $r, 0, 1 ) === '{' || substr( $r, 0, 1 ) === '[' )
		     && null !== json_decode( $r, true ) ) {
			$obj = json_decode( $r, true );
		} else {
			if ( substr( $r, 0, 1 ) === '"' ) {
				$obj['data'] = json_decode( $r, true );
			} else {
				$obj['data'] = $r;
			}
		}
		$obj['@curl'] = $i;

		return $obj;
	}
@param resource $curl

@return mixed