Refactor CustomSlugFilter for simplicity

This commit is contained in:
Alejandro Celaya 2023-01-28 10:16:53 +01:00
parent 3a149c9edc
commit 99c1a59dd4

View File

@ -25,10 +25,9 @@ class CustomSlugFilter implements FilterInterface
} }
$value = $this->options->isLooselyMode() ? strtolower($value) : $value; $value = $this->options->isLooselyMode() ? strtolower($value) : $value;
if ($this->options->multiSegmentSlugsEnabled) { return (match ($this->options->multiSegmentSlugsEnabled) {
return trim(str_replace(' ', '-', $value), '/'); true => trim(str_replace(' ', '-', $value), '/'),
} false => str_replace([' ', '/'], '-', $value),
});
return str_replace([' ', '/'], '-', $value);
} }
} }