@param       $url
@param array $replacements

@return $this
972120
function addBreadCrumb($route_name, $params = [], $replacements = []) {
        $url        = route($route_name, $params, false);
        $title                   = \LaraPage::pageTitle($route_name, $replacements);
        $h1                      = \LaraPage::pageH1($route_name, $replacements);
        $h1_ext                  = \LaraPage::pageH1Ext($route_name, $replacements);
        $description             = \LaraPage::pageH1Ext($route_name, $replacements);
        $icon                    = Route::routeIcons($route_name);
        $this->breadcrumbs[$url] = compact('title', 'icon');
        $this->setUrl($url);
        $_title = [];
        foreach($this->breadcrumbs as $url => $breadcrumb) {
            $_title[] = Arr::get($breadcrumb, 'title');
        }
        $_title = array_reverse($_title);
        $this->setTitle(implode(', ', $_title))->setDescription($description);

        return $this;
    }
1364954
public static function replaceInFile($filename, $replacements){
		$content = \file_get_contents($filename);
		foreach ($replacements as $find => $replace) {
			$content = \str_replace($find, $replace, $content);
		}
		\file_put_contents($filename, $content);
	}
690142
public function addAlternate(string $url, string $locale = '')
    {
        $this->alternates[] = new Alternate($url, $locale);

        return $this;
    }
1147968
public function setUrl($url)
    {
        $this->url = $url;

        // Normalize URL if its relative (strictly speaking), or has leading slashes
        if (Director::is_relative_url($url) || preg_match('/^\//', $url)) {
            $this->url = preg_replace(array('/\/+/','/^\//', '/\/$/'), array('/','',''), $this->url);
        }
        if (preg_match('/^(.*)\.([A-Za-z][A-Za-z0-9]*)$/', $this->url, $matches)) {
            $this->url = $matches[1];
            $this->extension = $matches[2];
        }
        if ($this->url) {
            $this->dirParts = preg_split('|/+|', $this->url);
        } else {
            $this->dirParts = array();
        }

        return $this;
    }
1054070
protected function expandPatterns(array $patterns, $search, array $replacements)
    {
        if ($replacements === []) {
            return $patterns;
        }
        $patternsWithReplacements = [];
        foreach ($patterns as $pattern) {
            foreach ($replacements as $replacement) {
                $patternsWithReplacements[] = Files::getUnixStylePath(str_replace($search, $replacement, $pattern));
            }
        }

        return $patternsWithReplacements;
    }
418339
static public function pregReplaceUrl($url, $replace=null)
	{
	    $newUrl = [];
	    if (is_string($url)) {
	        $url   = str_replace(["\r\n", "\n"], " ", $url);
	        $url   = preg_split('/[\s]+/', $url);
	        
	        if (!isset($url[1])) {
	            $url = $url[0];
	        }
	    }
	    
	    if (is_array($url)) foreach ($url as $v) {
	        $temps = static::pregReplaceUrl($v, $replace);
	        return array_merge($newUrl, $temps);
	    }
	    
	    $url = static::formatUrl($url);
	    
	    // url 中的变量 {id:int}
	    preg_match('/\{(\w+)(\:(int|num|string))?\}/', $url, $matches);
	    
	    if (!$matches) {
	        return (array) $url;
	    }
	    
	    // url format
	    $name = $matches[1];
	    $type = isset($matches[2]) ? trim($matches[2], ':') : 'int';
	    if (!in_array($type, ['int', 'num', 'string'])) {
	        $type = 'string';
	    }
	    
	    // handle replace
	    $replaceArr = [];
	    if ($replace) {
	        if (is_string($replace)) {
	            $replace   = str_replace(["\r\n", "\n", "<br>"], "\n", $replace);
	            $replace   = explode("\n", $replace);
	            foreach ($replace as $v) {
	                $v = explode('=', $v, 2);
	                $rname = str_replace(['{', '}'], '', $v[0]);
	                if (isset($v[1])) {
	                    $replaceArr[$rname] = $v[1];
	                } else {
	                    $replaceArr[] = $v[0];
	                }
	            }
	        } else {
	            $replaceArr = & $replace;
	        }
	    }
	    
	    // replace
	    $newReplace = isset($replaceArr[$name]) ? $replaceArr[$name] : (isset($replaceArr[0]) ? $replaceArr[0] : null);
	    if (!$newReplace) return (array) $url;
	    
	    if ($type == 'int' || $type == 'num') {
	        $newReplace    = NumberHelper::toIntArray($newReplace);
	    } else {
	        $newReplace = (array) $newReplace;
	    }
	    
	    foreach ($newReplace as $rv) {
	        $u = str_replace($matches[0], $rv, $url);
	        
	        // 递归替换参数
	        $temps = static::pregReplaceUrl($u, $replaceArr);
	        $newUrl = array_merge($newUrl, $temps);
	    }
	    
	    return $newUrl;
	}
