You are here

public function Token::getClient in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Token.php \Drupal\oauth2_server\Entity\Token::getClient()

Return the client the token belongs to.

Return value

\Drupal\oauth2_server\ClientInterface The client object or FALSE.

Overrides TokenInterface::getClient

File

src/Entity/Token.php, line 98

Class

Token
Defines the OAuth2 server token entity.

Namespace

Drupal\oauth2_server\Entity

Code

public function getClient() {
  if ($client_id = $this->client_id
    ->getValue()) {
    return $this
      ->entityTypeManager()
      ->getStorage('oauth2_server_client')
      ->load($client_id[0]['target_id']);
  }
  return FALSE;
}