Prepare bindings for text replacement.

@param  array   $replacements
@param  string  $prefix
@param  string  $suffix

@return array
341702
protected static function prepareBinding(array $replacements = [], $prefix = '{', $suffix = '}')
    {
        $replacements = Arr::dot($replacements);
        $bindings     = [];

        foreach ($replacements as $key => $value) {
            $bindings["{$prefix}{$key}{$suffix}"] = $value;
        }

        return $bindings;
    }
860734
public function setPrefix(string $prefix)
    {
        foreach ($this->caches as $cache) {
            $cache->setPrefix($prefix);
        }
    }
1196375
protected function mergeReplacements(array $replacements)
    {
        return $this->getShortcodes()
            ->transform(function ($key) use ($replacements) {
                return Arr::get($replacements, $key);
            })
            ->filter();
    }
11169
public function replaceAll(Text $text, $pattern, $replacement)
    {
        $input = array(
            'text' => $text,
            'pattern' => $pattern,
            'replacement' => $replacement,
        );
        $this->commandInvoker->run('replace_all', $input);
    }
418735
private function setPrefixes( array $prefixes ) {
		foreach ( $prefixes as $prefix => $iri ) {
			$this->expressionValidator->validate( $prefix, ExpressionValidator::VALIDATE_PREFIX );
			$this->expressionValidator->validate( $iri, ExpressionValidator::VALIDATE_IRI );

			$this->prefixes[$prefix] = $iri;
		}

		$this->usageValidator->trackDefinedPrefixes( array_keys( $this->prefixes ) );
	}
1154565
protected function replace(array $data, $template, $prefix = null)
    {
        foreach ($data as $k => $d) {
            if (is_array($d)) {
                return $this->replace($d, $template, $k . '.');
            } else {
                $template = str_replace('{' . (!empty($prefix) ? $prefix . $k : $k) . '}', $d, $template);
            }
        }

        return $template;
    }
1132906
public function replaceValues($search, $replacement = ''): self
    {
        $array = $this->each(
            static function ($value) use ($search, $replacement) {
                return \str_replace($search, $replacement, $value);
            }
        );

        return $array;
    }
891541
private function replaceBasic($searchFor, $replaceWith)
    {
        if ($this->isPrefixUsed()) {
            $searchFor = $this->globalPrefix . $searchFor;
        }

        $this->doReplace($searchFor, $replaceWith);
    }
614069
public static function setPrefix($prefix)
    {
        if (!empty($prefix) && is_string($prefix)) {
            self::$prefix = $prefix;
            return true;
        }

        return false;
    }
986826
public static function replace(array $words, $replacement, $text)
    {
        $replace = (mb_strlen($replacement) > 1)
            ? $replacement
            : static::transformReplacement($words, $replacement);

        return str_replace($words, $replace, $text);
    }
555433
private function parse_diacritics_rules( array $diacritics_rules, array &$patterns, array &$replacements ) {

		foreach ( $diacritics_rules as $needle => $replacement ) {
			$patterns[]              = '/\b(?<!\w[' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . '])' . $needle . '\b(?![' . U::NO_BREAK_SPACE . U::SOFT_HYPHEN . ']\w)/u';
			$replacements[ $needle ] = $replacement;
		}
	}
1320501
public function replace($contents, array $variables = [], array $replacements = [])
    {
        $contents = str_replace($variables, $replacements, $contents);
        $contents = preg_replace('/^ +$/m', '', $contents);

        return $contents;
    }
613839
public function replace(array $words, $replace, $text)
    {
        if (! $this->isHan($text)) {
            return $this->replaceExact($words, $replace, $text);
        }

        return Replace\Chinese::replace($words, $replace, $text);
    }
222539
public function replaceContents(Array $replacements) {
    $this->writeContents(
      str_replace(
                  array_keys($replacements),
                  array_values($replacements),
                  $this->getContents()
                 )
    );
    return $this;
  }
1123913
public function replaceSuffix($searchFor, $replaceWith = null) {
		if ($this->endsWith($searchFor)) {
			return $this->replaceLast($searchFor, $replaceWith);
		}
		else {
			return $this;
		}
	}
850237
public function setIdPrefix(string $prefix = null)
    {
        foreach ((array)$this as $element) {
            if (is_object($element)) {
                $element->setIdPrefix($prefix);
            }
        }
    }
1119061
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
    {
        $prefix = trim(trim($prefix), '/');

        if ('' === $prefix) {
            return;
        }

        foreach ($this->routes as $route) {
            $route->setPath('/'.$prefix.$route->getPath());
            $route->addDefaults($defaults);
            $route->addRequirements($requirements);
        }
    }