alltube/classes/Factory/LocaleManagerFactory.php
2020-12-17 22:49:21 +01:00

29 lines
620 B
PHP

<?php
namespace Alltube\Factory;
use Alltube\Exception\DependencyException;
use Alltube\LocaleManager;
use Slim\Container;
/**
* Class LocaleManagerFactory
* @package Alltube
*/
class LocaleManagerFactory
{
/**
* @param Container $container
* @return LocaleManager
* @throws DependencyException
*/
public static function create(Container $container): LocaleManager
{
if (!class_exists('Locale')) {
throw new DependencyException('You need to install the intl extension for PHP.');
}
return new LocaleManager($container->get('session'));
}
}