@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return json|false Json with data or error, or False when something went fully wrong |
23 | 23 | */ |
24 | - public function getUsers($opts = []) |
|
24 | + public function getUsers($opts = [ ]) |
|
25 | 25 | { |
26 | 26 | $query = ''; |
27 | 27 | |
28 | - if(isset($opts['search'])) $query .= '?search='.$opts['search']; |
|
28 | + if (isset($opts[ 'search' ])) $query .= '?search='.$opts[ 'search' ]; |
|
29 | 29 | |
30 | 30 | $endpoint = '/users'.$query; |
31 | 31 | return $this->doRequest('GET', $endpoint); |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | * @param string[]|false $groups Groups (Optional) |
55 | 55 | * @return json|false Json with data or error, or False when something went fully wrong |
56 | 56 | */ |
57 | - public function addUser($username, $password, $name=false, $email=false, $groups=false) |
|
57 | + public function addUser($username, $password, $name = false, $email = false, $groups = false) |
|
58 | 58 | { |
59 | 59 | $endpoint = '/users'; |
60 | - return $this->doRequest('POST', $endpoint, compact('username', 'password','name','email', 'groups')); |
|
60 | + return $this->doRequest('POST', $endpoint, compact('username', 'password', 'name', 'email', 'groups')); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | * @param string[]|false $groups Groups (Optional) |
84 | 84 | * @return json|false Json with data or error, or False when something went fully wrong |
85 | 85 | */ |
86 | - public function updateUser($username, $password, $name=false, $email=false, $groups=false) |
|
86 | + public function updateUser($username, $password, $name = false, $email = false, $groups = false) |
|
87 | 87 | { |
88 | 88 | $endpoint = '/users/'.$username; |
89 | - return $this->doRequest('PUT', $endpoint, compact('username', 'password','name','email', 'groups')); |
|
89 | + return $this->doRequest('PUT', $endpoint, compact('username', 'password', 'name', 'email', 'groups')); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public function addToGroup($username, $groupName) |
126 | 126 | { |
127 | 127 | $endpoint = '/users/'.$username.'/groups/'.$groupName; |
128 | - return $this->doRequest('POST', $endpoint ); |
|
128 | + return $this->doRequest('POST', $endpoint); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function deleteFromGroup($username, $groupName) |
140 | 140 | { |
141 | 141 | $endpoint = '/users/'.$username.'/groups/'.$groupName; |
142 | - return $this->doRequest('DELETE', $endpoint ); |
|
142 | + return $this->doRequest('DELETE', $endpoint); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function userRosters($username) |
179 | 179 | { |
180 | 180 | $endpoint = '/users/'.$username.'/roster'; |
181 | - return $this->doRequest('GET', $endpoint, compact('jid','name','subscriptionType')); |
|
181 | + return $this->doRequest('GET', $endpoint, compact('jid', 'name', 'subscriptionType')); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @param int|false $subscriptionType Subscription (Optional) |
192 | 192 | * @return json|false Json with data or error, or False when something went fully wrong |
193 | 193 | */ |
194 | - public function addToRoster($username, $jid, $name=false, $subscriptionType=false) |
|
194 | + public function addToRoster($username, $jid, $name = false, $subscriptionType = false) |
|
195 | 195 | { |
196 | 196 | $endpoint = '/users/'.$username.'/roster'; |
197 | - return $this->doRequest('POST', $endpoint, compact('jid','name','subscriptionType')); |
|
197 | + return $this->doRequest('POST', $endpoint, compact('jid', 'name', 'subscriptionType')); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | * @param int|false $subscriptionType Subscription (Optional) |
221 | 221 | * @return json|false Json with data or error, or False when something went fully wrong |
222 | 222 | */ |
223 | - public function updateRoster($username, $jid, $nickname=false, $subscriptionType=false) |
|
223 | + public function updateRoster($username, $jid, $nickname = false, $subscriptionType = false) |
|
224 | 224 | { |
225 | 225 | $endpoint = '/users/'.$username.'/roster/'.$jid; |
226 | - return $this->doRequest('PUT', $endpoint, $jid, compact('jid','username','subscriptionType')); |
|
226 | + return $this->doRequest('PUT', $endpoint, $jid, compact('jid', 'username', 'subscriptionType')); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function createGroup($name, $description = false) |
261 | 261 | { |
262 | 262 | $endpoint = '/groups/'; |
263 | - return $this->doRequest('POST', $endpoint, compact('name','description')); |
|
263 | + return $this->doRequest('POST', $endpoint, compact('name', 'description')); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | * @param string $description Some description of the group |
283 | 283 | * |
284 | 284 | */ |
285 | - public function updateGroup($name, $description) |
|
285 | + public function updateGroup($name, $description) |
|
286 | 286 | { |
287 | 287 | $endpoint = '/groups/'.$name; |
288 | - return $this->doRequest('PUT', $endpoint, compact('name','description')); |
|
288 | + return $this->doRequest('PUT', $endpoint, compact('name', 'description')); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function geti() |
29 | 29 | { |
30 | - return $this->host. ' '. $this->secret; |
|
30 | + return $this->host.' '.$this->secret; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * @param array $params Parameters |
41 | 41 | * @return array|false Array with data or error, or False when something went fully wrong |
42 | 42 | */ |
43 | - protected function doRequest($type, $endpoint, $params=[]) |
|
43 | + protected function doRequest($type, $endpoint, $params = [ ]) |
|
44 | 44 | { |
45 | 45 | $base = ($this->useSSL) ? "https" : "http"; |
46 | - $url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint; |
|
46 | + $url = $base."://".$this->host.":".$this->port.$this->plugin.$endpoint; |
|
47 | 47 | |
48 | 48 | if ($this->useBasicAuth) |
49 | - $auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd); |
|
49 | + $auth = 'Basic '.base64_encode($this->basicUser.':'.$this->basicPwd); |
|
50 | 50 | else |
51 | 51 | $auth = $this->secret; |
52 | 52 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | |
62 | 62 | try { |
63 | - $result = $this->client->request($type, $url, compact('headers','body')); |
|
63 | + $result = $this->client->request($type, $url, compact('headers', 'body')); |
|
64 | 64 | } catch (Exception $e) { |
65 | 65 | $result = $e->message; |
66 | 66 | } |