src/SlugGenerator.php
private function fixTransliteratorRule(string $rule): string
	{
		static $latinAsciiFix;
		static $deAsciiFix;

		if ($latinAsciiFix === null) {
			$latinAsciiFix = \in_array('Latin-ASCII', \Transliterator::listIDs(), true)
				? false
				: file_get_contents(__DIR__.'/Resources/Latin-ASCII.txt')
			;
		}

		if ($deAsciiFix === null) {
			$deAsciiFix = \in_array('de-ASCII', \Transliterator::listIDs(), true)
				? false
				: file_get_contents(__DIR__.'/Resources/de-ASCII.txt')
			;
			if ($latinAsciiFix) {
				$deAsciiFix = str_replace('::Latin-ASCII;', $latinAsciiFix, $deAsciiFix);
			}
		}

		// Add the de-ASCII transform if a CLDR version lower than 32.0 is used.
		if ($deAsciiFix && $rule === 'de-ASCII') {
			return $deAsciiFix;
		}

		// Add the Latin-ASCII transform if a CLDR version lower than 1.9 is used.
		if ($latinAsciiFix && $rule === 'Latin-ASCII') {
			return $latinAsciiFix;
		}

		return $rule;
	}
private function fixTransliteratorRule(string $rule): string
	{
		static $latinAsciiFix;
		static $deAsciiFix;

		if ($latinAsciiFix === null) {
			$latinAsciiFix = \in_array('Latin-ASCII', \Transliterator::listIDs(), true)
				? false
				: file_get_contents(__DIR__.'/Resources/Latin-ASCII.txt')
			;
		}

		if ($deAsciiFix === null) {
			$deAsciiFix = \in_array('de-ASCII', \Transliterator::listIDs(), true)
				? false
				: file_get_contents(__DIR__.'/Resources/de-ASCII.txt')
			;
			if ($latinAsciiFix) {
				$deAsciiFix = str_replace('::Latin-ASCII;', $latinAsciiFix, $deAsciiFix);
			}
		}

		// Add the de-ASCII transform if a CLDR version lower than 32.0 is used.
		if ($deAsciiFix && $rule === 'de-ASCII') {
			return $deAsciiFix;
		}

		// Add the Latin-ASCII transform if a CLDR version lower than 1.9 is used.
		if ($latinAsciiFix && $rule === 'Latin-ASCII') {
			return $latinAsciiFix;
		}

		return $rule;
	}
private function fixTransliteratorRule ( string $ rule ) : string { static $ latinAsciiFix ; static $ deAsciiFix ; if ( $ latinAsciiFix === null ) { $ latinAsciiFix = \ in_array ( 'Latin-ASCII' , \ Transliterator :: listIDs ( ) , true ) ? false : file_get_contents ( __DIR__ . '/Resources/Latin-ASCII.txt' ) ; } if ( $ deAsciiFix === null ) { $ deAsciiFix = \ in_array ( 'de-ASCII' , \ Transliterator :: listIDs ( ) , true ) ? false : file_get_contents ( __DIR__ . '/Resources/de-ASCII.txt' ) ; if ( $ latinAsciiFix ) { $ deAsciiFix = str_replace ( '::Latin-ASCII;' , $ latinAsciiFix , $ deAsciiFix ) ; } } // Add the de-ASCII transform if a CLDR version lower than 32.0 is used. if ( $ deAsciiFix && $ rule === 'de-ASCII' ) { return $ deAsciiFix ; } // Add the Latin-ASCII transform if a CLDR version lower than 1.9 is used. if ( $ latinAsciiFix && $ rule === 'Latin-ASCII' ) { return $ latinAsciiFix ; } return $ rule ; }
Apply fixes to a transform rule for older versions of the Intl extension.

@param string $rule

@return string
Apply fixes to a transform rule for older versions of the Intl extension .