@param string $old
@param string $new

@throws InvalidArgumentException
775007
public static function registerCustomView(string $old, string $new): void
    {
        if (Str::contains($old, self::NAMESPACE_SEPARATOR) && Str::contains($new, self::NAMESPACE_SEPARATOR)) {
            self::$replacements[$old] = $new;
        } else {
            throw new InvalidArgumentException();
        }
    }
747323
public static function mergeGroup($new, $old)
	{
		$new['namespace'] = static::formatUsesPrefix($new, $old);

		$new['prefix'] = static::formatGroupPrefix($new, $old);

		if (isset($new['domain'])) unset($old['domain']);

		$new['where'] = array_merge(array_get($old, 'where', []), array_get($new, 'where', []));

		return array_merge_recursive(array_except($old, array('namespace', 'prefix', 'where')), $new);
	}
346622
public function mergeConditions( ConditionInterface $old, ConditionInterface $new ) {
		if ( $old instanceof UrlCondition && $new instanceof UrlCondition ) {
			return $old->concatenate( $new->getUrl(), $new->getUrlWhere() );
		}

		return $this->makeFromArrayOfConditions( [$old, $new] );
	}
1084646
protected static function formatUsesPrefix($new, $old)
    {
        if (isset($new['namespace'])) {
            return isset($old['namespace']) && \strpos($new['namespace'], '\\') !== 0
                ? \trim($old['namespace'], '\\').'\\'.\trim($new['namespace'], '\\')
                : \trim($new['namespace'], '\\');
        }

        return $old['namespace'] ?? null;
    }
1174536
protected function _overwrite(&$old, $new)
    {
        if (!empty($old)) {
            foreach ($old as $key => $var) {
                if (!isset($new[$key])) {
                    unset($old[$key]);
                }
            }
        }
        foreach ($new as $key => $var) {
            $old[$key] = $var;
        }
    }
519666
private function buildDiffTable(Text $old, Text $new) {
        $diffTable = [array_fill(0, count($new) + 1, 0)];
        for ($row = 1; $row <= count($old); $row++) {
            $diffTable[$row] = [0];
            for ($col = 1; $col <= count($new); $col++) {
                $diffTable[$row][$col] = $old[$row - 1] === $new[$col - 1]
                    ? $diffTable[$row - 1][$col - 1] + 1
                    : max($diffTable[$row - 1][$col], $diffTable[$row][$col - 1]);
            }
        }

        return $diffTable;
    }
272345
protected function formatNamespace(array $new, array $old)
    {
        if (isset($new['namespace']) && isset($old['namespace'])) {
            return trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\');
        } elseif (isset($new['namespace'])) {
            return trim($new['namespace'], '\\');
        }

        return Arr::get($old, 'namespace');
    }
530836
protected function merge(array $old, array $new)
    {
        foreach ($new as $key => $value) {
            if (isset($old[$key]) && is_array($old[$key]) && is_array($value)) {
                $old[$key] = $this->merge($old[$key], $value);
            } else {
                $old[$key] = $value;
            }
        }

        return $old;
    }
1009627
public function replace(DOMElement &$old, &$new)
    {
        // Check if the element has a parent node
        if (empty($old->parentNode)) {
            throw new DOMException('The current DOMItem has no parent.');
        }

        // Replace the element
        $old->parentNode->replaceChild($new, $old);

        return $new;
    }
1347198
public static function move($oldName, $newName, $context = null)
    {
        return self::rename($oldName, $newName, $context);
    }
22044
protected function formatNamespace(array $new, array $old)
    {
        if (isset($new['namespace']) && isset($old['namespace'])) {
            return trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\');
        } elseif (isset($new['namespace'])) {
            return trim($new['namespace'], '\\');
        }

        return array_get($old, 'namespace');
    }
93268
public static function mergeGroup($new, $old)
    {
        $new['namespace'] = static::formatUsesPrefix($new, $old);

        $new['prefix'] = static::formatGroupPrefix($new, $old);

        if (isset($new['domain'])) {
            unset($old['domain']);
        }

        $new['where'] = array_merge(
            isset($old['where']) ? $old['where'] : array(),
            isset($new['where']) ? $new['where'] : array()
        );

        if (isset($old['as'])) {
            $new['as'] = $old['as'] .(isset($new['as']) ? $new['as'] : '');
        }

        return array_merge_recursive(
            Arr::except($old, array('namespace', 'prefix', 'where', 'as')), $new
        );
    }
50549
protected function formatNamespace(array $new, array $old)
    {
        if (isset($new['namespace']) && isset($old['namespace'])) {
            return trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\');
        } elseif (isset($new['namespace'])) {
            return trim($new['namespace'], '\\');
        }

        return $old['namespace'] ?? null;
    }
1011933
protected static function formatGroupPrefix($new, $old)
    {
        $oldPrefix = $old['prefix'] ?? null;

        if (isset($new['prefix'])) {
            return \trim($oldPrefix, '/').'/'.\trim($new['prefix'], '/');
        }

        return $oldPrefix;
    }
725102
public function rename($oldName, $newName)
	{
		$form = $this->get($oldName);
		$this->delete($oldName);
		$this->add($newName, $form['code'], $form['title']);
	}
818351
protected function updateFavicon( $new, $old )
    {
        $this->removeFile( $old );
        $new = $this->addFile( $new, 'settings/favicon.%2$s' );
        $this->setSetting( 'faviconType', $this->getMime( $new ) );
        return $new;
    }
1361741
private static function refactorRoute($old, $new)
    {
        $confPath = CustomRoutesManager::$path;
        $conf = new ArrayConfigManager($confPath);
        $routes = $conf->getConfigsArray();
        while($key = array_search($old,$routes)){
            $routes[$key] = $new;
        }
        $conf->setConfigsArray($routes);
        $conf->writeConfig();
    }