Skip to content

Commit 9114294

Browse files
authored
Improve convert underscore to hypen
1 parent 908e5b3 commit 9114294

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Service/PathResolver.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
use Opengento\StorePathUrl\Model\Config;
1212
use Opengento\StorePathUrl\Model\Config\PathType;
1313

14-
use function explode;
15-
use function implode;
14+
use function str_replace;
1615
use function strtok;
1716
use function strtolower;
1817

@@ -27,7 +26,7 @@ public function resolve(ScopeInterface|StoreInterface $scope): string
2726
PathType::CountryCode => $this->config->getCountry($scope),
2827
PathType::LanguageCode => strtok($this->config->getLocale($scope), '_'),
2928
PathType::LocaleUnderscore => $this->config->getLocale($scope),
30-
PathType::LocaleHyphen => implode('-', explode('_', $this->config->getLocale($scope))),
29+
PathType::LocaleHyphen => str_replace('_', '-', $this->config->getLocale($scope)),
3130
PathType::Custom => $this->config->getCustomPathMapper()[(int)$scope->getId()] ?? $scope->getCode(),
3231
});
3332
}

0 commit comments

Comments
 (0)