public function replaceTokens($text) {
    $tokens = $this->macro->search($text);
    if (empty($tokens)) {
      return $text;
    }

    static $last = [];
    $replacements = [];
    foreach ($tokens as $type => $typeTokens) {
      foreach ($typeTokens as $name => $token) {
        if ($type == "any") {
          $value = $this->faker->{$name};
          $replacements[$token] = $value;
          $last[$name] = $value;
        } elseif ($type == "last") {
          $replacements[$token] = $last[$name];
        }
      }
    }

    $search = array_keys($replacements);
    $replace = array_values($replacements);
    return str_replace($search, $replace, $text);
  }