You are here

protected static function SettingsFactory::getInstance in Menu Bean 7

Parameters

$key:

$class:

$interface:

Return value

SettingsFilterInterface|SettingInterface

Throws

MenuBeanException

1 call to SettingsFactory::getInstance()
SettingsFactory::getSettingInstance in lib/Drupal/menu_bean/SettingsFactory.php
Get the Settings Form Class

File

lib/Drupal/menu_bean/SettingsFactory.php, line 38
Settings Plugin Factor

Class

SettingsFactory
Class SettingsFactor @singleton

Namespace

Drupal\menu_bean

Code

protected static function getInstance($key, $class, $interface) {
  static $instances = array();
  if (!isset($instances[$key])) {
    $ref_class = new \ReflectionClass($class);
    if (in_array($interface, $ref_class
      ->getInterfaceNames())) {
      throw new MenuBeanException("{$interface} does not match " . $class);
    }
    $instances[$key] = new $class();
  }
  return $instances[$key];
}