From ad18ce7d7bf585e25858e46264dde29ac359ae65 Mon Sep 17 00:00:00 2001 From: trogwar Date: Thu, 30 Jun 2016 06:52:36 +0300 Subject: [PATCH] =?UTF-8?q?Use=20JSON=20only=20=E2=80=93=20other=20types?= =?UTF-8?q?=20are=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Vkontakte.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Vkontakte.php b/src/Vkontakte.php index 4e0160c..ada3a48 100644 --- a/src/Vkontakte.php +++ b/src/Vkontakte.php @@ -12,8 +12,6 @@ use Psr\Http\Message\ResponseInterface; class Vkontakte extends AbstractProvider { public $scopes = ['email']; - public $uidKey = 'user_id'; - public $responseType = 'json'; public function getBaseAuthorizationUrl() { @@ -76,18 +74,10 @@ class Vkontakte extends AbstractProvider } $responseBody = $response->getBody()->getContents(); - switch ($this->responseType) { - case 'json': - $result = json_decode($responseBody, true); + $result = json_decode($responseBody, true); - if (JSON_ERROR_NONE !== json_last_error()) { - $result = []; - } - - break; - case 'string': - parse_str($responseBody, $result); - break; + if (JSON_ERROR_NONE !== json_last_error()) { + $result = []; } if (isset($result['error']) && ! empty($result['error'])) {