X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2FHelper%2FLogger.php;h=0194765ac3d5c11f6553ba165288366b97862709;hb=20a65226a4dad0def0ed1b34ac37c0a539fb2495;hp=cb0ab104fc5125a063b2e4a708aa60e6f744f5be;hpb=233eeff65a76b725619a681086079043247e7799;p=plcapi.git diff --git a/src/Helper/Logger.php b/src/Helper/Logger.php index cb0ab10..0194765 100644 --- a/src/Helper/Logger.php +++ b/src/Helper/Logger.php @@ -11,6 +11,22 @@ namespace PhpXmlRpc\Helper; class Logger { + protected static $instance = null; + + /** + * This class is singleton, so that later we can move to DI patterns. + * + * @return Charset + */ + public static function instance() + { + if (self::$instance === null) { + self::$instance = new self(); + } + + return self::$instance; + } + /** * Echoes a debug message, taking care of escaping it when not in console mode. * NB: if the encoding of the message is not known or wrong, and we are working in web mode, there is no guarantee @@ -19,7 +35,7 @@ class Logger * @param string $message * @param string $encoding */ - public static function debugMessage($message, $encoding=null) + public function debugMessage($message, $encoding=null) { if (PHP_SAPI != 'cli') { $flags = ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE;