options = $options; } public function getOptions(): array { return $this->options; } /** * Fetches the bearer token * @throws TwilioException */ public function fetchToken(?Client $client = null): string { if ($client === null) { $client = new Client(); } $noAuthCredentialProvider = new NoAuthCredentialProvider(); $client->setCredentialProvider($noAuthCredentialProvider); $base = new IamBase($client); $v1 = new V1($base); $tokenList = new TokenList($v1); try { return $tokenList->create( $this->options['grantType'], $this->options['clientId'], $this->options )->accessToken; } catch (TwilioException $e) { throw new TwilioException($e->getMessage()); } } }