Passed
Push — master ( 54cc1f...e6750d )
by Vince
01:44
created
src/responsible.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -359,7 +359,7 @@
 block discarded – undo
359 359
         $getJWT = (isset($options['getJWT']) && is_bool($options['getJWT']))
360 360
         ? $options['getJWT'] : true;
361 361
 
362
-        $getSecretAppend = (isset($options['secret']) && ($options['secret'] == 'append') )
362
+        $getSecretAppend = (isset($options['secret']) && ($options['secret'] == 'append'))
363 363
         ? $options['secret'] : false;
364 364
 
365 365
         return (new user\user)
Please login to merge, or discard this patch.
src/core/auth/jwtValidate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     public static function payload(array $payloadObject = [])
67 67
     {
68
-        if( isset($payloadObject['scope']) && $payloadObject['scope'] == 'anonymous' ) {
68
+        if (isset($payloadObject['scope']) && $payloadObject['scope'] == 'anonymous') {
69 69
             return true;
70 70
         }
71 71
 
Please login to merge, or discard this patch.
src/core/auth/jwtDecoder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
          */
51 51
         $payloadObject = $cipher->jsonDecode($cipher->decode($jwtPayload));
52 52
 
53
-        if( $this->key == 'payloadOnly' ) {
53
+        if ($this->key == 'payloadOnly') {
54 54
             return $payloadObject;
55 55
         }
56 56
 
Please login to merge, or discard this patch.
src/core/auth/authorise.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         /**
64 64
          * Check if a custom scope is set
65 65
          */
66
-        if( isset($this->header->getMethod()->data['scope']) && 
66
+        if (isset($this->header->getMethod()->data['scope']) && 
67 67
             ($this->header->getMethod()->data['scope'] == 'anonymous')
68 68
         ) {
69 69
             $this->grantAccess = true;
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
                 ->decode()
102 102
             ;
103 103
 
104
-            if( isset($decoded['sub']) && !empty($decoded['sub']) ) {
104
+            if (isset($decoded['sub']) && !empty($decoded['sub'])) {
105 105
 
106 106
                 $this->user = (object) (new user\user)
107 107
                     ->setOptions($this->getOptions())
108 108
                     ->load($decoded['sub'], ['refreshToken' => true])
109 109
                 ;
110 110
 
111
-                if ( !empty($this->user) ) {
111
+                if (!empty($this->user)) {
112 112
                     $jwt = new auth\jwt;
113 113
                     $decoded = $jwt
114 114
                         ->setOptions($this->getOptions())
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         ->decode()
118 118
                     ;
119 119
                 }
120
-            }else{
120
+            } else {
121 121
 
122 122
                 $this->header->unauthorised();
123 123
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
          * [$user Check user account]
128 128
          * @var [object]
129 129
          */
130
-        if ( (isset($decoded['sub']) && !empty($decoded['sub'])) && !$this->user ) {
130
+        if ((isset($decoded['sub']) && !empty($decoded['sub'])) && !$this->user) {
131 131
             $this->user = (object) (new user\user)
132 132
                 ->setOptions($this->getOptions())
133 133
                 ->load($decoded['sub'], ['refreshToken' => true])
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public function user()
150 150
     {
151
-        if( $this->isGrantType() ) {
151
+        if ($this->isGrantType()) {
152 152
             return (object) [
153 153
                 'uid' => -1,
154 154
                 'account_id' => 0,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             return;
178 178
         }
179 179
 
180
-        if( isset($this->header->getMethod()->data['scope']) && 
180
+        if (isset($this->header->getMethod()->data['scope']) && 
181 181
             ($this->header->getMethod()->data['scope'] == 'anonymous')
182 182
         ) {
183 183
             return;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
                         ->decode()
118 118
                     ;
119 119
                 }
120
-            }else{
120
+            } else{
121 121
 
122 122
                 $this->header->unauthorised();
123 123
             }
Please login to merge, or discard this patch.
src/core/keys/key.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function apiKeyGenerate($length = 32)
37 37
     {
38
-        $randInt = microtime().rand(1000, 9999);
38
+        $randInt = microtime() . rand(1000, 9999);
39 39
         $messageDigest = md5($randInt);
40 40
         return implode(
41 41
             '-',
Please login to merge, or discard this patch.
src/core/endpoints/map.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $directory = $customService['directory'];
89 89
             $middleware = $customService['namespace'];
90 90
 
91
-        }else {
91
+        } else {
92 92
             $middleware = 'responsible';
93 93
 
94 94
             $endpoint = str_replace(
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 if (class_exists($child)) {
136 136
                     self::$middleWareClass = new $child;
137 137
                     $this->registry[$point] = self::$middleWareClass->register();
138
-                }else{
138
+                } else{
139 139
                     (new exception\errorException)
140 140
                         ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.")
141 141
                         ->error('NOT_EXTENDED');
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                         if( is_array($classScope) && isset($classScope[$position]) ) {
216 216
                             $endpointSettings['model']['scope'] = $classScope[$position];
217 217
 
218
-                        }else{
218
+                        } else{
219 219
 
220 220
                             if( !is_array($classScope) ) {
221 221
                                 $endpointSettings['model']['scope'] = $classScope;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                             if( is_array($classScope) && isset($classScope[$position]) ) {
275 275
                                 $scope = $classScope[$position];
276 276
 
277
-                            }else{
277
+                            } else{
278 278
 
279 279
                                 if( !is_array($classScope) ) {
280 280
                                     $scope = $classScope;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
         /**
77 77
          * Check if a custom directory was set in the Responsible API options
78 78
          */
79
-        if( (isset($options['classRoute']) && !empty($options['classRoute'])) && 
79
+        if ((isset($options['classRoute']) && !empty($options['classRoute'])) && 
80 80
             (isset($options['classRoute']['directory']) && isset($options['classRoute']['namespace']))
81 81
         ) {
82 82
             $customService = $this->options['classRoute'];
83 83
             $directory = $customService['directory'];
84 84
             $middleware = $customService['namespace'];
85 85
 
86
-        }else {
86
+        } else {
87 87
             $middleware = 'responsible';
88 88
 
89 89
             $endpoint = str_replace(
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 if (class_exists($child)) {
136 136
                     self::$middleWareClass = new $child;
137 137
                     $this->registry[$point] = self::$middleWareClass->register();
138
-                }else{
138
+                } else {
139 139
                     (new exception\errorException)
140 140
                         ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.")
141 141
                         ->error('NOT_EXTENDED');
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
                  * @var array
207 207
                  */
208 208
                 if (array_search($endpoint, $this->registry[$api]) !== false) {
209
-                    if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) {
209
+                    if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) {
210 210
                         $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope();
211 211
                         $position = array_search($endpoint, $this->registry[$api]);
212 212
                         
213
-                        if( is_array($classScope) && isset($classScope[$position]) ) {
213
+                        if (is_array($classScope) && isset($classScope[$position])) {
214 214
                             $endpointSettings['model']['scope'] = $classScope[$position];
215 215
 
216
-                        }else{
216
+                        } else {
217 217
 
218
-                            if( !is_array($classScope) ) {
218
+                            if (!is_array($classScope)) {
219 219
                                 $endpointSettings['model']['scope'] = $classScope;
220 220
                             }
221 221
                         }
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 
267 267
                         $scope = 'private';
268 268
 
269
-                        if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) {
269
+                        if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) {
270 270
                             $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope();
271 271
                             $position = array_search($path, $this->registry[$api]);
272 272
                             
273
-                            if( is_array($classScope) && isset($classScope[$position]) ) {
273
+                            if (is_array($classScope) && isset($classScope[$position])) {
274 274
                                 $scope = $classScope[$position];
275 275
 
276
-                            }else{
276
+                            } else {
277 277
 
278
-                                if( !is_array($classScope) ) {
278
+                                if (!is_array($classScope)) {
279 279
                                     $scope = $classScope;
280 280
                                 }
281 281
                             }
Please login to merge, or discard this patch.
src/core/user/user.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
      */
131 131
     private function updateAccount($properties)
132 132
     {
133
-        if( is_array($properties) ) {
133
+        if (is_array($properties)) {
134 134
             $properties = (object) $properties; //json_decode(json_encode($properties));
135 135
         }
136 136
 
137
-        if( !isset($properties->update) || 
137
+        if (!isset($properties->update) || 
138 138
             !isset($properties->where) || 
139 139
             (isset($properties->update) && !is_array($properties->update)) ||
140 140
             (isset($properties->where) && !is_array($properties->where))
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
          * @var [type]
162 162
          */
163 163
         foreach ($properties->update as $u => $update) {
164
-            if( !in_array($u, $allowedFileds) ) {
164
+            if (!in_array($u, $allowedFileds)) {
165 165
                 unset($properties->update[$u]);
166
-            }else{
166
+            } else {
167 167
                 $set .= $u . ' = :' . $u . ',';
168 168
                 $binds[$u] = $update;
169 169
             }
170 170
         }
171 171
 
172 172
         $set = rtrim($set, ',');
173
-        $where =  key($properties->where) . ' = ' . $properties->where[key($properties->where)];
173
+        $where = key($properties->where) . ' = ' . $properties->where[key($properties->where)];
174 174
 
175 175
         return $this->DB()->
176 176
             query(
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $options = $this->getOptions();
215 215
         $skipValidatation = false;
216 216
 
217
-        if( isset($options['validate']) && $options['validate'] == false ) {
217
+        if (isset($options['validate']) && $options['validate'] == false) {
218 218
             $skipValidatation = true;
219 219
         }
220 220
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 break;
231 231
 
232 232
             case 'mail':
233
-                if( !filter_var($property, FILTER_VALIDATE_EMAIL) && !$skipValidatation) {
233
+                if (!filter_var($property, FILTER_VALIDATE_EMAIL) && !$skipValidatation) {
234 234
                     return;
235 235
                 }
236 236
                 $this->mail = $property;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
         foreach ($properties->update as $u => $update) {
164 164
             if( !in_array($u, $allowedFileds) ) {
165 165
                 unset($properties->update[$u]);
166
-            }else{
166
+            } else{
167 167
                 $set .= $u . ' = :' . $u . ',';
168 168
                 $binds[$u] = $update;
169 169
             }
Please login to merge, or discard this patch.
src/core/exception/errorException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 'MESSAGE' => $message,
171 171
             ), JSON_PRETTY_PRINT);
172 172
 
173
-            if( isset($options['errors']) && $options['errors'] == 'catchAll' ) {
173
+            if (isset($options['errors']) && $options['errors'] == 'catchAll') {
174 174
                 throw new \Exception($eMessage, 1);
175 175
             }
176 176
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 'MESSAGE' => $message,
186 186
             ), JSON_PRETTY_PRINT);
187 187
 
188
-            if( isset($options['errors']) && $options['errors'] == 'catchAll' ) {
188
+            if (isset($options['errors']) && $options['errors'] == 'catchAll') {
189 189
                 throw new \Exception($eMessage, 1);
190 190
             }
191 191
 
Please login to merge, or discard this patch.
src/core/headers/header.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         foreach ($headers_list as $index => $headValue) {
190 190
             @list($key, $value) = explode(": ", $headValue);
191 191
             
192
-            if (!is_null($key) && !is_null($value) ) {
192
+            if (!is_null($key) && !is_null($value)) {
193 193
                 $headers_list[$key] = $value;
194 194
                 unset($headers_list[$index]);
195 195
             }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $apacheRequestHeaders = apache_request_headers();
202 202
         }
203 203
 
204
-        if( is_null($apacheRequestHeaders) || empty($apacheRequestHeaders) ) {
204
+        if (is_null($apacheRequestHeaders) || empty($apacheRequestHeaders)) {
205 205
             return [];
206 206
         }
207 207
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             '*',
260 260
         ));
261 261
 
262
-        if( !array_key_exists('Access-Control-Allow-Methods', $this->getHeaders()) ) {
262
+        if (!array_key_exists('Access-Control-Allow-Methods', $this->getHeaders())) {
263 263
             $this->setHeader('Access-Control-Allow-Methods', array(
264 264
                 'GET,POST,OPTIONS',
265 265
             ));
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                     )
459 459
                 );
460 460
 
461
-            if( empty($account) ) {
461
+            if (empty($account)) {
462 462
                 $this->unauthorised();
463 463
             }
464 464
 
Please login to merge, or discard this patch.