protected function CountryRepository::loadDefinitions in Address 8
File
- src/
Repository/ CountryRepository.php, line 43
Class
- CountryRepository
- Defines the country repository.
Namespace
Drupal\address\RepositoryCode
protected function loadDefinitions($locale) {
if (isset($this->definitions[$locale])) {
return $this->definitions[$locale];
}
$cache_key = 'address.countries.' . $locale;
if ($cached = $this->cache
->get($cache_key)) {
$this->definitions[$locale] = $cached->data;
}
else {
$filename = $this->definitionPath . $locale . '.json';
$this->definitions[$locale] = json_decode(file_get_contents($filename), TRUE);
$this->cache
->set($cache_key, $this->definitions[$locale], CacheBackendInterface::CACHE_PERMANENT, [
'countries',
]);
}
return $this->definitions[$locale];
}