From 99c1a59dd45857a895359189afbb8f00365c7e76 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 28 Jan 2023 10:16:53 +0100 Subject: [PATCH] Refactor CustomSlugFilter for simplicity --- .../src/ShortUrl/Model/Validation/CustomSlugFilter.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module/Core/src/ShortUrl/Model/Validation/CustomSlugFilter.php b/module/Core/src/ShortUrl/Model/Validation/CustomSlugFilter.php index 8355a003..ec0b30d3 100644 --- a/module/Core/src/ShortUrl/Model/Validation/CustomSlugFilter.php +++ b/module/Core/src/ShortUrl/Model/Validation/CustomSlugFilter.php @@ -25,10 +25,9 @@ class CustomSlugFilter implements FilterInterface } $value = $this->options->isLooselyMode() ? strtolower($value) : $value; - if ($this->options->multiSegmentSlugsEnabled) { - return trim(str_replace(' ', '-', $value), '/'); - } - - return str_replace([' ', '/'], '-', $value); + return (match ($this->options->multiSegmentSlugsEnabled) { + true => trim(str_replace(' ', '-', $value), '/'), + false => str_replace([' ', '/'], '-', $value), + }); } }