Use a factory to Config and LocaleManager (see #298)

This commit is contained in:
Pierre Rudloff 2020-07-15 23:05:41 +02:00
parent 96a75cbf14
commit 280618bb6b
9 changed files with 145 additions and 87 deletions

View file

@ -0,0 +1,26 @@
<?php
namespace Alltube;
use Alltube\Exception\DependencyException;
/**
* Class LocaleManagerFactory
* @package Alltube
*/
class LocaleManagerFactory
{
/**
* @return LocaleManager|null
* @throws DependencyException
*/
public static function create()
{
if (!class_exists('Locale')) {
throw new DependencyException('You need to install the intl extension for PHP.');
}
return LocaleManager::getInstance();
}
}