You are here

protected static function SemiSingletonTrait::semiSingletonInstance in RESTful 7.2

Gets the singleton based on the factory callable.

Parameters

callable $factory: The factory that creates the actual object.

array $params: The parameters to be passed to the factory.

Return value

mixed The singleton object.

1 call to SemiSingletonTrait::semiSingletonInstance()
AuthenticationPluginManager::create in src/Plugin/AuthenticationPluginManager.php
AuthenticationPluginManager factory method.

File

src/Plugin/SemiSingletonTrait.php, line 35
Contains \Drupal\restful\Plugin\SemiSingletonTrait.

Class

SemiSingletonTrait
Class SemiSingletonTrait.

Namespace

Drupal\restful\Plugin

Code

protected static function semiSingletonInstance(callable $factory, array $params = array()) {
  if (!static::$singleton) {
    static::$singleton = call_user_func_array($factory, $params);
  }
  return static::$singleton;
}