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