code: protected function replaceMessageFormat($message, array $item)
      {
          $keys = array_keys($item);
  
          if (!empty($item['args'])) {
              $args = $item['args'];
  
              $argReplace = array_map(function($i) {
                  return "{\${$i}}";
              }, array_keys($args));
  
              // Number of arguments
              $args[] = count($item['args']);
              $argReplace[] = '{$#}';
  
              // All arguments
              $args[] = implode(', ', $item['args']);
              $argReplace[] = '{$*}';
  
              // Replace arguments
              $message = str_replace($argReplace, $args, $message);
          }
  
          // Replace field and value
          $message = str_replace(
              ['{field}', '{value}'],
              [$item['field'], $item['value']],
              $message
          );
  
          return $message;
      }
docs: Replaces message variables.
  
  @param  string $message
  @param  array $item
  
  @return string