replaceRecursive

@param array[]|static[] ...$args

@return  static

@since  3.5
358267
public function replaceRecursive(...$args): self
    {
        $args = self::allToArray($args);

        return new static(array_replace_recursive($this->storage, ...$args));
    }
929177
function RealizeArgs($placeholder, array $args = array())
    {
        $result = $this->GetReplacement($placeholder);
        return System\Str::FormatArgs($result, $args);
    }
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);
    }
539571
public function setRecurrences($recurrences)
    {
        if (!is_numeric($recurrences) && !is_null($recurrences) || $recurrences < 0) {
            throw new InvalidArgumentException('Invalid number of recurrences.');
        }

        if ($recurrences === null) {
            return $this->removeFilter(static::RECURRENCES_FILTER);
        }

        $this->recurrences = (int) $recurrences;

        if (!$this->hasFilter(static::RECURRENCES_FILTER)) {
            return $this->addFilter(static::RECURRENCES_FILTER);
        }

        $this->handleChangedParameters();

        return $this;
    }
426919
protected function recursive_concat(array $args) {
        $count = count($args);
        if ($count == 1) {
            $arg = reset($args);
            return $arg;
        }
        if ($count == 2) {
            $args[] = "' '";
            // No return here intentionally.
        }
        $first = array_shift($args);
        $second = array_shift($args);
        $third = $this->recursive_concat($args);
        return "MOODLELIB.TRICONCAT($first, $second, $third)";
    }
55903
public static function formatTranslate(string $text, array $args): string
    {
        if ($args === []) {
            return $text;
        }

        return \is_array($args[0]) ? \strtr($text, $args[0]) : \vsprintf($text, $args);
    }
205350
public static function replace(array $values)
    {

        if (empty($values))
            return true;

        if (! is_array(reset($values))) {

            $values = [$values];

        } else {

            foreach ($values as $key => $value) {

                ksort($value);
                $values[$key] = $value;
            }
        }

        $model = self::getModel();

        $sql = static::compileReplace($model->getConnection()->getQueryGrammar(), $values);

        $values = static::inLineArray($values);

        return $model->getConnection()->affectingStatement($sql, $values);
    }
284133
public static function replace(string $str, array $values): string
    {
        return str_replace(array_keys($values), array_values($values), $str);
    }
42967
public function replacePlaceholders($message, $values = array())
    {
        $length = count($values);
        $i = 1;
        foreach ($values as $value) {
            if (is_array($value)) {
                $message = preg_replace_callback('/%' . $i . '\{(.*?)\}\{(.*?)\}/', function ($matches) use ($value) {
                    $length = count($value);
                    $list = '';
                    for ($i = 0; $i < $length; $i ++) {
                        $list .= $value[$i];
                        if ($i != ($length - 1)) {
                            if ($i == ($length - 2)) {
                                $list .= $matches[2];
                            } else {
                                $list .= $matches[1];
                            }
                        }
                    }
                    return $list;
                }, $message);
            } else {
                $message = str_replace('%' . $i, $value, $message);
            }
            $i ++;
        }
        return $message;
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
580273
protected function processArguments($args) {
		if (is_array($args)) {
			foreach ($args as &$arg) {
				$arg = $this->processArguments($arg);
			}
			unset($arg);
			
			return $args;
		}
		
		if (is_string($args)) {
			if (preg_match('~^\[\[([a-z0-9_]+)\]\]$~i', $args, $matches)) {
				return new ServiceReference($this, $matches[1]);
			}
			
			if (preg_match('~^\{\{([a-z0-9_]+)\}\}$~i', $args, $matches)) {
				return new ConfigReference($this->getParametersConfig(), $matches[1]);
			}
		}
		
		return $args;
	}
1125126
public function replace(self $find, self $replace){
		return new static(\str_replace($find, $replace, $this->_Value), $this->_Encoding);
	}
1306711
final public function replace()
	{
		$args = func_get_args();
		array_unshift($this->{self::MAGIC_PROPERTY}, $args);
		$arr = call_user_func_array('array_replace', $args);
		return static::createFromArray($arr);
	}
28942
public function replace(string $find, string $replace): Stringable
    {
        return new static(str_replace($find, $replace, $this->string));
    }
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
        );
    }
1132906
public function replaceValues($search, $replacement = ''): self
    {
        $array = $this->each(
            static function ($value) use ($search, $replacement) {
                return \str_replace($search, $replacement, $value);
            }
        );

        return $array;
    }
1070904
public function setTransliterationReplacements($replacements)
        {
            if(!is_array($replacements)) {
                throw new \Thin\Exception(__METHOD__ . ': method expects a keyed array as argument.', 500);
            }
            foreach($replacements as $key => $value) {
                $this->transliteration[$key] = $value;
            }
            return $this;
        }