public function slugify($string, $options = null)
{
// BC: the second argument used to be the separator
if (is_string($options)) {
$separator = $options;
$options = [];
$options['separator'] = $separator;
}
$options = array_merge($this->options, (array) $options);
// Add a custom ruleset without touching the default rules
if (isset($options['ruleset'])) {
$rules = array_merge($this->rules, $this->provider->getRules($options['ruleset']));
} else {
$rules = $this->rules;
}
$string = strtr($string, $rules);
unset($rules);
if ($options['lowercase']) {
$string = mb_strtolower($string);
}
$string = preg_replace($options['regexp'], $options['separator'], $string);
return trim($string, $options['separator']);
}