Skip to content

Commit 6a0ec03

Browse files
committed
moved from array() to []
1 parent 85a305a commit 6a0ec03

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/RestClient.class.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ class RestClient
4444
protected function request($path, $method = "GET", $payload = null, $encoded = false)
4545
{
4646
$ch = curl_init();
47-
curl_setopt_array($ch, array(
48-
CURLOPT_URL => $this->url.'/api/v1'.$path,
49-
CURLOPT_HTTPHEADER => array(
50-
"Accept:application/json, text/plain, */*",
51-
"Content-Type:application/json",
52-
"Authorization: Bearer ".$this->token
53-
),
54-
CURLOPT_CUSTOMREQUEST => $method,
55-
CURLOPT_RETURNTRANSFER => true,
56-
CURLOPT_SSL_VERIFYHOST => false,
57-
CURLOPT_SSL_VERIFYPEER => false,
58-
CURLOPT_TIMEOUT_MS => $this->timeout
59-
));
47+
curl_setopt_array($ch, [
48+
CURLOPT_URL => $this->url.'/api/v1'.$path,
49+
CURLOPT_HTTPHEADER => [
50+
"Accept: application/json, text/plain, */*",
51+
"Content-Type: application/json",
52+
"Authorization: Bearer ".$this->token
53+
],
54+
CURLOPT_CUSTOMREQUEST => $method,
55+
CURLOPT_RETURNTRANSFER => true,
56+
CURLOPT_SSL_VERIFYHOST => false,
57+
CURLOPT_SSL_VERIFYPEER => false,
58+
CURLOPT_TIMEOUT_MS => $this->timeout
59+
]);
6060
if ($payload != null) {
6161
if ($encoded) {
6262
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
@@ -67,11 +67,17 @@ protected function request($path, $method = "GET", $payload = null, $encoded = f
6767
$data = curl_exec($ch);
6868

6969
if ($data === false) {
70-
$data = array('success' => false, 'error' => curl_error($ch));
70+
$data = [
71+
'success' => false,
72+
'error' => curl_error($ch)
73+
];
7174
} else {
7275
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
7376
if ($httpcode != 200 and $httpcode != 201) {
74-
$data = array('success' => false, 'error' => $this->getError($httpcode));
77+
$data = [
78+
'success' => false,
79+
'error' => $this->getError($httpcode)
80+
];
7581
}
7682
}
7783

0 commit comments

Comments
 (0)