Replace placeholder text with correct values.

@return string
341037
protected function formatContent($content)
    {
        return str_replace(
            ['{{slug}}', '{{name}}', '{{namespace}}'],
            [$this->slug, $this->name, $this->pluggable->getNamespace()],
            $content
        );
    }
500475
protected function placeholderClb($matches)
    {
        $placeholder = isset($matches[1]) ? $matches[1] : '';
        if (isset($matches[3])) {
            $name = $matches[3];
            if (empty($name)) {
                /* There is a named placeholder without name ("?set:") */
                throw new UnknownPlaceholder($matches[0]);
            }
        } else {
            $name = null;
            if ($placeholder == '?') { // "??" for question mark
                return '?';
            }
        }
        if ($name) {
            if ($this->counter == 0) {
                $this->named = true;
            } elseif (!$this->named) {
                /* There is a named placeholder although already used regular */
                throw new MixedPlaceholder($matches[0]);
            }
            if (!array_key_exists($name, $this->data)) {
                throw new DataNamed($name);
            }
            $value = $this->data[$name];
        } elseif ($this->named) {
            /* There is a regular placeholder although already used named */
            throw new MixedPlaceholder($matches[0]);
        } else {
            if (!array_key_exists($this->counter, $this->data)) {
                /* Data for regular placeholders is ended */
                throw new DataNotEnough(count($this->data), $this->counter);
            }
            $value = $this->data[$this->counter];
        }
        $this->counter++;
        $parser = new ParserPH($placeholder);
        $type = $parser->getType();
        $modifiers = $parser->getModifiers();
        $method = 'replacement'.strtoupper($type);
        return $this->$method($value, $modifiers);
    }
1277079
protected function replacePlaceholders($line, array $replace)
    {
        if (!$replace) {
            return $line;
        }

        foreach ($replace as $placeholder=>$replacement) {
            $line = str_replace($this->placeholderPrefix.$placeholder.$this->placeholderSuffix, $replacement, $line);
        }
        return $line;
    }
