You are here

public function Token::getUser in OAuth2 Server 8

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

Return the user the token belongs to.

Return value

\Drupal\user\UserInterface The user object or FALSE.

Overrides TokenInterface::getUser

File

src/Entity/Token.php, line 87

Class

Token
Defines the OAuth2 server token entity.

Namespace

Drupal\oauth2_server\Entity

Code

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