Completed
Push — master ( 1f9abb...2de529 )
by Gideon
05:43
created
src/Gidkom/OpenFireRestApi/RestClient.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
      * @param   array           $params         Parameters
34 34
      * @return  array|false                     Array with data or error, or False when something went fully wrong
35 35
      */
36
-	protected function doRequest($type, $endpoint, $params=[])
36
+	protected function doRequest($type, $endpoint, $params = [ ])
37 37
     {
38 38
     	$base = ($this->useSSL) ? "https" : "http";
39
-    	$url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint;
39
+    	$url = $base."://".$this->host.":".$this->port.$this->plugin.$endpoint;
40 40
 	    
41 41
 		if ($this->useBasicAuth)
42
-            $auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd);
42
+            $auth = 'Basic '.base64_encode($this->basicUser.':'.$this->basicPwd);
43 43
         else
44 44
             $auth = $this->secret;
45 45
 	    
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         $body = json_encode($params);
53 53
 
54 54
         try {
55
-        	$result = $this->client->request($type, $url, compact('headers','body'));
55
+        	$result = $this->client->request($type, $url, compact('headers', 'body'));
56 56
         } catch (\Exception $e) {
57
-        	return  ['status'=>false, 'data'=>['message'=>$e->getMessage()]];
57
+        	return  [ 'status'=>false, 'data'=>[ 'message'=>$e->getMessage() ] ];
58 58
         }
59 59
 	        
60 60
         
Please login to merge, or discard this patch.
src/Gidkom/OpenFireRestApi/OpenFireRestApi.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
    
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * @param   string          $params        Params
257 257
      * @return  json|false                     Json with data or error, or False when something went fully wrong
258 258
      */
259
-    public function createChatRoom($params = [])
259
+    public function createChatRoom($params = [ ])
260 260
     {
261 261
         return $this->doRequest('POST', '/chatrooms', $params);
262 262
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * @param   string          $params        Params
269 269
      * @return  json|false                     Json with data or error, or False when something went fully wrong
270 270
      */
271
-    public function updateChatRoom($roomName, $params = [])
271
+    public function updateChatRoom($roomName, $params = [ ])
272 272
     {
273 273
         return $this->doRequest('PUT', '/chatrooms/'.$roomName, $params);
274 274
     }
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     public function createGroup($name, $description = false)
448 448
     {
449 449
         $endpoint = '/groups/';
450
-        return $this->doRequest('POST', $endpoint, compact('name','description'));
450
+        return $this->doRequest('POST', $endpoint, compact('name', 'description'));
451 451
     }
452 452
 
453 453
     /**
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
      * @param   string      $description        Some description of the group
470 470
      *
471 471
      */
472
-    public function updateGroup($name,  $description)
472
+    public function updateGroup($name, $description)
473 473
     {
474 474
         $endpoint = '/groups/'.$name;
475
-        return $this->doRequest('PUT', $endpoint, compact('name','description'));
475
+        return $this->doRequest('PUT', $endpoint, compact('name', 'description'));
476 476
     }
477 477
 
478 478
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
      */
520 520
     public function broadcastMessage($message = '')
521 521
     {
522
-        $content =['body'=> $message];
522
+        $content = [ 'body'=> $message ];
523 523
         $endpoint = '/messages/users';
524 524
         return $this->doRequest('POST', $endpoint, $content);
525 525
     }
Please login to merge, or discard this patch.