From e60c5a5cd3aee8037d3f5526c410aab23c08b81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Preu=C3=9F?= Date: Wed, 31 Mar 2021 12:15:57 +0200 Subject: [PATCH] Update can method --- .../BitinflowAccounts/Traits/HasBitinflowTokens.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/GhostZero/BitinflowAccounts/Traits/HasBitinflowTokens.php b/src/GhostZero/BitinflowAccounts/Traits/HasBitinflowTokens.php index 08caed7..327248d 100644 --- a/src/GhostZero/BitinflowAccounts/Traits/HasBitinflowTokens.php +++ b/src/GhostZero/BitinflowAccounts/Traits/HasBitinflowTokens.php @@ -31,11 +31,9 @@ trait HasBitinflowTokens */ public function bitinflowTokenCan(string $scope): bool { - if (in_array('*', $this->accessToken->scopes)) { - return true; - } + $scopes = $this->accessToken ? $this->accessToken->scopes : []; - return $this->accessToken ? in_array($scope, $this->accessToken->scopes) : false; + return in_array('*', $scopes) || in_array($scope, $this->accessToken->scopes); } /**