Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public static function toAscii($str, $replace = [], $delimiter = '-') |
||
18 | { |
||
19 | if (!empty($replace)) { |
||
20 | $str = str_replace((array) $replace, ' ', $str); |
||
21 | } |
||
22 | |||
23 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str); |
||
24 | $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean); |
||
25 | $clean = strtolower(trim($clean, '-')); |
||
26 | $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean); |
||
27 | |||
28 | return $clean; |
||
29 | } |
||
31 |