Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 16f50d0

Browse files
Change variable name
1 parent 4861152 commit 16f50d0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/UnitRequest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class UnitRequest
88
{
99
private string $_method = 'GET';
1010

11-
private $_data = null;
11+
private mixed $_data;
1212

1313
/**
1414
* Constructor
@@ -38,7 +38,7 @@ public function setMethod(string $method): void
3838
*
3939
* @param null $data
4040
*/
41-
public function setData($data): void
41+
public function setData(mixed $data): void
4242
{
4343
$this->_data = $data;
4444
}
@@ -50,29 +50,29 @@ public function setData($data): void
5050
*/
5151
public function send($uri)
5252
{
53-
$ch = curl_init();
53+
$curlHandler = curl_init();
5454

55-
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, $this->socket);
56-
curl_setopt($ch, CURLOPT_URL, $this->address . $uri);
57-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
55+
curl_setopt($curlHandler, CURLOPT_UNIX_SOCKET_PATH, $this->socket);
56+
curl_setopt($curlHandler, CURLOPT_URL, $this->address . $uri);
57+
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
5858

5959
if ($this->_method) {
60-
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, mb_strtoupper($this->_method));
60+
curl_setopt($curlHandler, CURLOPT_CUSTOMREQUEST, mb_strtoupper($this->_method));
6161
}
6262

6363
if (!empty($this->_data)) {
64-
curl_setopt($ch, CURLOPT_HTTPHEADER, [
64+
curl_setopt($curlHandler, CURLOPT_HTTPHEADER, [
6565
'Content-Type: application/x-www-form-urlencoded',
6666
]);
6767

68-
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_data);
68+
curl_setopt($curlHandler, CURLOPT_POSTFIELDS, $this->_data);
6969
}
7070

71-
$result = curl_exec($ch);
72-
if (curl_errno($ch)) {
73-
throw new UnitException('Error:' . curl_error($ch));
71+
$result = curl_exec($curlHandler);
72+
if (curl_errno($curlHandler)) {
73+
throw new UnitException('Error:' . curl_error($curlHandler));
7474
}
75-
curl_close($ch);
75+
curl_close($curlHandler);
7676

7777
return json_decode($result, true);
7878
}

0 commit comments

Comments
 (0)