Skip to content

Commit

Permalink
rename _exec() to exec()
Browse files Browse the repository at this point in the history
exec() is now a protected method which should not be called from outside
this class.  for BC reasons, _exec() is now just a public wrapper for exec()
and it is tagged as deprecated.
  • Loading branch information
zurborg committed Oct 20, 2016
1 parent 261ad3a commit 2eb9abc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ public function get($url, $data = array())
$this->setOpt(CURLOPT_URL, $url);
}
$this->setOpt(CURLOPT_HTTPGET, true);
$this->_exec();
$this->exec();
}

public function post($url, $data = array())
{
$this->setOpt(CURLOPT_URL, $url);
$this->preparePayload($data);
$this->_exec();
$this->exec();
}

public function put($url, $data = array(), $payload = false)
Expand All @@ -86,7 +86,7 @@ public function put($url, $data = array(), $payload = false)

$this->setOpt(CURLOPT_URL, $url);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
$this->_exec();
$this->exec();
}

public function patch($url, $data = array(), $payload = false)
Expand All @@ -99,7 +99,7 @@ public function patch($url, $data = array(), $payload = false)

$this->setOpt(CURLOPT_URL, $url);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
$this->_exec();
$this->exec();
}

public function delete($url, $data = array(), $payload = false)
Expand All @@ -111,7 +111,7 @@ public function delete($url, $data = array(), $payload = false)
}
$this->setOpt(CURLOPT_URL, $url);
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
$this->_exec();
$this->exec();
}

public function setBasicAuthentication($username, $password)
Expand Down Expand Up @@ -184,7 +184,15 @@ public function reset()
$this->init();
}

/**
* @deprecated calling exec() directly is discouraged
*/
public function _exec()
{
return $this->exec();
}

protected function exec()
{
$this->response = curl_exec($this->curl);
$this->curl_error_code = curl_errno($this->curl);
Expand Down

0 comments on commit 2eb9abc

Please sign in to comment.