You are here

public function AuthorizationCode::getClient in OAuth2 Server 8

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

Return the client the code belongs to.

Return value

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

Overrides AuthorizationCodeInterface::getClient

File

src/Entity/AuthorizationCode.php, line 97

Class

AuthorizationCode
Defines the OAuth2 server authorization code 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;
}