alltube/classes/Factory/LocaleManagerFactory.php
2021-10-18 13:16:28 +02:00

30 lines
637 B
PHP

<?php
namespace Alltube\Factory;
use Alltube\Exception\DependencyException;
use Alltube\LocaleManager;
use Locale;
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::class)) {
throw new DependencyException('You need to install the intl extension for PHP.');
}
return new LocaleManager($container->get('session'));
}
}