Completed
Branch master (23ba9e)
by Ivan
03:43 queued 01:21
created
source/VKBase.php 2 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
             if (!$this->isPermissionsMaskSet) {
96 96
                 $VKUser = new VKUsers($this);
97 97
                 $VKAccount = new VKAccount($this);
98
-                $CurrentUser = $VKUser->get([''])['response'][0]['uid'];
99
-                $this->setPermissionsMask($VKAccount->getAppPermissions($CurrentUser)['response']);
98
+                $CurrentUser = $VKUser->get([ '' ])[ 'response' ][ 0 ][ 'uid' ];
99
+                $this->setPermissionsMask($VKAccount->getAppPermissions($CurrentUser)[ 'response' ]);
100 100
                 $this->isPermissionsMaskSet = true;
101 101
                 unset($VKUser);
102 102
                 unset($VKAccount);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @return string
127 127
      */
128 128
     public function getAPIUrl($apiMethod, $responseFormat = 'json') {
129
-        return self::METHOD_URL . $apiMethod . '.' . $responseFormat;
129
+        return self::METHOD_URL.$apiMethod.'.'.$responseFormat;
130 130
     }
131 131
 
132 132
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      * @return string
139 139
      */
140 140
     public function getAuthorizationURL($apiSettings = '', $callbackURL = self::DEFAULT_CALLBACK, $responseType = 'code', $testMode = false) {
141
-        $allowedTypes = ['token', 'code'];
141
+        $allowedTypes = [ 'token', 'code' ];
142 142
         $requestParameters = [
143 143
             'client_id'     =>  $this->applicationID,
144 144
             'scope'         =>  $apiSettings,
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             'response_type' =>  (in_array($responseType, $allowedTypes)) ? $responseType : 'code'
147 147
         ];
148 148
 
149
-        if ($testMode) $requestParameters['test_mode'] = 1;
149
+        if ($testMode) $requestParameters[ 'test_mode' ] = 1;
150 150
 
151 151
         return $this->createURL(self::AUTHORIZATION_URL, $requestParameters);
152 152
     }
@@ -173,16 +173,16 @@  discard block
 block discarded – undo
173 173
         $apiResponse = json_decode($this->performRequest($this->createURL(self::ACCESS_TOKEN_URL, $requestParameters)), true);
174 174
 
175 175
         try {
176
-            if (isset($apiResponse['error'])) {
177
-                throw new VKException($apiResponse['error'] . (!isset($apiResponse['error_description']) ?: ': ' . $apiResponse['error_description']), '0');
176
+            if (isset($apiResponse[ 'error' ])) {
177
+                throw new VKException($apiResponse[ 'error' ].(!isset($apiResponse[ 'error_description' ]) ?: ': '.$apiResponse[ 'error_description' ]), '0');
178 178
             } else {
179 179
                 $this->authorizationStatus = true;
180
-                $this->accessToken = $apiResponse['access_token'];
180
+                $this->accessToken = $apiResponse[ 'access_token' ];
181 181
                 return $apiResponse;
182 182
             }
183 183
         } catch (VKException $ex) {
184 184
             echo $ex->getMessage();
185
-            return [];
185
+            return [ ];
186 186
         }
187 187
     }
188 188
 
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
      * @param string $requestMethod
204 204
      * @return mixed
205 205
      */
206
-    public function apiQuery($apiMethod, $requestParameters = [], $resultType = 'array', $requestMethod = 'get') {
207
-        $requestParameters['timestamp'] = time();
208
-        $requestParameters['api_id']    = $this->applicationID;
209
-        $requestParameters['random']    = rand(0, 10000);
206
+    public function apiQuery($apiMethod, $requestParameters = [ ], $resultType = 'array', $requestMethod = 'get') {
207
+        $requestParameters[ 'timestamp' ] = time();
208
+        $requestParameters[ 'api_id' ]    = $this->applicationID;
209
+        $requestParameters[ 'random' ]    = rand(0, 10000);
210 210
 
211 211
         if (!array_key_exists('access_token', $requestParameters) && !is_null($this->accessToken)) {
212
-            $requestParameters['access_token'] = $this->accessToken;
212
+            $requestParameters[ 'access_token' ] = $this->accessToken;
213 213
         }
214 214
 
215 215
         if (!array_key_exists('v', $requestParameters) && !is_null($this->APIVersion)) {
216
-            $requestParameters['v'] = $this->APIVersion;
216
+            $requestParameters[ 'v' ] = $this->APIVersion;
217 217
         }
218 218
 
219 219
         ksort($requestParameters);
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
             if (is_array($pValue)) {
224 224
                 $pValue = implode(', ', $pValue);
225 225
             }
226
-            $parametersSignature .= $pKey . '=' . $pValue;
226
+            $parametersSignature .= $pKey.'='.$pValue;
227 227
         }
228 228
         $parametersSignature .= $this->APISecret;
229 229
 
230
-        $requestParameters['sig'] = md5($parametersSignature);
230
+        $requestParameters[ 'sig' ] = md5($parametersSignature);
231 231
 
232 232
         if ($apiMethod == 'execute' || $requestMethod == 'post') {
233 233
             $apiResponse = $this->performRequest($this->getAPIUrl($apiMethod, $resultType == 'array' ? 'json' : $resultType), "POST", $requestParameters);
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 
238 238
         try {
239 239
             $decodedJSON = json_decode($apiResponse, true);
240
-            if (isset($decodedJSON['error'])) {
241
-                throw new VKException($decodedJSON['error']['error_msg'], $decodedJSON['error']['error_code'], $decodedJSON['error']['request_params']);
240
+            if (isset($decodedJSON[ 'error' ])) {
241
+                throw new VKException($decodedJSON[ 'error' ][ 'error_msg' ], $decodedJSON[ 'error' ][ 'error_code' ], $decodedJSON[ 'error' ][ 'request_params' ]);
242 242
             }
243 243
 
244 244
             return $resultType == 'array' ? $decodedJSON : $apiResponse;
245
-        } catch(VKException $ex) {
245
+        } catch (VKException $ex) {
246 246
             echo $ex->getMessage();
247
-            return [];
247
+            return [ ];
248 248
         }
249 249
     }
250 250
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * @return string
272 272
      */
273 273
     private function createURL($urlString, $parametersArray) {
274
-        $urlString .= '?' . http_build_query($parametersArray);
274
+        $urlString .= '?'.http_build_query($parametersArray);
275 275
         return $urlString;
276 276
     }
277 277
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
      * @param array $postFields
283 283
      * @return string
284 284
      */
285
-    private function performRequest($requestURL, $requestMethod = 'GET', $postFields = []) {
285
+    private function performRequest($requestURL, $requestMethod = 'GET', $postFields = [ ]) {
286 286
         curl_setopt_array($this->curlObject, [
287
-            CURLOPT_USERAGENT       =>  'FreedomCore/' . self::PACKAGE_VERSION . ' VK OAuth Client',
287
+            CURLOPT_USERAGENT       =>  'FreedomCore/'.self::PACKAGE_VERSION.' VK OAuth Client',
288 288
             CURLOPT_RETURNTRANSFER  => true,
289 289
             CURLOPT_SSL_VERIFYPEER  => false,
290 290
             CURLOPT_POST            => ($requestMethod == 'POST'),
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 
316 316
         $Message .= '<tr><td width="10%"><strong>Error Code:</strong></td> <td>'.$code.'</td></tr>';
317 317
         $APIError = $this->codeToErrorText($code);
318
-        $Message .= '<tr><td width="10%"><strong>API Message:</strong></td> <td>'.$APIError['title'].' <span style="color: gray;">('.$APIError['description'].')</span></td></tr>';
318
+        $Message .= '<tr><td width="10%"><strong>API Message:</strong></td> <td>'.$APIError[ 'title' ].' <span style="color: gray;">('.$APIError[ 'description' ].')</span></td></tr>';
319 319
         $Message .= '<tr><td width="10%"><strong>Error Message:</strong></td> <td>'.$message.'</td></tr>';
320 320
         if ($parameters != null && is_array($parameters)) {
321 321
             $Message .= '<tr><td width="10%"><strong>Request Parameters:</strong></td> <td>';
322 322
 
323 323
             $Message .= '<table width="15%">';
324 324
             foreach ($parameters as $parameter) {
325
-                $Message .= "<tr><td><strong>".$parameter['key']."</strong></td><td width='15%'>=></td><td>".$parameter['value']."</td></tr>";
325
+                $Message .= "<tr><td><strong>".$parameter[ 'key' ]."</strong></td><td width='15%'>=></td><td>".$parameter[ 'value' ]."</td></tr>";
326 326
             }
327 327
             $Message .= '</table>';
328 328
             $Message .= '</td></tr>';
@@ -339,42 +339,42 @@  discard block
 block discarded – undo
339 339
      */
340 340
     private function codeToErrorText($Code) {
341 341
         $errorsData = [
342
-            1       =>  ['title' => 'Unknown error occurred',  'description' => 'Try again later.'],
343
-            2       =>  ['title' => 'Application is disabled. Enable your application or use test mode ',  'description' => 'You need to switch on the app in Settings (https://vk.com/editapp?id={Your API_ID} or use the test mode (test_mode=1).'],
344
-            3       =>  ['title' => 'Unknown method passed ',  'description' => 'Check the method name: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a> '],
345
-            4       =>  ['title' => 'Incorrect signature ',  'description' => 'Check if the signature has been formed correctly: <a href="https://vk.com/dev/api_nohttps" target="_blank"></a>'],
346
-            5       =>  ['title' => 'User authorization failed ',  'description' => 'Make sure that you use a correct authorization type. To work with the methods without a secureprefix you need to authorize a user with one of these ways:  http://vk.com/dev/auth_sites, http://vk.com/dev/auth_mobile.'],
347
-            6       =>  ['title' => 'Too many requests per second ',  'description' => 'Decrease the request frequency or use the execute method. More details on frequency limits here: <a href="http://vk.com/dev/api_requests" target="_blank">http://vk.com/dev/api_requests</a>'],
348
-            7       =>  ['title' => 'Permission to perform this action is denied ',  'description' => 'Make sure that your have received required permissions during the authorization. You can do it with the account.getAppPermissions method.'],
349
-            8       =>  ['title' => 'Invalid request ',  'description' => 'Check the request syntax and used parameters list (it can be found on a method description page) '],
350
-            9       =>  ['title' => 'Flood control ',  'description' => 'You need to decrease the count of identical requests. For more efficient work you may use execute or JSONP.'],
351
-            10      =>  ['title' => 'Internal server error',  'description' => 'Try again later.'],
352
-            11      =>  ['title' => 'In test mode application should be disabled or user should be authorized',  'description' => 'Switch the app off in Settings: https://vk.com/editapp?id={Your API_ID}.'],
353
-            14      =>  ['title' => 'Captcha needed ',  'description' => 'Work with this error is explained in detail on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>'],
354
-            15      =>  ['title' => 'Access denied ',  'description' => 'Make sure that you use correct identifiers and the content is available for the user in the full version of the site.'],
355
-            16      =>  ['title' => 'HTTP authorization failed',  'description' => 'To avoid this error check if a user has the \'Use secure connection\' option enabled with the account.getInfo method.'],
356
-            17      =>  ['title' => 'Validation required ',  'description' => 'Make sure that you don\'t use a token received with http://vk.com/dev/auth_mobile for a request from the server. It\'s restricted. The validation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>.'],
357
-            20      =>  ['title' => 'Permission to perform this action is denied for non-standalone applications ',  'description' => 'If you see this error despite your app has the Standalone type, make sure that you use redirect_uri=https://oauth.vk.com/blank.html. Details here: http://vk.com/dev/auth_mobile.'],
358
-            21      =>  ['title' => 'Permission to perform this action is allowed only for Standalone and OpenAPI applications',  'description' => ''],
359
-            23      =>  ['title' => 'This method was disabled ',  'description' => 'All the methods available now are listed here: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a>'],
360
-            24      =>  ['title' => 'Confirmation required ',  'description' => 'Confirmation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>'],
361
-            100     =>  ['title' => 'One of the parameters specified was missing or invalid ',  'description' => 'Check the required parameters list and their format on a method description page.'],
362
-            101     =>  ['title' => 'Invalid application API ID ',  'description' => 'Find the app in the administrated list in settings: <a href="http://vk.com/apps?act=settings" target="_blank">http://vk.com/apps?act=settings</a> And set the correct API_ID in the request.'],
363
-            103     =>  ['title' => 'Out of limits', 'description' => 'Out of limits'],
364
-            104     =>  ['title' => 'Not found', 'description' => 'Not found'],
365
-            113     =>  ['title' => 'Invalid user id ',  'description' => 'Make sure that you use a correct id. You can get an id using a screen name with the utils.resolveScreenName method'],
366
-            150     =>  ['title' => 'Invalid timestamp ',  'description' => 'You may get a correct value with the utils.getServerTime method.'],
367
-            200     =>  ['title' => 'Access to album denied ',  'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.'],
368
-            201     =>  ['title' => 'Access to audio denied ',  'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.'],
369
-            203     =>  ['title' => 'Access to group denied ',  'description' => 'Make sure that the current user is a member or admin of the community (for closed and private groups and events).'],
370
-            300     =>  ['title' => 'This album is full ',  'description' => 'You need to delete the odd objects from the album or use another album.'],
371
-            500     =>  ['title' => 'Permission denied. You must enable votes processing in application settings',  'description' => 'Check the app settings: http://vk.com/editapp?id={Your API_ID}&section=payments'],
372
-            600     =>  ['title' => 'Permission denied. You have no access to operations specified with given object(s)',  'description' => ''],
373
-            603     =>  ['title' => 'Some ads error occurred',  'description' => ''],
374
-            1260    =>  ['title' => 'Invalid screen name',  'description' => 'This screen name is already in use or invalid'],
342
+            1       =>  [ 'title' => 'Unknown error occurred', 'description' => 'Try again later.' ],
343
+            2       =>  [ 'title' => 'Application is disabled. Enable your application or use test mode ', 'description' => 'You need to switch on the app in Settings (https://vk.com/editapp?id={Your API_ID} or use the test mode (test_mode=1).' ],
344
+            3       =>  [ 'title' => 'Unknown method passed ', 'description' => 'Check the method name: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a> ' ],
345
+            4       =>  [ 'title' => 'Incorrect signature ', 'description' => 'Check if the signature has been formed correctly: <a href="https://vk.com/dev/api_nohttps" target="_blank"></a>' ],
346
+            5       =>  [ 'title' => 'User authorization failed ', 'description' => 'Make sure that you use a correct authorization type. To work with the methods without a secureprefix you need to authorize a user with one of these ways:  http://vk.com/dev/auth_sites, http://vk.com/dev/auth_mobile.' ],
347
+            6       =>  [ 'title' => 'Too many requests per second ', 'description' => 'Decrease the request frequency or use the execute method. More details on frequency limits here: <a href="http://vk.com/dev/api_requests" target="_blank">http://vk.com/dev/api_requests</a>' ],
348
+            7       =>  [ 'title' => 'Permission to perform this action is denied ', 'description' => 'Make sure that your have received required permissions during the authorization. You can do it with the account.getAppPermissions method.' ],
349
+            8       =>  [ 'title' => 'Invalid request ', 'description' => 'Check the request syntax and used parameters list (it can be found on a method description page) ' ],
350
+            9       =>  [ 'title' => 'Flood control ', 'description' => 'You need to decrease the count of identical requests. For more efficient work you may use execute or JSONP.' ],
351
+            10      =>  [ 'title' => 'Internal server error', 'description' => 'Try again later.' ],
352
+            11      =>  [ 'title' => 'In test mode application should be disabled or user should be authorized', 'description' => 'Switch the app off in Settings: https://vk.com/editapp?id={Your API_ID}.' ],
353
+            14      =>  [ 'title' => 'Captcha needed ', 'description' => 'Work with this error is explained in detail on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ],
354
+            15      =>  [ 'title' => 'Access denied ', 'description' => 'Make sure that you use correct identifiers and the content is available for the user in the full version of the site.' ],
355
+            16      =>  [ 'title' => 'HTTP authorization failed', 'description' => 'To avoid this error check if a user has the \'Use secure connection\' option enabled with the account.getInfo method.' ],
356
+            17      =>  [ 'title' => 'Validation required ', 'description' => 'Make sure that you don\'t use a token received with http://vk.com/dev/auth_mobile for a request from the server. It\'s restricted. The validation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>.' ],
357
+            20      =>  [ 'title' => 'Permission to perform this action is denied for non-standalone applications ', 'description' => 'If you see this error despite your app has the Standalone type, make sure that you use redirect_uri=https://oauth.vk.com/blank.html. Details here: http://vk.com/dev/auth_mobile.' ],
358
+            21      =>  [ 'title' => 'Permission to perform this action is allowed only for Standalone and OpenAPI applications', 'description' => '' ],
359
+            23      =>  [ 'title' => 'This method was disabled ', 'description' => 'All the methods available now are listed here: <a href="http://vk.com/dev/methods" target="_blank">http://vk.com/dev/methods</a>' ],
360
+            24      =>  [ 'title' => 'Confirmation required ', 'description' => 'Confirmation process is described on the <a href="https://vk.com/dev/need_confirmation" target="_blank">separate page</a>' ],
361
+            100     =>  [ 'title' => 'One of the parameters specified was missing or invalid ', 'description' => 'Check the required parameters list and their format on a method description page.' ],
362
+            101     =>  [ 'title' => 'Invalid application API ID ', 'description' => 'Find the app in the administrated list in settings: <a href="http://vk.com/apps?act=settings" target="_blank">http://vk.com/apps?act=settings</a> And set the correct API_ID in the request.' ],
363
+            103     =>  [ 'title' => 'Out of limits', 'description' => 'Out of limits' ],
364
+            104     =>  [ 'title' => 'Not found', 'description' => 'Not found' ],
365
+            113     =>  [ 'title' => 'Invalid user id ', 'description' => 'Make sure that you use a correct id. You can get an id using a screen name with the utils.resolveScreenName method' ],
366
+            150     =>  [ 'title' => 'Invalid timestamp ', 'description' => 'You may get a correct value with the utils.getServerTime method.' ],
367
+            200     =>  [ 'title' => 'Access to album denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ],
368
+            201     =>  [ 'title' => 'Access to audio denied ', 'description' => 'Make sure you use correct ids (owner_id is always positive for users, negative for communities) and the current user has access to the requested content in the full version of the site.' ],
369
+            203     =>  [ 'title' => 'Access to group denied ', 'description' => 'Make sure that the current user is a member or admin of the community (for closed and private groups and events).' ],
370
+            300     =>  [ 'title' => 'This album is full ', 'description' => 'You need to delete the odd objects from the album or use another album.' ],
371
+            500     =>  [ 'title' => 'Permission denied. You must enable votes processing in application settings', 'description' => 'Check the app settings: http://vk.com/editapp?id={Your API_ID}&section=payments' ],
372
+            600     =>  [ 'title' => 'Permission denied. You have no access to operations specified with given object(s)', 'description' => '' ],
373
+            603     =>  [ 'title' => 'Some ads error occurred', 'description' => '' ],
374
+            1260    =>  [ 'title' => 'Invalid screen name', 'description' => 'This screen name is already in use or invalid' ],
375 375
         ];
376 376
 
377
-        return (!array_key_exists($Code, $errorsData)) ? $errorsData[1] : $errorsData[$Code];
377
+        return (!array_key_exists($Code, $errorsData)) ? $errorsData[ 1 ] : $errorsData[ $Code ];
378 378
     }
379 379
 
380 380
 }
381 381
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,9 @@
 block discarded – undo
146 146
             'response_type' =>  (in_array($responseType, $allowedTypes)) ? $responseType : 'code'
147 147
         ];
148 148
 
149
-        if ($testMode) $requestParameters['test_mode'] = 1;
149
+        if ($testMode) {
150
+            $requestParameters['test_mode'] = 1;
151
+        }
150 152
 
151 153
         return $this->createURL(self::AUTHORIZATION_URL, $requestParameters);
152 154
     }
Please login to merge, or discard this patch.
source/API/VKAPI.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
      * @throws VKException
56 56
      */
57 57
     protected function isAllowed($requiredPermission = null) {
58
-        if ($requiredPermission != null){
58
+        if ($requiredPermission != null) {
59 59
             try {
60 60
                 $isValidPermission = $this->VKObject->getPermissionsMask() & $requiredPermission;
61 61
                 if (!$isValidPermission) {
Please login to merge, or discard this patch.
source/API/VKUsers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         $requestParameters = [
51
-            'user_ids'      =>  implode(',',$usersIDs),
51
+            'user_ids'      =>  implode(',', $usersIDs),
52 52
             'fields'        =>  $this->returnAllowedFields($requestFields),
53 53
             'name_case'     =>  $this->returnAllowedNC($nameCase)
54 54
         ];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $allowedFields = [ 'photo_id', 'verified', 'sex', 'bdate', 'city', 'country', 'home_town', 'has_photo', 'photo_50', 'photo_100', 'photo_200_orig', 'photo_200', 'photo_400_orig', 'photo_max', 'photo_max_orig', 'online', 'lists', 'domain', 'has_mobile', 'contacts', 'site', 'education', 'universities', 'schools', 'status', 'last_seen', 'followers_count', 'common_count', 'occupation', 'nickname', 'relatives', 'relation', 'personal', 'connections', 'exports', 'wall_comments', 'activities', 'interests', 'music', 'movies', 'tv', 'books', 'games', 'about', 'quotes', 'can_post', 'can_see_all_posts', 'can_see_audio', 'can_write_private_message', 'can_send_friend_request', 'is_favorite', 'is_hidden_from_feed', 'timezone', 'screen_name', 'maiden_name', 'crop_photo', 'is_friend', 'friend_status', 'career', 'military', 'blacklisted', 'blacklisted_by_me' ];
176 176
         foreach ($fieldsArray as $fKey => $fValue) { 
177 177
             if (!in_array($fValue, $allowedFields)) { 
178
-                unset($fieldsArray[$fKey]); 
178
+                unset($fieldsArray[ $fKey ]); 
179 179
             }
180 180
         }
181 181
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      * @return string
189 189
      */
190 190
     private function returnAllowedNC($ncValue) {
191
-        $allowedNameCases = ['nom', 'gen', 'dat', 'acc', 'ins', 'abl'];
191
+        $allowedNameCases = [ 'nom', 'gen', 'dat', 'acc', 'ins', 'abl' ];
192 192
         if (!in_array($ncValue, $allowedNameCases)) {
193 193
             $ncValue = 'nom';
194 194
         }
Please login to merge, or discard this patch.
source/API/VKAccount.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @return mixed
73 73
      */
74 74
     public function setOffline() {
75
-        return $this->executeQuery(__FUNCTION__, []);
75
+        return $this->executeQuery(__FUNCTION__, [ ]);
76 76
     }
77 77
 
78 78
     /**
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
         ];
123 123
         
124 124
         foreach ($filtersArray as $fKey => $fValue) { 
125
-            if(!in_array($fValue, $existingFilters)) {
126
-                unset($filtersArray[$fKey]); 
125
+            if (!in_array($fValue, $existingFilters)) {
126
+                unset($filtersArray[ $fKey ]); 
127 127
             }
128 128
         }
129 129
         return implode(',', $filtersArray);
Please login to merge, or discard this patch.
source/API/VKGroups.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         ];
62 62
 
63 63
         if (is_array($groupID)) {
64
-            $requestParameters['group_ids'] = implode(',', $groupID);
64
+            $requestParameters[ 'group_ids' ] = implode(',', $groupID);
65 65
         } else {
66
-            $requestParameters['group_id'] = $groupID;
66
+            $requestParameters[ 'group_id' ] = $groupID;
67 67
         }
68 68
 
69 69
         return parent::executeQuery(__FUNCTION__, $requestParameters);
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
      * @return mixed
79 79
      */
80 80
     public function get($userID, $isExtended = 0, $setFilter = null, $requestFields = self::defaultFields) {
81
-        $allowedFilterTypes = ['admin', 'editor', 'moder', 'groups', 'publics', 'events'];
81
+        $allowedFilterTypes = [ 'admin', 'editor', 'moder', 'groups', 'publics', 'events' ];
82 82
         $requestParameters = [
83 83
             'user_id'   =>  $userID,
84 84
             'extended'  =>  ($isExtended > 1 || $isExtended < 0) ? 0 : $isExtended,
85 85
             'fields'    =>  $this->getAllowedFields($requestFields)
86 86
         ];
87 87
         if ($setFilter != null && in_array($setFilter, $allowedFilterTypes)) { 
88
-            $requestParameters['filter'] = $setFilter; 
88
+            $requestParameters[ 'filter' ] = $setFilter; 
89 89
         }
90 90
 
91 91
         return parent::executeQuery(__FUNCTION__, $requestParameters);
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
      * @return mixed
114 114
      */
115 115
     public function join($groupID, $ifMeeting = null) {
116
-        $requestParameters['group_id'] = $groupID;
117
-        if ($ifMeeting != null){ 
116
+        $requestParameters[ 'group_id' ] = $groupID;
117
+        if ($ifMeeting != null) { 
118 118
             if ($ifMeeting == 1 || $ifMeeting == 0) { 
119
-                $requestParameters['not_sure']  =   $ifMeeting; 
119
+                $requestParameters[ 'not_sure' ] = $ifMeeting; 
120 120
             } 
121 121
         }
122 122
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @return mixed
130 130
      */
131 131
     public function leave($groupID) {
132
-        $requestParameters['group_id'] = $groupID;
132
+        $requestParameters[ 'group_id' ] = $groupID;
133 133
 
134 134
         return parent::executeQuery(__FUNCTION__, $requestParameters);
135 135
     }
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
      * @return mixed
142 142
      */
143 143
     public function search($searchQuery, $groupType = null) {
144
-        $requestParameters['q'] = $searchQuery;
145
-        if ($groupType != null && in_array($groupType, ['group', 'page', 'event'])) { 
146
-            $requestParameters['type'] = $groupType; 
144
+        $requestParameters[ 'q' ] = $searchQuery;
145
+        if ($groupType != null && in_array($groupType, [ 'group', 'page', 'event' ])) { 
146
+            $requestParameters[ 'type' ] = $groupType; 
147 147
         }
148 148
 
149 149
         return parent::executeQuery(__FUNCTION__, $requestParameters);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      * @return mixed
156 156
      */
157 157
     public function getInvites($isExtended = 0) {
158
-        $requestParameters['extended'] = ($isExtended > 1 || $isExtended < 0) ? 0 : $isExtended;
158
+        $requestParameters[ 'extended' ] = ($isExtended > 1 || $isExtended < 0) ? 0 : $isExtended;
159 159
         return parent::executeQuery(__FUNCTION__, $requestParameters);
160 160
     }
161 161
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      * @return mixed
216 216
      */
217 217
     public function getBanned($groupID) {
218
-        return parent::executeQuery(__FUNCTION__, ['group_id' => $groupID]);
218
+        return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID ]);
219 219
     }
220 220
 
221 221
     /**
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
      * @return mixed
228 228
      */
229 229
     public function create($groupTitle, $groupDescription, $groupType = 'group', $subType = null) {
230
-        $allowedGroupTypes = ['group', 'event', 'public'];
230
+        $allowedGroupTypes = [ 'group', 'event', 'public' ];
231 231
         $requestParameters = [
232 232
             'title'     =>  $groupTitle,
233 233
             'type'      =>  (in_array($groupType, $allowedGroupTypes)) ? $groupType : 'group'
234 234
         ];
235 235
         if ($groupType != 'public') { 
236
-            $requestParameters['description'] = $groupDescription; 
236
+            $requestParameters[ 'description' ] = $groupDescription; 
237 237
         }
238 238
         if ($subType != null) { 
239
-            $requestParameters['subtype'] = ($subType > 4 || $subType < 1) ? 2 : $subType;
239
+            $requestParameters[ 'subtype' ] = ($subType > 4 || $subType < 1) ? 2 : $subType;
240 240
         }
241 241
 
242 242
         return parent::executeQuery(__FUNCTION__, $requestParameters);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @return mixed
273 273
      */
274 274
     public function getSettings($groupID) {
275
-        return parent::executeQuery(__FUNCTION__, ['group_id' => $groupID]);
275
+        return parent::executeQuery(__FUNCTION__, [ 'group_id' => $groupID ]);
276 276
     }
277 277
 
278 278
     /**
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
             'contacts'
373 373
         ];
374 374
 
375
-        foreach($fieldsArray as $fKey => $fValue) {
375
+        foreach ($fieldsArray as $fKey => $fValue) {
376 376
             if (!in_array($fValue, $groupsFields)) {
377
-                unset($fieldsArray[$fKey]);
377
+                unset($fieldsArray[ $fKey ]);
378 378
             }
379 379
         }
380 380
         return implode(',', $fieldsArray);
Please login to merge, or discard this patch.