public function replaceKeysToSelf($string, Collection $keys)
    {
        preg_match_all("/\{\{'((?:[^{}]|(?R))*)\'\}\}/", $string, $matches);

        foreach ($matches[0] as $key => $value) {
            $string = str_replace($matches[0][$key], array_get($keys->toArray(), $matches[1][$key]), $string);
        }

        return $string;
    }
public function replaceKeysToSelf($string, Collection $keys)
    {
        preg_match_all("/\{\{'((?:[^{}]|(?R))*)\'\}\}/", $string, $matches);

        foreach ($matches[0] as $key => $value) {
            $string = str_replace($matches[0][$key], array_get($keys->toArray(), $matches[1][$key]), $string);
        }

        return $string;
    }
public function replaceKeysToSelf ( $ string , Collection $ keys ) { preg_match_all ( "/\{\{'((?:[^{}]|(?R))*)\'\}\}/" , $ string , $ matches ) ; foreach ( $ matches [ 0 ] as $ key => $ value ) { $ string = str_replace ( $ matches [ 0 ] [ $ key ] , array_get ( $ keys -> toArray ( ) , $ matches [ 1 ] [ $ key ] ) , $ string ) ; } return $ string ; }
Replace keys to self.

@param $string
@param $keys Collection

@return mixed
Replace keys to self .