Files
kiri-core/Kafka/SingletonTrait.php
T

77 lines
1.9 KiB
PHP
Raw Normal View History

2020-10-09 10:58:37 +08:00
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
// +---------------------------------------------------------------------------
// | SWAN [ $_SWANBR_SLOGAN_$ ]
// +---------------------------------------------------------------------------
// | Copyright $_SWANBR_COPYRIGHT_$
// +---------------------------------------------------------------------------
// | Version $_SWANBR_VERSION_$
// +---------------------------------------------------------------------------
// | Licensed ( $_SWANBR_LICENSED_URL_$ )
// +---------------------------------------------------------------------------
// | $_SWANBR_WEB_DOMAIN_$
// +---------------------------------------------------------------------------
namespace Kafka;
/**
+------------------------------------------------------------------------------
* Kafka Singleton
+------------------------------------------------------------------------------
*
* @package
* @version $_SWANBR_VERSION_$
* @copyright Copyleft
* @author $_SWANBR_AUTHOR_$
+------------------------------------------------------------------------------
*/
trait SingletonTrait
{
use \Psr\Log\LoggerAwareTrait;
use \Kafka\LoggerTrait;
// {{{ consts
// }}}
// {{{ members
protected static $instance = null;
// }}}
// {{{ functions
// {{{ public function static getInstance()
/**
* set send messages
*
* @access public
* @param $hostList
* @param null $timeout
* @return static
*/
public static function getInstance()
{
if (is_null(self::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
// }}}
// {{{ private function __construct()
/**
* __construct
*
* @access public
* @param $hostList
* @param null $timeout
*/
private function __construct()
{
}
// }}}
// }}}
}