public function getAccessToken($clientConfigId, Context $context)
{
$stmt = $this->db->prepare(sprintf('SELECT * FROM %s WHERE client_config_id = :client_config_id AND user_id = :user_id AND scope = :scope', $this->prefix . 'access_tokens'));
$stmt->bindValue(':client_config_id', $clientConfigId, PDO::PARAM_STR);
$stmt->bindValue(':user_id', $context->getUserId(), PDO::PARAM_STR);
$stmt->bindValue(':scope', $context->getScope()->toString(), PDO::PARAM_STR);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if (false !== $result) {
$result['scope'] = Scope::fromString($result['scope']);
return new AccessToken($result);
}
return false;
}