You are here

public function GoogleApiServiceClient::getScopes in Google API PHP Client 8.4

Same name and namespace in other branches
  1. 8.3 src/Entity/GoogleApiServiceClient.php \Drupal\google_api_client\Entity\GoogleApiServiceClient::getScopes()

Function returns the Scopes for the account.

Parameters

bool $url: TRUE if should return scope urls.

Return value

array Returns array of scopes.

Overrides GoogleApiServiceClientInterface::getScopes

File

src/Entity/GoogleApiServiceClient.php, line 151

Class

GoogleApiServiceClient
Defines the GoogleApiServiceClient entity.

Namespace

Drupal\google_api_client\Entity

Code

public function getScopes($url = FALSE) {
  if ($url) {
    $services = $this
      ->getServices();
    $all_scopes = google_api_client_google_services_scopes($services);
    $return = [];
    foreach ($this->scopes as $scope) {
      foreach ($all_scopes as $scopes) {
        if (isset($scopes[$scope])) {
          $return[] = $scopes[$scope];
          break;
        }
      }
    }
    return $return;
  }
  else {
    return $this->scopes;
  }
}