832520
public function replace($newUrl, $opt = self::SCHEME | self::HOST | self::PORT | self::CREDENTIALS | self::PATH | self::QUERY | self::FRAGMENT)
	{
		if ($newUrl instanceof Url) {
			$url = $newUrl;
		} else if (is_string($newUrl)) {
			$url = new Url($newUrl);
		} else {
			throw new InvalidUrlException();
		}
		$scheme = ($opt & self::SCHEME) === self::SCHEME;
		$host = ($opt & self::HOST) === self::HOST;
		$port = ($opt & self::PORT) === self::PORT;
		$creds = ($opt & self::CREDENTIALS) === self::CREDENTIALS;
		$path = ($opt & self::PATH) === self::PATH;
		$query = ($opt & self::QUERY) === self::QUERY;
		$fragment = ($opt & self::FRAGMENT) === self::FRAGMENT;
		if ($scheme) {
			$this->scheme->set($url->scheme->get());
		}
		if ($host) {
			$this->host->set($url->host->get());
		}
		if ($port) {
			$this->port->set($url->port->get());
		}
		if ($creds) {
			$this->credentials->username = $url->credentials->username;
			$this->credentials->password = $url->credentials->password;
		}
		if ($path) {
			$this->path->set($url->path->get());
		}
		if ($query) {
			$this->query->parseComponent($url->query->__toString());
		}
		if ($fragment) {
			$this->fragment->set($url->fragment->get());
		}
		return $this;
	}
328367
public function setVary($headers, $replace = TRUE) {

		$this->headers->set('Vary', $headers, $replace);
		return $this;

	}
881806
public function replaceOneValue($search, $replacement = ''): self
    {
        $array = $this->getArray();
        $key = \array_search($search, $array, true);

        if ($key !== false) {
            $array[$key] = $replacement;
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
222539
public function replaceContents(Array $replacements) {
    $this->writeContents(
      str_replace(
                  array_keys($replacements),
                  array_values($replacements),
                  $this->getContents()
                 )
    );
    return $this;
  }
62008
public function setUrl($url)
    {
        $this->meta()->setUrl($url);
        $this->openGraph()->setUrl($url);

        return $this;
    }
1196375
protected function mergeReplacements(array $replacements)
    {
        return $this->getShortcodes()
            ->transform(function ($key) use ($replacements) {
                return Arr::get($replacements, $key);
            })
            ->filter();
    }
604573
public static function replace($text, array $replacements = [], $prefix = '{', $suffix = '}')
    {
        $replacements = static::prepareBinding($replacements, $prefix, $suffix);

        $filter = function ($text) use ($replacements) {
            return strtr($text, $replacements);
        };

        if (is_array($text)) {
            $text = array_map($filter, $text);
        } else {
            $text = $filter($text);
        }

        return $text;
    }
1029809
public function parser($text, $replacements = []): string
	{
		global $context;

		if (empty($text) || empty($replacements) || !is_array($replacements))
			return '';

		// Split the replacements up into two arrays, for use with str_replace.
		$find = [];
		$replace = [];

		foreach ($replacements as $f => $r)
		{
			$find[] = '{' . $f . '}';
			$replace[] = $r . ((strpos($f,'href') !== false) ? (';'. $context['session_var'] .'='. $context['session_id']) : '');
		}

		// Do the variable replacements.
		return str_replace($find, $replace, $text);
	}
176344
public function replacements($replacements = null)
    {
        if (!is_null($replacements)) {
            $this->replacements = $replacements;
        }

        return $this->replacements;
    }
385177
protected function link($keys, $replacements, $url, $title)
    {
        return HTML::link(handles(str_replace($keys, $replacements, $url)), $title);
    }
779482
public function slug($string, $replacement = '-')
    {
        $options = $this->config;
        $regex = $options['regex'];
        unset($options['regex']);

        return Slugify::create($regex, $options)->slugify($string, $replacement);
    }