original_string: private function replaceTokens($option)
      {
          if (is_array($option)) {
              $tokenizedOptions = [];
              foreach ($option as $key => $opt) {
                  $tokenizedOptions[$key] = $this->replaceTokens($opt);
              }
  
              return $tokenizedOptions;
          }
  
          return preg_replace_callback(
              '/\$(.+)\$|\$\{(.+)\}/',
              function ($match) {
                  $val = isset($match[2]) ? getenv($match[2]) : getenv($match[1]);
  
                  return $val !== false ? $val : $match[0];
              },
              $option
          );
      }
code: private function replaceTokens($option)
      {
          if (is_array($option)) {
              $tokenizedOptions = [];
              foreach ($option as $key => $opt) {
                  $tokenizedOptions[$key] = $this->replaceTokens($opt);
              }
  
              return $tokenizedOptions;
          }
  
          return preg_replace_callback(
              '/\$(.+)\$|\$\{(.+)\}/',
              function ($match) {
                  $val = isset($match[2]) ? getenv($match[2]) : getenv($match[1]);
  
                  return $val !== false ? $val : $match[0];
              },
              $option
          );
      }
code_tokens: private function replaceTokens ( $ option ) { if ( is_array ( $ option ) ) { $ tokenizedOptions = [ ] ; foreach ( $ option as $ key => $ opt ) { $ tokenizedOptions [ $ key ] = $ this -> replaceTokens ( $ opt ) ; } return $ tokenizedOptions ; } return preg_replace_callback ( '/\$(.+)\$|\$\{(.+)\}/' , function ( $ match ) { $ val = isset ( $ match [ 2 ] ) ? getenv ( $ match [ 2 ] ) : getenv ( $ match [ 1 ] ) ; return $ val !== false ? $ val : $ match [ 0 ] ; } , $ option ) ; }
docstring: Tokenize the given option, if it is a string.
  
  @param mixed $option
  
  @return mixed
docstring_tokens: Tokenize the given option if it is a string .