Use a factory to Config and LocaleManager (see #298)
This commit is contained in:
parent
96a75cbf14
commit
280618bb6b
9 changed files with 145 additions and 87 deletions
26
classes/LocaleManagerFactory.php
Normal file
26
classes/LocaleManagerFactory.php
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue