protected function loadData($locale, $source, $format)
{
if (!isset($this->dataCache[$locale][$source][$format])) {
if (!in_array($source, $this->dataSources)) {
throw new \InvalidArgumentException(sprintf('Unknown data source "%s". The available ones are: "%s"', $source, implode('", "', $this->dataSources)));
}
$file = sprintf('%s/%s/%s/country.' . $format, $this->dataDir, $source, $locale);
if (!is_file($file)) {
throw new \RuntimeException(sprintf('Unable to load the country data file "%s"', $file));
}
$this->dataCache[$locale][$source][$format] = $format == 'php' ? require $file : file_get_contents($file);
}
return $this->sortData($locale, $this->dataCache[$locale][$source][$format]);
}