public static function replaceTokens($text, array $data) {
    $tokens = [];
    foreach ($data as $var_name => $var) {
      if (is_string($var)) {
        $tokens['{' . $var_name . '}'] = $var;
      }
    }
    return str_replace(array_keys($tokens), array_values($tokens), $text);
  }