AuthenticationPluginManager.php in RESTful 7.2
File
src/Plugin/AuthenticationPluginManager.php
View source
<?php
namespace Drupal\restful\Plugin;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Plugin\Factory\ContainerFactory;
use Drupal\Core\Plugin\Discovery\YamlDiscovery;
use Drupal\plug\Util\Module;
class AuthenticationPluginManager extends DefaultPluginManager {
use SemiSingletonTrait;
protected $defaults = array(
'label' => '',
'description' => '',
'settings' => array(),
'id' => '',
);
public function __construct(\Traversable $namespaces, \DrupalCacheInterface $cache_backend) {
parent::__construct('Plugin/authentication', $namespaces, 'Drupal\\restful\\Plugin\\authentication\\AuthenticationInterface', '\\Drupal\\restful\\Annotation\\Authentication');
$this
->setCacheBackend($cache_backend, 'authentication_plugins');
$this
->alterInfo('authentication_plugin');
}
public static function create($bin = 'cache', $avoid_singleton = FALSE) {
$factory = function ($bin) {
return new static(Module::getNamespaces(), _cache_get_object($bin));
};
if ($avoid_singleton) {
$factory($bin);
}
return static::semiSingletonInstance($factory, array(
$bin,
));
}
}