sourceId = (int)($row['source_id'] ?? 0); $token->owner = (string)($row['owner'] ?? ''); $token->username = (string)($row['username'] ?? ''); $token->accessToken = isset($row['access_token']) ? (string)$row['access_token'] : null; $token->refreshToken = isset($row['refresh_token']) ? (string)$row['refresh_token'] : null; $token->tokenExpires = isset($row['token_expires']) ? (int)$row['token_expires'] : null; $token->lastRefreshError = isset($row['last_refresh_error']) ? (string)$row['last_refresh_error'] : null; $token->refreshAttemptAge = isset($row['refresh_attempt_age']) ? (int)$row['refresh_attempt_age'] : null; return $token; } }