From b14c839ec06cac4327470cf10e9db73b20c04a57 Mon Sep 17 00:00:00 2001 From: Sohaib Ilyas Date: Sat, 30 Jul 2022 05:31:53 -0700 Subject: [PATCH] Apply fixes from StyleCI (#20) --- src/Facebook.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Facebook.php b/src/Facebook.php index b590c56..0bc6eb9 100644 --- a/src/Facebook.php +++ b/src/Facebook.php @@ -62,22 +62,22 @@ public function setResponseType(string $type = 'json') public function getUser(string $userId = 'me', array $fields = ['id', 'name'], string $accessToken = null) { - return $this->get($userId . '?fields=' . implode(',', $fields), $accessToken); + return $this->get($userId.'?fields='.implode(',', $fields), $accessToken); } public function getBusinesses(string $userId = 'me', array $fields = ['id', 'name'], int $limit = 100, string $accessToken = null) { - return $this->get($userId . '/businesses?fields=' . implode(',', $fields) . '&limit=' . $limit, $accessToken); + return $this->get($userId.'/businesses?fields='.implode(',', $fields).'&limit='.$limit, $accessToken); } public function getPages(string $userId = 'me', array $fields = ['id', 'name'], int $limit = 100, string $accessToken = null) { - return $this->get($userId . '/accounts?fields=' . implode(',', $fields) . '&limit=' . $limit, $accessToken); + return $this->get($userId.'/accounts?fields='.implode(',', $fields).'&limit='.$limit, $accessToken); } public function getAdAccounts(string $userId = 'me', array $fields = ['id', 'name'], int $limit = 100, string $accessToken = null) { - return $this->get($userId . '/adaccounts?fields=' . implode(',', $fields) . '&limit=' . $limit, $accessToken); + return $this->get($userId.'/adaccounts?fields='.implode(',', $fields).'&limit='.$limit, $accessToken); } public function handleRedirect(callable $callable) @@ -117,7 +117,7 @@ public function getLoginUrl(array $permissions = ['public_profile', 'email']) public function get(string $path, string $accessToken = null) { - $path = $path[0] == '/' ? $path : '/' . $path; + $path = $path[0] == '/' ? $path : '/'.$path; $this->accessToken = $accessToken ? $accessToken : $this->accessToken; @@ -127,10 +127,12 @@ public function get(string $path, string $accessToken = null) } try { - $this->response = $this->client->get($this->apiVersion . $path . $separator . 'access_token=' . $this->accessToken); + $this->response = $this->client->get($this->apiVersion.$path.$separator.'access_token='.$this->accessToken); + return $this->getResponse(); } catch (\Exception $e) { $this->response = $e->getResponse(); + return $this->getResponse(); } } @@ -154,6 +156,7 @@ public function post(string $path, array $params, string $accessToken = null) return $this->getResponse(); } catch (\Exception $e) { $this->response = $e->getResponse(); + return $this->getResponse(); } } @@ -175,6 +178,7 @@ public function delete(string $path, string $accessToken = null) return $this->getResponse(); } catch (\Exception $e) { $this->response = $e->getResponse(); + return $this->getResponse(); } }