composer package updates
[openemr.git] / vendor / zendframework / zend-i18n / src / Translator / TranslatorServiceFactory.php
bloba17ac32c6414a64696646d535e7083828d67c70e
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\I18n\Translator;
12 use Interop\Container\ContainerInterface;
13 use Zend\ServiceManager\FactoryInterface;
14 use Zend\ServiceManager\ServiceLocatorInterface;
16 /**
17 * Translator.
19 class TranslatorServiceFactory implements FactoryInterface
21 /**
22 * Create a Translator instance.
24 * @param ContainerInterface $container
25 * @param string $requestedName
26 * @param null|array $options
27 * @return Translator
29 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
31 // Configure the translator
32 $config = $container->get('config');
33 $trConfig = isset($config['translator']) ? $config['translator'] : [];
34 $translator = Translator::factory($trConfig);
35 if ($container->has('TranslatorPluginManager')) {
36 $translator->setPluginManager($container->get('TranslatorPluginManager'));
38 return $translator;
41 /**
42 * zend-servicemanager v2 factory for creating Translator instance.
44 * Proxies to `__invoke()`.
46 * @param ServiceLocatorInterface $serviceLocator
47 * @return Translator
49 public function createService(ServiceLocatorInterface $serviceLocator)
51 return $this($serviceLocator, Translator::class);