6
6
7
7
namespace Opengento \StorePathUrl \Service ;
8
8
9
+ use Magento \Framework \App \ScopeInterface ;
9
10
use Magento \Store \Api \Data \StoreInterface ;
10
11
use Opengento \StorePathUrl \Model \Config ;
11
12
use Opengento \StorePathUrl \Model \Config \PathType ;
@@ -18,14 +19,14 @@ class PathResolver
18
19
{
19
20
public function __construct (private Config $ config ) {}
20
21
21
- public function resolve (StoreInterface $ store ): string
22
+ public function resolve (ScopeInterface | StoreInterface $ scope ): string
22
23
{
23
24
return strtolower (match ($ this ->config ->getStorePathType ()) {
24
- PathType::StoreCode => $ store ->getCode (),
25
- PathType::CountryCode => $ this ->config ->getCountry ($ store ),
26
- PathType::LocaleUnderscore => $ this ->config ->getLocale ($ store ),
27
- PathType::LocaleHyphen => implode ('- ' , explode ('_ ' , $ this ->config ->getLocale ($ store ))),
28
- PathType::Custom => $ this ->config ->getCustomPathMapper ()[(int )$ store ->getId ()] ?? $ store ->getCode (),
25
+ PathType::StoreCode => $ scope ->getCode (),
26
+ PathType::CountryCode => $ this ->config ->getCountry ($ scope ),
27
+ PathType::LocaleUnderscore => $ this ->config ->getLocale ($ scope ),
28
+ PathType::LocaleHyphen => implode ('- ' , explode ('_ ' , $ this ->config ->getLocale ($ scope ))),
29
+ PathType::Custom => $ this ->config ->getCustomPathMapper ()[(int )$ scope ->getId ()] ?? $ scope ->getCode (),
29
30
});
30
31
}
31
32
}
0 commit comments