public function GoogleApiServiceClientService::getServiceObjects in Google API PHP Client 8.4
Same name and namespace in other branches
- 8.3 src/Service/GoogleApiServiceClientService.php \Drupal\google_api_client\Service\GoogleApiServiceClientService::getServiceObjects()
This function is designed to return objects of services classes.
So if the account is authenticated for say Google calendar then this function will return Google_Service_Calendar class object.
Return value
array Array of Google_Service classes with servicename as index.
File
- src/
Service/ GoogleApiServiceClientService.php, line 168
Class
- GoogleApiServiceClientService
- Class Google API Client Service.
Namespace
Drupal\google_api_client\ServiceCode
public function getServiceObjects() {
$google_api_service_client = $this->googleApiServiceClient;
$services = $google_api_service_client
->getServices();
if (!is_array($services)) {
$services = [
$services,
];
}
$classes = $this->configFactory
->get('google_api_client.google_api_classes')
->get('google_api_client_google_api_classes');
$return = [];
foreach ($services as $service) {
$return[$service] = new $classes[$service]($this->googleClient);
}
return $return;
}