Completed
Push — master ( 5b4fc6...88c6b8 )
by Gideon
01:10
created
src/Gidkom/OpenFireRestApi/OpenFireRestApi.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
      * @return  array|false                     Array with data or error, or False when something went fully wrong
33 33
      */
34 34
     
35
-    protected function doRequest($type, $endpoint, $params=array())
35
+    protected function doRequest($type, $endpoint, $params = array())
36 36
     {
37 37
     	$base = ($this->useSSL) ? "https" : "http";
38
-    	$url = $base . "://" . $this->host . ":" .$this->port.$this->plugin.$endpoint;
38
+    	$url = $base."://".$this->host.":".$this->port.$this->plugin.$endpoint;
39 39
 	    
40 40
 	if ($this->useBasicAuth)
41
-            $auth = 'Basic ' . base64_encode($this->basicUser . ':' . $this->basicPwd);
41
+            $auth = 'Basic '.base64_encode($this->basicUser.':'.$this->basicPwd);
42 42
         else
43 43
             $auth = $this->secret;
44 44
 	    
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
                 $result = $this->client->get($url, compact('headers'));
55 55
                 break;
56 56
             case 'post':
57
-                $headers += ['Content-Type'=>'application/json'];
58
-                $result = $this->client->post($url, compact('headers','body'));
57
+                $headers += [ 'Content-Type'=>'application/json' ];
58
+                $result = $this->client->post($url, compact('headers', 'body'));
59 59
                 break;
60 60
             case 'delete':
61
-                $headers += ['Content-Type'=>'application/json'];
62
-                $result = $this->client->delete($url, compact('headers','body'));
61
+                $headers += [ 'Content-Type'=>'application/json' ];
62
+                $result = $this->client->delete($url, compact('headers', 'body'));
63 63
                 break;
64 64
             case 'put':
65
-                $headers += ['Content-Type'=>'application/json'];
66
-                $result = $this->client->put($url, compact('headers','body'));
65
+                $headers += [ 'Content-Type'=>'application/json' ];
66
+                $result = $this->client->put($url, compact('headers', 'body'));
67 67
                 break;
68 68
             default:
69 69
                 $result = null;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function getUsers()
87 87
     {
88 88
     	$endpoint = '/users';        
89
-    	return $this->doRequest('get',$endpoint);
89
+    	return $this->doRequest('get', $endpoint);
90 90
     }
91 91
 
92 92
 
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
      * @param   string[]|false  $groups     Groups  (Optional)
113 113
      * @return  json|false                 Json with data or error, or False when something went fully wrong
114 114
      */
115
-    public function addUser($username, $password, $name=false, $email=false, $groups=false)
115
+    public function addUser($username, $password, $name = false, $email = false, $groups = false)
116 116
     {
117 117
         $endpoint = '/users'; 
118
-        return $this->doRequest('post', $endpoint, compact('username', 'password','name','email', 'groups'));
118
+        return $this->doRequest('post', $endpoint, compact('username', 'password', 'name', 'email', 'groups'));
119 119
     }
120 120
 
121 121
 
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
      * @param   string[]|false  $groups     Groups (Optional)
142 142
      * @return  json|false                 Json with data or error, or False when something went fully wrong
143 143
      */
144
-    public function updateUser($username, $password, $name=false, $email=false, $groups=false)
144
+    public function updateUser($username, $password, $name = false, $email = false, $groups = false)
145 145
     {
146 146
         $endpoint = '/users/'.$username; 
147
-        return $this->doRequest('put', $endpoint, compact('username', 'password','name','email', 'groups'));
147
+        return $this->doRequest('put', $endpoint, compact('username', 'password', 'name', 'email', 'groups'));
148 148
     }
149 149
 
150 150
      /**
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
      * @param   int|false       $subscriptionType   	Subscription (Optional)
183 183
      * @return  json|false                     		Json with data or error, or False when something went fully wrong
184 184
      */
185
-    public function addToRoster($username, $jid, $name=false, $subscriptionType=false)
185
+    public function addToRoster($username, $jid, $name = false, $subscriptionType = false)
186 186
     {
187 187
         $endpoint = '/users/'.$username.'/roster';
188
-        return $this->doRequest('post', $endpoint, compact('jid','name','subscriptionType'));
188
+        return $this->doRequest('post', $endpoint, compact('jid', 'name', 'subscriptionType'));
189 189
     }
190 190
 
191 191
 
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
      * @param   int|false       $subscriptionType   Subscription (Optional)
212 212
      * @return  json|false                          Json with data or error, or False when something went fully wrong
213 213
      */
214
-    public function updateRoster($username, $jid, $nickname=false, $subscriptionType=false)
214
+    public function updateRoster($username, $jid, $nickname = false, $subscriptionType = false)
215 215
     {
216 216
         $endpoint = '/users/'.$username.'/roster/'.$jid;
217
-        return $this->doRequest('put', $endpoint, $jid, compact('jid','username','subscriptionType'));     
217
+        return $this->doRequest('put', $endpoint, $jid, compact('jid', 'username', 'subscriptionType'));     
218 218
     }
219 219
 
220 220
     /**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function createGroup($name, $description = false)
252 252
     {
253 253
         $endpoint = '/groups/';
254
-        return $this->doRequest('post', $endpoint, compact('name','description'));
254
+        return $this->doRequest('post', $endpoint, compact('name', 'description'));
255 255
     }
256 256
 
257 257
     /**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
      * @param   string      $description        Some description of the group
274 274
      *
275 275
      */
276
-    public function updateGroup($name,  $description)
276
+    public function updateGroup($name, $description)
277 277
     {
278 278
         $endpoint = '/groups/'.$name;
279
-        return $this->doRequest('put', $endpoint, compact('name','description'));
279
+        return $this->doRequest('put', $endpoint, compact('name', 'description'));
280 280
     }
281 281
 
282 282
     /**
Please login to merge, or discard this patch.