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
        );
    }
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
        );
    }
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 ) ; }
Tokenize the given option, if it is a string.

@param mixed $option

@return mixed
Tokenize the given option if it is a string .