/**
  * @inheritdoc
  */
 public function create($token, $expireTime, $accessToken)
 {
     $accessToken = AccessToken::findByToken($accessToken);
     $refreshToken = new RefreshToken(['accessTokenId' => $accessToken->getKey(), 'expireTime' => Carbon::createFromTimestamp($expireTime)->format('Y-m-d H:i:s')]);
     $refreshToken->setId($token);
     $refreshToken->save();
     return $this->createEntity($refreshToken);
 }
 /**
  * @inheritdoc
  */
 public function getByAccessToken(AccessTokenEntity $entity)
 {
     $accessToken = AccessToken::findByToken($entity->getId());
     /** @var Session $session */
     $session = Session::find($accessToken->sessionId);
     if ($session === null) {
         throw new SessionNotFound();
     }
     return $this->createEntity($session);
 }
 /**
  * @param string $token
  *
  * @return AccessToken
  */
 protected function findByToken($token)
 {
     return AccessToken::findByToken($token);
 }