Skip to content

Commit

Permalink
Improve convert underscore to hypen
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 authored Mar 21, 2024
1 parent 908e5b3 commit 9114294
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Service/PathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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(),
});
}
Expand Down

0 comments on commit 9114294

Please sign in to comment.