webex_client-1.0.5/src/Entity/WebexTokensTrait.php
src/Entity/WebexTokensTrait.php
<?php
namespace Drupal\webex_client\Entity;
/**
* Provides methods for managing Webex tokens.
*/
trait WebexTokensTrait {
/**
* Sets a token in the state storage.
*
* @param string $name
* The name of the token to set.
* @param string $token
* The token value to set.
*/
protected function setTokens(string $name, string $token) {
\Drupal::state()->set("{$this->id()}.$name", $token);
}
/**
* Retrieves a token from the state storage.
*
* @param string $name
* The name of the token to retrieve.
*
* @return string|null
* The token value, or null if not found.
*/
protected function getTokens(string $name) {
return \Drupal::state()->get("{$this->id()}.$name");
}
}
