/** * @param OauthScope|string $scope * @return bool */ public function hasScope($scope) { if (is_string($scope)) { foreach ($this->scopes as $tokenScope) { if ($tokenScope->getName() == $scope) { return true; } } return false; } else { return in_array($scope, $this->scopes->toArray()); } }