public function GoogleApiClient::getScopes in Google API PHP Client 8.4
Same name and namespace in other branches
- 8.2 src/Entity/GoogleApiClient.php \Drupal\google_api_client\Entity\GoogleApiClient::getScopes()
- 8.3 src/Entity/GoogleApiClient.php \Drupal\google_api_client\Entity\GoogleApiClient::getScopes()
Function returns the Scopes for the account.
Return value
array Returns array of scopes.
Overrides GoogleApiClientInterface::getScopes
1 call to GoogleApiClient::getScopes()
- GoogleApiClient::save in src/
Entity/ GoogleApiClient.php
File
- src/
Entity/ GoogleApiClient.php, line 172
Class
- GoogleApiClient
- Defines the GoogleApiClient entity.
Namespace
Drupal\google_api_client\EntityCode
public function getScopes() {
$scopes = $this
->get('scopes')
->getValue();
$merged_scopes = [];
foreach ($scopes as $key => $scope) {
$merged_scopes[$key] = $scope['value'];
}
$services = $this
->getServices();
$all_scopes = google_api_client_google_services_scopes($services);
$return = [];
foreach ($merged_scopes as $scope) {
foreach ($all_scopes as $scopes) {
if (isset($scopes[$scope])) {
$return[] = $scopes[$scope];
break;
}
}
}
return $return;
}