original_string: protected function replace($data, $replacements = null)
      {
          if (!is_array($data) && !is_string($data)) {
              return $data;
          }
  
          if (!$replacements) {
              $replacements = $this->replacements();
              if (!$replacements) {
                  return $data;
              }
          }
  
          if (is_array($data)) {
              foreach ($data as $key => &$value) {
                  $value = $this->replace($value, $replacements);
              }
              return $data;
          }
  
          return str_replace(array_keys($replacements), array_values($replacements), $data);
      }
code: protected function replace($data, $replacements = null)
      {
          if (!is_array($data) && !is_string($data)) {
              return $data;
          }
  
          if (!$replacements) {
              $replacements = $this->replacements();
              if (!$replacements) {
                  return $data;
              }
          }
  
          if (is_array($data)) {
              foreach ($data as $key => &$value) {
                  $value = $this->replace($value, $replacements);
              }
              return $data;
          }
  
          return str_replace(array_keys($replacements), array_values($replacements), $data);
      }
code_tokens: protected function replace ( $ data , $ replacements = null ) { if ( ! is_array ( $ data ) && ! is_string ( $ data ) ) { return $ data ; } if ( ! $ replacements ) { $ replacements = $ this -> replacements ( ) ; if ( ! $ replacements ) { return $ data ; } } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => & $ value ) { $ value = $ this -> replace ( $ value , $ replacements ) ; } return $ data ; } return str_replace ( array_keys ( $ replacements ) , array_values ( $ replacements ) , $ data ) ; }
docstring: perform string replacements on a string
  
  Accepts an array, recusively replacing string values
  Does nothing to any scalar that's not string
  
  @param array $data
  @param array $replacements
  @return mixed
docstring_tokens: perform string replacements on a string