185634
public function replace() {

		if(null !== $this -> match) {

			foreach($this -> match[0] as $index => $match) {

				$match 	= new MatchTranslation($this -> match[2][$index], true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchEscape($output, true);
				$output = $match -> replace() -> getLine();
				
				$match 	= new MatchRouter($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchHelper($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchFails($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchPasses($output, true);
				$output = $match -> replace() -> getLine();

				//User defined functions
				foreach(TemplateData :: getTemplateFunctions() as $action => $closure) {

					$class  = Template :: NAMESPACE_MATCH . 'MatchUserDefined';
					$match  = new $class($output, $action, true);
					$output = $match -> replace() -> getLine();
				}

				$match 	= new MatchVariable($output);
				$output = $match -> replace() -> getLine();

				$code = '$this -> template(\'' . $this -> action . '\', [' . $output . '])';
				$code = false === $this -> getInline() ? '<?php echo ' . $code . '; ?>' : $code;

				$this -> line = preg_replace('/' . preg_quote($this -> match[0][$index], '/') . '/', $code, $this -> line , 1);
			}
		}

		return $this;
	}
503896
public function GetReplacement($placeholder)
    {
        if (isset($this->texts[$placeholder]))
        {
            return $this->texts[$placeholder];
        }
        return $this->phpTranslator->GetReplacement($placeholder);
    }
679712
function replace(translation, replacements) {
    // check if the object has a replace property
    if (!translation.replace) {
      return translation;
    }

    return translation.replace(matcher, function (placeholder) {
      // remove the identifiers (can be set on the module level)
      var key = placeholder.replace(identifiers[0], '').replace(identifiers[1], '');

      if (replacements[key] !== undefined) {
        return replacements[key];
      } // warn user that the placeholder has not been found


      if (warnings) {
        console.group ? console.group('i18n: Not all placeholders found') : console.warn('i18n: Not all placeholders found');
        console.warn('Text:', translation);
        console.warn('Placeholder:', placeholder);

        if (console.groupEnd) {
          console.groupEnd();
        }
      } // return the original placeholder


      return placeholder;
    });
  }
182396
public function restorePlaceholders($contents)
    {
        foreach ($this->all() as $placeholder => $original) {
            $contents = str_replace($placeholder, $original, $contents);
        }

        return $contents;
    }
15799
public function getPlaceHolderText($handle)
    {
        $pageValues = $this->getAvailablePageValues();
        if (in_array($handle, array_keys($pageValues))) {
            $placeHolder = $pageValues[$handle];
        } else {
            $attributeKey = CollectionAttributeKey::getByHandle($handle);
            if (is_object($attributeKey)) {
                $placeHolder = $attributeKey->getAttributeKeyName();
            }
        }

        return "[" . $placeHolder . "]";
    }
740363
private function replacePlaceHolder($value)
    {
        $value=str_replace(self::OBJECT_CONFIG_BASE_DIR_PLACE_HOLDER, $this->m_config->getBaseDir(), $value);
        $value=str_replace(self::OBJECT_CONFIG_USER_DIR_PLACE_HOLDER, $this->m_config->getUserDir(), $value);
        $value=str_replace(self::OBJECT_CONFIG_CONFIG_DIR_PLACE_HOLDER, $this->m_config->getConfigDir(), $value);
        return $value;
    }
1203696
public function replace()
	{
		foreach($this->matches as $match)
		{
			$value = $this->extractValue($match);
			$this->insertValue($value, $match['raw']);
		}
	}
718724
private function replacePlaceholders(array $translations, array $replacements, array $genders, $gender)
    {
        foreach ($translations as $key => $value) {
            if (!is_array($value)) {
                $translations[$key] = strtr($value, $replacements);

                continue;
            }
            if (array_keys($value) === $genders) {
                $translations[$key] = strtr($value[$gender], $replacements);

                continue;
            }

            $translations[$key] = $this->replacePlaceholders($value, $replacements, $genders, $gender);
        }

        return $translations;
    }
611343
protected function placeholderResolver()
    {
        if (null === $this->placeholderResolver) {
            $this->placeholderResolver = new RegexPlaceholderResolver(new ConfigurationDataSource($this), '%', '%');
        }

        return $this->placeholderResolver;
    }
473797
public function getProcessedHelp()
    {
        $name = $this->name;

        $placeholders = [
            '%controller.name%',
            '%controller.full_name%',
        ];
        $replacements = [
            $name,
            $_SERVER['PHP_SELF'] . ' ' . $name,
        ];

        return str_replace($placeholders, $replacements, $this->getHelp());
    }
1119855
private function replacePlaceholders(string $path, array $placeholders): string
    {
        $result            = '';
        $inPlaceholder     = false;
        $curPlaceholder    = null;
        $inPlaceholderName = false;
        $pathLength        = strlen($path);
        for ($index = 0; $index < $pathLength; ++$index) {
            $character = $path[$index];
            switch ($character) {
                case '{':
                    assert($inPlaceholder === false, 'Nested placeholders (e.g. `{{}}}` are not allowed.');
                    $inPlaceholder     = true;
                    $inPlaceholderName = true;
                    break;
                case '}':
                    $result .= array_key_exists($curPlaceholder, $placeholders) === true ?
                        $placeholders[$curPlaceholder] : '{' . $curPlaceholder . '}';

                    $inPlaceholder     = false;
                    $curPlaceholder    = null;
                    $inPlaceholderName = false;
                    break;
                default:
                    if ($inPlaceholder === false) {
                        $result .= $character;
                    } else {
                        if ($character === ':') {
                            $inPlaceholderName = false;
                        } elseif ($inPlaceholderName === true) {
                            $curPlaceholder .= $character;
                        }
                    }
                    break;
            }
        }

        return $result;
    }
1295390
private function replaceDummyContent()
    {
        // Replace DummyTheme string in Controllers
        $this->replaceDummy($this->destinationDir . '/controllers');

        // Replace DummyTheme string in views
        $this->replaceDummy($this->destinationDir . '/views');

        // Replace DummyTheme string in config
        $this->replaceDummyInFile($this->destinationDir.'/config.json');

        return $this;
    }
37238
protected function stubReplace($placeholder, $replace, $pregReplace = false)
    {
        if ($pregReplace) {

            $this->data->output['content'] = preg_replace(
                $placeholder,
                $replace,
                $this->data->output['content']
            );

        } else {

            $this->data->output['content'] = str_replace(
                $placeholder,
                $replace,
                $this->data->output['content']
            );
        }

        return $this;
    }
825130
public function getPlaceholder(): Placeholder
    {
        if ($this->placeholderInstance === null) {
            $this->placeholderInstance = new Placeholder();
        }

        return $this->placeholderInstance;
    }