Pantheon\Terminus\Config::replacePlaceholders PHP Méthode

replacePlaceholders() private méthode

Exchanges values in [[ ]] in the given string with constants
private replacePlaceholders ( string $string ) : string
$string string The string to perform replacements on
Résultat string $string The modified string
    private function replacePlaceholders($string)
    {
        $regex = '~\\[\\[(.*?)\\]\\]~';
        preg_match_all($regex, $string, $matches);
        if (!empty($matches)) {
            foreach ($matches[1] as $id => $value) {
                $replacement_key = $this->getKeyFromConstant(trim($value));
                if (isset($this->config[$replacement_key])) {
                    $replacement = $this->config[$replacement_key];
                    $string = str_replace($matches[0][$id], $replacement, $string);
                }
            }
        }
        $fixed_string = $this->fixDirectorySeparators(str_replace('~', $this->getHomeDir(), $string));
        return $fixed_string;
    }