Fix coding standards after PHPCS with PSR-2
This commit is contained in:
@@ -152,21 +152,28 @@ class Vkontakte extends AbstractProvider
|
|||||||
$message = $errorMessage ?: $responseMessage;
|
$message = $errorMessage ?: $responseMessage;
|
||||||
|
|
||||||
// Request/meta validation
|
// Request/meta validation
|
||||||
if (399 < $responseCode)
|
if (399 < $responseCode) {
|
||||||
throw new IdentityProviderException($message, $responseCode, $data);
|
throw new IdentityProviderException($message, $responseCode, $data);
|
||||||
|
}
|
||||||
|
|
||||||
// Content validation
|
// Content validation
|
||||||
if ('application/json' != $contentType)
|
if ('application/json' != $contentType) {
|
||||||
throw new IdentityProviderException($message, $responseCode, $data);
|
throw new IdentityProviderException($message, $responseCode, $data);
|
||||||
if ($error)
|
}
|
||||||
|
if ($error) {
|
||||||
throw new IdentityProviderException($errorMessage, $errorCode, $data);
|
throw new IdentityProviderException($errorMessage, $errorCode, $data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
protected function createResourceOwner(array $response, AccessToken $token)
|
protected function createResourceOwner(array $response, AccessToken $token)
|
||||||
{
|
{
|
||||||
$response = reset($response['response']);
|
$response = reset($response['response']);
|
||||||
$additional = $token->getValues();
|
$additional = $token->getValues();
|
||||||
if (!empty($additional['email'])) $response['email'] = $additional['email'];
|
if (!empty($additional['email'])) {
|
||||||
if (!empty($additional['user_id'])) $response['id'] = $additional['user_id'];
|
$response['email'] = $additional['email'];
|
||||||
|
}
|
||||||
|
if (!empty($additional['user_id'])) {
|
||||||
|
$response['id'] = $additional['user_id'];
|
||||||
|
}
|
||||||
|
|
||||||
return new User($response, $response['id']);
|
return new User($response, $response['id']);
|
||||||
}
|
}
|
||||||
@@ -182,8 +189,9 @@ class Vkontakte extends AbstractProvider
|
|||||||
*/
|
*/
|
||||||
public function usersGet(array $ids = [], AccessToken $token = null, array $params = [])
|
public function usersGet(array $ids = [], AccessToken $token = null, array $params = [])
|
||||||
{
|
{
|
||||||
if (empty($ids) && !$token)
|
if (empty($ids) && !$token) {
|
||||||
throw new \InvalidArgumentException('Some of parameters usersIds OR access_token are required');
|
throw new \InvalidArgumentException('Some of parameters usersIds OR access_token are required');
|
||||||
|
}
|
||||||
|
|
||||||
$default = [
|
$default = [
|
||||||
'user_ids' => implode(',', $ids),
|
'user_ids' => implode(',', $ids),
|
||||||
@@ -197,7 +205,9 @@ class Vkontakte extends AbstractProvider
|
|||||||
|
|
||||||
$response = $this->getResponse($this->createRequest(static::METHOD_GET, $url, $token, []))['response'];
|
$response = $this->getResponse($this->createRequest(static::METHOD_GET, $url, $token, []))['response'];
|
||||||
$users = !empty($response['items']) ? $response['items'] : $response;
|
$users = !empty($response['items']) ? $response['items'] : $response;
|
||||||
$array2user = function ($userData) { return new User($userData); };
|
$array2user = function ($userData) {
|
||||||
|
return new User($userData);
|
||||||
|
};
|
||||||
|
|
||||||
return array_map($array2user, $users);
|
return array_map($array2user, $users);
|
||||||
}
|
}
|
||||||
@@ -225,7 +235,9 @@ class Vkontakte extends AbstractProvider
|
|||||||
$response = $this->getResponse($this->createRequest(static::METHOD_GET, $url, $token, []))['response'];
|
$response = $this->getResponse($this->createRequest(static::METHOD_GET, $url, $token, []))['response'];
|
||||||
$friends = !empty($response['items']) ? $response['items'] : $response;
|
$friends = !empty($response['items']) ? $response['items'] : $response;
|
||||||
$array2friend = function ($friendData) {
|
$array2friend = function ($friendData) {
|
||||||
if (is_numeric($friendData)) $friendData = ['id' => $friendData];
|
if (is_numeric($friendData)) {
|
||||||
|
$friendData = ['id' => $friendData];
|
||||||
|
}
|
||||||
|
|
||||||
return new User($friendData);
|
return new User($friendData);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user