コード例 #1
0
 public function setUp()
 {
     $config = new DetectorConfig();
     $config->setDomains(array('test.:locale'));
     $config->setSupported(array('en_US'));
     $config->setAliases(array('nl' => 'nl_NL'));
     $config->setDefault('nl_NL');
     $this->config = $config;
 }
コード例 #2
0
 /**
  * @param  ServiceLocatorInterface $serviceLocator
  * @return Detector
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     $config = $config['mq_locale'];
     $detectorConfig = new DetectorConfig();
     if (array_key_exists('default', $config)) {
         $detectorConfig->setDefault($config['default']);
     }
     if (array_key_exists('supported', $config)) {
         $detectorConfig->setSupported($config['supported']);
     }
     if (array_key_exists('domains', $config)) {
         $detectorConfig->setDomains($config['domains']);
     }
     if (array_key_exists('aliases', $config)) {
         $detectorConfig->setAliases($config['aliases']);
     }
     if (array_key_exists('strategy', $config)) {
         $detectorConfig->setStrategy($config['strategy']);
     }
     return new Detector($detectorConfig);
 }