2 declare(strict_types = 1);
81 if (!is_array(
$map)) {
82 throw new \InvalidArgumentException(
'map must be array', 1537277143);
85 throw new \InvalidArgumentException(
'localeMap must be array', 1537277144);
89 $this->map = array_map(
'strval',
$map);
96 public function count():
int
104 public function generate(
string $value): ?
string
107 $index = array_search($value,
$map,
true);
108 return $index !==
false ? (string)$index :
null;
114 public function resolve(
string $value): ?
string
117 return isset(
$map[$value]) ? (string)
$map[$value] :
null;
127 $locale = $this->siteLanguage->getLocale();
128 foreach ($this->localeMap as $item) {
129 $pattern =
'#^' . $item[
'locale'] .
'#i';
130 if (preg_match($pattern, $locale)) {
131 return array_map(
'strval', $item[
'map']);