From 91142945bae91b25037981bae5b4372f289203d6 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Thu, 21 Mar 2024 23:33:13 +0100 Subject: [PATCH] Improve convert underscore to hypen --- Service/PathResolver.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Service/PathResolver.php b/Service/PathResolver.php index baae860..d5fef82 100644 --- a/Service/PathResolver.php +++ b/Service/PathResolver.php @@ -11,8 +11,7 @@ use Opengento\StorePathUrl\Model\Config; use Opengento\StorePathUrl\Model\Config\PathType; -use function explode; -use function implode; +use function str_replace; use function strtok; use function strtolower; @@ -27,7 +26,7 @@ public function resolve(ScopeInterface|StoreInterface $scope): string PathType::CountryCode => $this->config->getCountry($scope), PathType::LanguageCode => strtok($this->config->getLocale($scope), '_'), PathType::LocaleUnderscore => $this->config->getLocale($scope), - PathType::LocaleHyphen => implode('-', explode('_', $this->config->getLocale($scope))), + PathType::LocaleHyphen => str_replace('_', '-', $this->config->getLocale($scope)), PathType::Custom => $this->config->getCustomPathMapper()[(int)$scope->getId()] ?? $scope->getCode(), }); }