Total Complexity | 2 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | trait CustomSlugify |
||
13 | { |
||
14 | |||
15 | /* |
||
16 | * Rerurn slug string with support TH language |
||
17 | */ |
||
18 | private function slugify_th($string, $separator) |
||
19 | { |
||
20 | $string = trim($string); |
||
21 | $string = mb_strtolower($string, 'UTF-8'); |
||
22 | |||
23 | // Make alphanumeric (removes all other characters) |
||
24 | // this makes the string safe especially when used as a part of a URL |
||
25 | // this keeps latin characters and Persian characters as well |
||
26 | $string = preg_replace("/[^a-z0-9_\s-ๅภถุึคตจขชๆไำพะัีรนยบลฃฟหกดเ้่าสวงผปแอิืทมใฝูฎฑธ๊ณญฐฅฤฆฏโฌ็๋ษศซฉฮ์ฒฬฦ]/u", '', $string); |
||
27 | |||
28 | // Remove multiple dashes or whitespaces or underscores |
||
29 | $string = preg_replace("/[\s-_]+/", ' ', $string); |
||
30 | |||
31 | // Convert whitespaces and underscore to the given separator |
||
32 | $string = preg_replace("/[\s_]/", $separator, $string); |
||
33 | |||
34 | return $string; |
||
35 | } |
||
36 | |||
37 | public function customizeSlugEngine(Slugify $engine, $attribute) |
||
42 | } |
||
43 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.