Skip to content

Commit f9d06fb

Browse files
committed
Clean up parameter names
1 parent 5a5ce14 commit f9d06fb

File tree

2 files changed

+28
-42
lines changed

2 files changed

+28
-42
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,18 @@ Curl::buildPostData($data)
153153
Curl::call()
154154
Curl::close()
155155
Curl::complete($callback)
156-
Curl::delete($url_mixed, $data = array())
156+
Curl::delete($url, $data = array())
157157
Curl::download($url, $mixed_filename)
158158
Curl::error($callback)
159159
Curl::exec($ch = null)
160-
Curl::get($url_mixed, $data = array())
160+
Curl::get($url, $data = array())
161161
Curl::getOpt($option)
162-
Curl::head($url_mixed, $data = array())
162+
Curl::head($url, $data = array())
163163
Curl::headerCallback($ch, $header)
164-
Curl::options($url_mixed, $data = array())
165-
Curl::patch($url_mixed, $data = array())
166-
Curl::post($url_mixed, $data = array())
167-
Curl::put($url_mixed, $data = array())
164+
Curl::options($url, $data = array())
165+
Curl::patch($url, $data = array())
166+
Curl::post($url, $data = array())
167+
Curl::put($url, $data = array())
168168
Curl::setBasicAuthentication($username, $password = '')
169169
Curl::setCookie($key, $value)
170170
Curl::setCookieFile($cookie_file)

src/Curl/Curl.php

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,11 @@ public function complete($callback)
140140
$this->complete_function = $callback;
141141
}
142142

143-
public function delete($url_mixed, $data = array())
143+
public function delete($url, $data = array())
144144
{
145-
if (is_array($url_mixed)) {
145+
if (is_array($url)) {
146+
$data = $url;
146147
$url = $this->base_url;
147-
$data = $url_mixed;
148-
} else {
149-
$url = $url_mixed;
150148
}
151149
$this->setURL($url, $data);
152150
$this->unsetHeader('Content-Length');
@@ -244,13 +242,11 @@ public function exec($ch = null)
244242
return $this->response;
245243
}
246244

247-
public function get($url_mixed, $data = array())
245+
public function get($url, $data = array())
248246
{
249-
if (is_array($url_mixed)) {
247+
if (is_array($url)) {
248+
$data = $url;
250249
$url = $this->base_url;
251-
$data = $url_mixed;
252-
} else {
253-
$url = $url_mixed;
254250
}
255251
$this->setURL($url, $data);
256252
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
@@ -263,13 +259,11 @@ public function getOpt($option)
263259
return $this->options[$option];
264260
}
265261

266-
public function head($url_mixed, $data = array())
262+
public function head($url, $data = array())
267263
{
268-
if (is_array($url_mixed)) {
264+
if (is_array($url)) {
265+
$data = $url;
269266
$url = $this->base_url;
270-
$data = $url_mixed;
271-
} else {
272-
$url = $url_mixed;
273267
}
274268
$this->setURL($url, $data);
275269
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'HEAD');
@@ -283,27 +277,23 @@ public function headerCallback($ch, $header)
283277
return strlen($header);
284278
}
285279

286-
public function options($url_mixed, $data = array())
280+
public function options($url, $data = array())
287281
{
288-
if (is_array($url_mixed)) {
282+
if (is_array($url)) {
283+
$data = $url;
289284
$url = $this->base_url;
290-
$data = $url_mixed;
291-
} else {
292-
$url = $url_mixed;
293285
}
294286
$this->setURL($url, $data);
295287
$this->unsetHeader('Content-Length');
296288
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'OPTIONS');
297289
return $this->exec();
298290
}
299291

300-
public function patch($url_mixed, $data = array())
292+
public function patch($url, $data = array())
301293
{
302-
if (is_array($url_mixed)) {
294+
if (is_array($url)) {
295+
$data = $url;
303296
$url = $this->base_url;
304-
$data = $url_mixed;
305-
} else {
306-
$url = $url_mixed;
307297
}
308298
$this->setURL($url);
309299
$this->unsetHeader('Content-Length');
@@ -312,13 +302,11 @@ public function patch($url_mixed, $data = array())
312302
return $this->exec();
313303
}
314304

315-
public function post($url_mixed, $data = array())
305+
public function post($url, $data = array())
316306
{
317-
if (is_array($url_mixed)) {
307+
if (is_array($url)) {
308+
$data = $url;
318309
$url = $this->base_url;
319-
$data = $url_mixed;
320-
} else {
321-
$url = $url_mixed;
322310
}
323311

324312
if (is_array($data) && empty($data)) {
@@ -332,13 +320,11 @@ public function post($url_mixed, $data = array())
332320
return $this->exec();
333321
}
334322

335-
public function put($url_mixed, $data = array())
323+
public function put($url, $data = array())
336324
{
337-
if (is_array($url_mixed)) {
325+
if (is_array($url)) {
326+
$data = $url;
338327
$url = $this->base_url;
339-
$data = $url_mixed;
340-
} else {
341-
$url = $url_mixed;
342328
}
343329
$this->setURL($url);
344330
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');

0 commit comments

Comments
 (0)