]> Raphaël G. Git Repositories - userbundle/commitdiff
Use Transliterator from root namespace
authorRaphaël Gertz <git@rapsys.eu>
Wed, 28 Jul 2021 06:16:38 +0000 (08:16 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Wed, 28 Jul 2021 06:16:38 +0000 (08:16 +0200)
Utils/Slugger.php

index e781fa5c95e3c55e7b9a4605a3ba386053b4765e..8422f2c5715d20aa31b9ce7e764722704151242a 100644 (file)
@@ -106,7 +106,7 @@ class Slugger {
        function slug(string $string): string {
                //Use Transliterator if available
                if (class_exists('Transliterator')) {
-                       $trans = Transliterator::create('Any-Latin; Latin-ASCII; Lower()');
+                       $trans = \Transliterator::create('Any-Latin; Latin-ASCII; Lower()');
                        return preg_replace(['/[^a-zA-Z0-9]+/', '/(^-+|-+$)/'], ['-', ''], $trans->transliterate($string));
                }
                return preg_replace('/[\/_|+ -]+/', '-', strtolower(trim(preg_replace('/[^a-zA-Z0-9\/_|+ -]/', '', str_replace(['\'', '"'], ' ', iconv('UTF-8', 'ASCII//TRANSLIT', $string))), '-')));