Stop using a singleton for LocaleManager (#298)

This commit is contained in:
Pierre Rudloff 2020-10-17 22:36:03 +02:00
parent f5045b3ae7
commit 15636aa435
7 changed files with 9 additions and 46 deletions

View file

@ -50,17 +50,10 @@ class LocaleManager
*/
private $translator;
/**
* Singleton instance.
*
* @var LocaleManager|null
*/
private static $instance;
/**
* LocaleManager constructor.
*/
private function __construct()
public function __construct()
{
$session = SessionManager::getSession();
$this->sessionSegment = $session->getSegment(self::class);
@ -171,29 +164,4 @@ class LocaleManager
return '';
}
/**
* Get LocaleManager singleton instance.
*
* @return LocaleManager
* @todo Stop using a singleton.
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Destroy singleton instance.
*
* @return void
*/
public static function destroyInstance()
{
self::$instance = null;
}
}