Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
66 | 1 | private function sluggable($title, $separator = '-') |
|
67 | { |
||
68 | 1 | $flip = $separator == '-' ? '_' : '-'; |
|
69 | |||
70 | 1 | $title = preg_replace('![' . preg_quote($flip) . ']+!u', $separator, $title); |
|
71 | |||
72 | 1 | $title = preg_replace('![^' . preg_quote($separator) . '\pL\pN\s]+!u', '', mb_strtolower($title)); |
|
73 | |||
74 | 1 | $title = preg_replace('![' . preg_quote($separator) . '\s]+!u', $separator, $title); |
|
75 | |||
76 | 1 | return trim($title, $separator); |
|
77 | } |
||
78 | } |