trait Singleton in Anti Spam by CleanTalk 9.1.x
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/Common/Templates/Singleton.php \Cleantalk\Common\Templates\Singleton
Trait Singleton
@package CleanTalk @Version 1.1.0 @author Cleantalk team (welcome@cleantalk.org) @copyright (C) 2014 CleanTalk team (http://cleantalk.org) @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
Hierarchy
- trait \Cleantalk\Common\Templates\Singleton
1 file declares its use of Singleton
- SuperGlobalVariables.php in src/
lib/ Cleantalk/ Common/ Variables/ SuperGlobalVariables.php
File
- src/
lib/ Cleantalk/ Common/ Templates/ Singleton.php, line 15
Namespace
Cleantalk\Common\TemplatesView source
trait Singleton {
public static $instance;
public function __construct() {
}
public function __wakeup() {
}
public function __clone() {
}
/**
* Constructor
* @return $this
*/
public static function getInstance() {
$args = func_get_args();
if (!isset(static::$instance) || !$args) {
static::$instance = new static();
if (!empty($args)) {
static::$instance
->init($args);
}
else {
static::$instance
->init();
}
}
return static::$instance;
}
/**
* Alternative constructor
*
* @param null $args
*/
protected function init($args = null) {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Singleton:: |
public static | property | 5 | |
Singleton:: |
public static | function | Constructor | |
Singleton:: |
protected | function | Alternative constructor | |
Singleton:: |
public | function | ||
Singleton:: |
public | function | ||
Singleton:: |
public | function |