Rename loosely mode to loose mode

This commit is contained in:
Alejandro Celaya
2023-01-29 10:29:26 +01:00
parent c140db16d1
commit d847c7648e
8 changed files with 39 additions and 16 deletions

View File

@@ -22,8 +22,8 @@ final class UrlShortenerOptions
) {
}
public function isLooselyMode(): bool
public function isLooseMode(): bool
{
return $this->mode === ShortUrlMode::LOOSELY;
return $this->mode === ShortUrlMode::LOOSE;
}
}

View File

@@ -5,5 +5,11 @@ namespace Shlinkio\Shlink\Core\ShortUrl\Model;
enum ShortUrlMode: string
{
case STRICT = 'strict';
case LOOSELY = 'loosely';
case LOOSE = 'loose';
/** @deprecated */
public static function tryDeprecated(string $mode): ?self
{
return $mode === 'loosely' ? self::LOOSE : self::tryFrom($mode);
}
}

View File

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