@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - protected $permission_level = ['read' => null, 'edit' => null]; |
|
23 | + protected $permission_level = [ 'read' => null, 'edit' => null ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Holds the provided email address for API authentication |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | $num_args = func_num_args(); |
61 | 61 | if ($num_args === 1) { |
62 | 62 | $parameters = func_get_args(); |
63 | - $client = $parameters[0]; |
|
63 | + $client = $parameters[ 0 ]; |
|
64 | 64 | $this->email = $client->email; |
65 | 65 | $this->auth_key = $client->auth_key; |
66 | 66 | $this->curl_options = $client->curl_options; |
67 | 67 | $this->permissions = $client->permissions; |
68 | 68 | } elseif ($num_args === 2) { |
69 | 69 | $parameters = func_get_args(); |
70 | - $this->email = $parameters[0]; |
|
71 | - $this->auth_key = $parameters[1]; |
|
70 | + $this->email = $parameters[ 0 ]; |
|
71 | + $this->auth_key = $parameters[ 1 ]; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function setCurlOption($key, $value) |
102 | 102 | { |
103 | - $this->curl_options[$key] = $value; |
|
103 | + $this->curl_options[ $key ] = $value; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | if (!$this->permissions) { |
167 | 167 | $api = new User($this->email, $this->auth_key); |
168 | 168 | $user = $api->user(); |
169 | - if (!$user->result->organizations[0]) { |
|
170 | - $this->permissions = ['read' => true, 'write' => true]; |
|
169 | + if (!$user->result->organizations[ 0 ]) { |
|
170 | + $this->permissions = [ 'read' => true, 'write' => true ]; |
|
171 | 171 | } else { |
172 | - $this->permissions = $user->result->organizations[0]->permissions; |
|
172 | + $this->permissions = $user->result->organizations[ 0 ]->permissions; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | |
194 | 194 | return false; |
195 | 195 | } |
196 | - $data = (is_null($data) ? [] : $data); |
|
196 | + $data = (is_null($data) ? [ ] : $data); |
|
197 | 197 | $method = (is_null($method) ? 'get' : $method); |
198 | 198 | $permission_level = (is_null($permission_level) ? 'read' : $permission_level); |
199 | 199 | |
200 | - if (!is_null($this->permission_level[$permission_level])) { |
|
200 | + if (!is_null($this->permission_level[ $permission_level ])) { |
|
201 | 201 | if (!$this->permissions) { |
202 | 202 | $this->permissions(); |
203 | 203 | } |
204 | - if (!isset($this->permissions) || !in_array($this->permission_level[$permission_level], $this->permissions)) { |
|
204 | + if (!isset($this->permissions) || !in_array($this->permission_level[ $permission_level ], $this->permissions)) { |
|
205 | 205 | throw new Exception('You do not have permission to perform this request'); |
206 | 206 | |
207 | 207 | return false; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | |
212 | 212 | //Removes null entries |
213 | - $data = array_filter($data, function ($val) { |
|
213 | + $data = array_filter($data, function($val) { |
|
214 | 214 | return !is_null($val); |
215 | 215 | }); |
216 | 216 | |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | $curl_options = array_replace($default_curl_options, $this->curl_options); |
234 | 234 | } |
235 | 235 | |
236 | - $headers = ["X-Auth-Email: {$this->email}", "X-Auth-Key: {$this->auth_key}"]; |
|
236 | + $headers = [ "X-Auth-Email: {$this->email}", "X-Auth-Key: {$this->auth_key}" ]; |
|
237 | 237 | |
238 | 238 | $ch = curl_init(); |
239 | 239 | curl_setopt_array($ch, $curl_options); |
240 | 240 | |
241 | - $headers[] = 'Content-type: application/json'; |
|
241 | + $headers[ ] = 'Content-type: application/json'; |
|
242 | 242 | $json_data = json_encode($data); |
243 | 243 | |
244 | 244 | if ($method === 'post') { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected $permission_level = ['read' => '#railgun:read', 'edit' => '#railgun:edit']; |
|
22 | + protected $permission_level = [ 'read' => '#railgun:read', 'edit' => '#railgun:edit' ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Create Railgun (permission needed: #railgun:edit) |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected $permission_level = ['read' => '#billing:read', 'edit' => '#billing:edit']; |
|
25 | + protected $permission_level = [ 'read' => '#billing:read', 'edit' => '#billing:edit' ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * List access rules (permission needed: #billing:read) |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @var array |
25 | 25 | */ |
26 | - protected $permission_level = ['read' => '#billing:read', 'edit' => '#billing:edit']; |
|
26 | + protected $permission_level = [ 'read' => '#billing:read', 'edit' => '#billing:edit' ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * List (permission needed: #billing:read) |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @var array |
25 | 25 | */ |
26 | - protected $permission_level = ['read' => '#billing:read', 'edit' => '#billing:edit']; |
|
26 | + protected $permission_level = [ 'read' => '#billing:read', 'edit' => '#billing:edit' ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * List (permission needed: #billing:read) |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $permission_level = ['read' => '#organizations:read', 'edit' => '#organizations:edit']; |
|
24 | + protected $permission_level = [ 'read' => '#organizations:read', 'edit' => '#organizations:edit' ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * List organizations (permission needed: #organizations:read) |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected $permission_level = ['read' => '#dns_records:read', 'edit' => '#dns_records:edit']; |
|
25 | + protected $permission_level = [ 'read' => '#dns_records:read', 'edit' => '#dns_records:edit' ]; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Get Virtual DNS Clusters (permission needed: #dns_records:read) |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $permission_level = ['read' => '#billing:read', 'edit' => '#billing:edit']; |
|
24 | + protected $permission_level = [ 'read' => '#billing:read', 'edit' => '#billing:edit' ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Billing Profile (permission needed: #billing:read) |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $permission_level = ['read' => '#invites:read', 'edit' => '#invites:edit']; |
|
24 | + protected $permission_level = [ 'read' => '#invites:read', 'edit' => '#invites:edit' ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * List invitations (permission needed: #invites:read) |