From 03fc8a1bce033cc8334f588f3c95baffa1291b54 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 24 May 2015 16:30:40 -0400 Subject: Avoid creating multiple instances of Translator --- app/Core/Translator.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'app/Core') diff --git a/app/Core/Translator.php b/app/Core/Translator.php index 0f5a77cc..e3d19692 100644 --- a/app/Core/Translator.php +++ b/app/Core/Translator.php @@ -26,6 +26,31 @@ class Translator */ private static $locales = array(); + /** + * Instance + * + * @static + * @access private + * @var Translator + */ + private static $instance = null; + + /** + * Get instance + * + * @static + * @access public + * @return Translator + */ + public static function getInstance() + { + if (self::$instance === null) { + self::$instance = new self; + } + + return self::$instance; + } + /** * Get a translation * -- cgit v1.2.3