/** * Returns the stub ICU data * * @param string $locale The locale code * @param string $cacheVariable The name of a static attribute to cache the data to * @param string $stubDataDir The stub data directory name * * @return array * * @throws \InvalidArgumentException When the locale is different than 'en' */ private static function getStubData($locale, $cacheVariable, $stubDataDir) { $dataDirectory = Locale::getIcuDataDirectory(); if ('en' !== $locale) { throw new \InvalidArgumentException(sprintf('Only the \'en\' locale is supported. %s', NotImplementedException::INTL_INSTALL_MESSAGE)); } if (empty(self::${$cacheVariable})) { self::${$cacheVariable} = (include $dataDirectory . '/stub/' . $stubDataDir . '/en.php'); } return self::${$cacheVariable}; }