alltube/classes/Factory/LocaleManagerFactory.php

30 lines
620 B
PHP
Raw Normal View History

<?php
2020-10-20 21:29:50 +00:00
namespace Alltube\Factory;
use Alltube\Exception\DependencyException;
2020-10-20 21:29:50 +00:00
use Alltube\LocaleManager;
use Slim\Container;
/**
* Class LocaleManagerFactory
* @package Alltube
*/
class LocaleManagerFactory
{
/**
* @param Container $container
2020-12-17 21:43:05 +00:00
* @return LocaleManager
* @throws DependencyException
*/
2020-12-17 21:43:05 +00:00
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'));
}
}