src/SlugGenerator.php
private function applyTransformRule(string $text, string $rule, string $locale, string $regex): string
	{
		$transliterator = $this->getTransliterator($rule, $locale);
		$newText = '';
		$offset = 0;

		foreach ($this->getRanges($text, $regex) as $range) {
			$newText .= substr($text, $offset, $range[0] - $offset);
			$newText .= $this->transformWithContext($transliterator, $text, $range[0], $range[1]);
			$offset = $range[0] + $range[1];
		}

		$newText .= substr($text, $offset);

		return $newText;
	}
private function applyTransformRule(string $text, string $rule, string $locale, string $regex): string
	{
		$transliterator = $this->getTransliterator($rule, $locale);
		$newText = '';
		$offset = 0;

		foreach ($this->getRanges($text, $regex) as $range) {
			$newText .= substr($text, $offset, $range[0] - $offset);
			$newText .= $this->transformWithContext($transliterator, $text, $range[0], $range[1]);
			$offset = $range[0] + $range[1];
		}

		$newText .= substr($text, $offset);

		return $newText;
	}
private function applyTransformRule ( string $ text , string $ rule , string $ locale , string $ regex ) : string { $ transliterator = $ this -> getTransliterator ( $ rule , $ locale ) ; $ newText = '' ; $ offset = 0 ; foreach ( $ this -> getRanges ( $ text , $ regex ) as $ range ) { $ newText .= substr ( $ text , $ offset , $ range [ 0 ] - $ offset ) ; $ newText .= $ this -> transformWithContext ( $ transliterator , $ text , $ range [ 0 ] , $ range [ 1 ] ) ; $ offset = $ range [ 0 ] + $ range [ 1 ] ; } $ newText .= substr ( $ text , $ offset ) ; return $ newText ; }
Apply a transform rule with the specified locale
to the parts that match the regular expression.

@param string $text
@param string $rule
@param string $locale
@param string $regex

@return string
Apply a transform rule with the specified locale to the parts that match the regular expression .