summaryrefslogtreecommitdiffstats
path: root/php_http_client/client.php
diff options
context:
space:
mode:
authormbernier <matt.bernier@sendgrid.com>2016-02-29 22:04:45 -0700
committermbernier <matt.bernier@sendgrid.com>2016-02-29 22:04:45 -0700
commit9ccf626cbb53da486224feab51502f7f8949406a (patch)
tree6748fcea1927042ec7f768c1839fa9112284bfe5 /php_http_client/client.php
parent4a2d756dbe9e30caddde683b95bee6786b0a457c (diff)
downloadphp-http-client-9ccf626cbb53da486224feab51502f7f8949406a.zip
php-http-client-9ccf626cbb53da486224feab51502f7f8949406a.tar.gz
php-http-client-9ccf626cbb53da486224feab51502f7f8949406a.tar.bz2
Updated var names
Diffstat (limited to 'php_http_client/client.php')
-rw-r--r--php_http_client/client.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/php_http_client/client.php b/php_http_client/client.php
index 7ce72be..a70e084 100644
--- a/php_http_client/client.php
+++ b/php_http_client/client.php
@@ -55,7 +55,7 @@ class Client {
* @return: string
*/
private function _build_versioned_url($url) {
- return sprintf("%s/v%d%s", $this->host, $this->_version, $url);
+ return sprintf("%s/v%d%s", $this->host, $this->_get_version(), $url);
}
/**
@@ -70,16 +70,16 @@ class Client {
$count = 0;
while ($count < count($this->_url_path)) {
- $url += sprintf("/%s", $this->_url_path[count]);
- count+=1;
+ $url += sprintf("/%s", $this->_url_path[$count]);
+ $count+=1;
}
if (isset($query_params)) {
- $url_values = urlencode(asort(query_params));
+ $url_values = urlencode(asort($query_params));
$url = sprintf('%s?%s', $url, $url_values);
}
- if ($this->_version) {
+ if (null != $this->_get_version()) {
$url = $this->_build_versioned_url($url);
} else {
$url = $this->host + url;
@@ -119,7 +119,7 @@ class Client {
* @type request: urllib.Request object
* @return:
*/
- private function _make_request($opener, $request) {
+ private function _make_request($request) {
//@todo make the call using guzzle, and fix the return value
return null;
@@ -140,13 +140,15 @@ class Client {
*/
public function __call($name, $args){
+ // @todo handle args
+
if (in_array($name, $this->_methods)) {
- $this->_make_request();d
+ $this->_make_request();
return $this;
}
- $this->cache[$this->count] = $name;
- $this->count = $this->count + 1;
+ $this->_cache[$this->_count] = $name;
+ $this->_count = $this->_count + 1;
return $this;
}
@@ -154,21 +156,21 @@ class Client {
* @return: integer, status code of API call
*/
public function status_code() {
- return $this->status_code;
+ return $this->_status_code;
}
/**
* @return: response from the API
*/
public function response_body() {
- return $this->response_body;
+ return $this->_response_body;
}
/**
* @return: dict of response headers
*/
public function response_headers() {
- return $this->response_headers;
+ return $this->_response_headers;
}
/**
@@ -176,6 +178,7 @@ class Client {
*/
public function version($version) {
$this->_version = $version;
+ return $this;
}
private function _get_version() {