You are here

public static function Singleton::getInstance in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/Common/Templates/Singleton.php \Cleantalk\Common\Templates\Singleton::getInstance()

Constructor

Return value

$this

File

src/lib/Cleantalk/Common/Templates/Singleton.php, line 27

Class

Singleton
Trait Singleton

Namespace

Cleantalk\Common\Templates

Code

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;
}