public function GoogleApiClient::__construct in Google API PHP Client 8
Callback Controller constructor.
Parameters
\Drupal\Core\Config\ConfigFactory $config: An instance of ConfigFactory.
\Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerFactory: LoggerChannelFactoryInterface.
\Drupal\Core\Cache\CacheBackendInterface $cacheBackend: Cache Backend.
File
- src/
Service/ GoogleApiClient.php, line 56
Class
- GoogleApiClient
- Class Google API Client Service.
Namespace
Drupal\google_api_client\ServiceCode
public function __construct(ConfigFactory $config, LoggerChannelFactoryInterface $loggerFactory, CacheBackendInterface $cacheBackend) {
$this->config = $config
->get('google_api_client.settings');
$this->configTokens = $config
->getEditable('google_api_client.tokens');
$this->loggerFactory = $loggerFactory;
$this->cacheBackend = $cacheBackend;
// Add the client without tokens.
$this->googleClient = $this
->getClient();
// Check and add tokens.
// Tokens wont always be set or valid, so this is a 2 step process.
$this
->setAccessToken();
}