Skip to content

Commit 2eb9abc

Browse files
committed
rename _exec() to exec()
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.
1 parent 261ad3a commit 2eb9abc

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/Curl/Curl.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public function get($url, $data = array())
6666
$this->setOpt(CURLOPT_URL, $url);
6767
}
6868
$this->setOpt(CURLOPT_HTTPGET, true);
69-
$this->_exec();
69+
$this->exec();
7070
}
7171

7272
public function post($url, $data = array())
7373
{
7474
$this->setOpt(CURLOPT_URL, $url);
7575
$this->preparePayload($data);
76-
$this->_exec();
76+
$this->exec();
7777
}
7878

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

8787
$this->setOpt(CURLOPT_URL, $url);
8888
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
89-
$this->_exec();
89+
$this->exec();
9090
}
9191

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

100100
$this->setOpt(CURLOPT_URL, $url);
101101
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PATCH');
102-
$this->_exec();
102+
$this->exec();
103103
}
104104

105105
public function delete($url, $data = array(), $payload = false)
@@ -111,7 +111,7 @@ public function delete($url, $data = array(), $payload = false)
111111
}
112112
$this->setOpt(CURLOPT_URL, $url);
113113
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'DELETE');
114-
$this->_exec();
114+
$this->exec();
115115
}
116116

117117
public function setBasicAuthentication($username, $password)
@@ -184,7 +184,15 @@ public function reset()
184184
$this->init();
185185
}
186186

187+
/**
188+
* @deprecated calling exec() directly is discouraged
189+
*/
187190
public function _exec()
191+
{
192+
return $this->exec();
193+
}
194+
195+
protected function exec()
188196
{
189197
$this->response = curl_exec($this->curl);
190198
$this->curl_error_code = curl_errno($this->curl);

0 commit comments

Comments
 (0)