diff --git a/core/lib/Drupal/Core/Archiver/ArchiverManager.php b/core/lib/Drupal/Core/Archiver/ArchiverManager.php index 11ec29b..0007d3a 100644 --- a/core/lib/Drupal/Core/Archiver/ArchiverManager.php +++ b/core/lib/Drupal/Core/Archiver/ArchiverManager.php @@ -33,7 +33,7 @@ class ArchiverManager extends DefaultPluginManager { public function __construct(\Traversable $namespaces, CacheBackendInterface $cache, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { parent::__construct('Archiver', $namespaces); $this->alterInfo($module_handler, 'archiver_info'); - $this->setCache($cache, $language_manager, 'archiver_info'); + $this->setCacheBackend($cache, $language_manager, 'archiver_info'); } /** diff --git a/core/lib/Drupal/Core/Condition/ConditionManager.php b/core/lib/Drupal/Core/Condition/ConditionManager.php index ead3a9c..507e3a1 100644 --- a/core/lib/Drupal/Core/Condition/ConditionManager.php +++ b/core/lib/Drupal/Core/Condition/ConditionManager.php @@ -35,7 +35,7 @@ class ConditionManager extends DefaultPluginManager implements ExecutableManager public function __construct(\Traversable $namespaces, CacheBackendInterface $cache, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { parent::__construct('Condition', $namespaces); $this->alterInfo($module_handler, 'condition_info'); - $this->setCache($cache, $language_manager, 'condition'); + $this->setCacheBackend($cache, $language_manager, 'condition'); } /** diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 8173c68..c5ddf8e 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -11,13 +11,13 @@ use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\PluginManagerInterface; -use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Language\Language; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; +use Drupal\Core\Plugin\Factory\ContainerFactory; /** * Base class for plugin managers. @@ -36,7 +36,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt * * @var \Drupal\Core\Cache\CacheBackendInterface $cache */ - protected $cache; + protected $cacheBackend; /** * Provided cache key prefix. @@ -99,7 +99,7 @@ public function __construct($subdir, \Traversable $namespaces, $annotation_names $this->subdir = $subdir; $this->discovery = new AnnotatedClassDiscovery($subdir, $namespaces, $annotation_namespaces, $plugin_definition_annotation_name); $this->discovery = new DerivativeDiscoveryDecorator($this->discovery); - $this->factory = new DefaultFactory($this); + $this->factory = new ContainerFactory($this); } /** @@ -116,9 +116,9 @@ public function __construct($subdir, \Traversable $namespaces, $annotation_names * Cache key prefix to use, the language code will be appended * automatically. */ - public function setCache(CacheBackendInterface $cache, LanguageManager $language_manager, $cache_key_prefix) { + public function setCacheBackend(CacheBackendInterface $cache, LanguageManager $language_manager, $cache_key_prefix) { $this->languageManager = $language_manager; - $this->cache = $cache; + $this->cacheBackend = $cache; $this->cacheKeyPrefix = $cache_key_prefix; $this->cacheKey = $cache_key_prefix . ':' . $language_manager->getLanguage(Language::TYPE_INTERFACE)->langcode; } @@ -167,13 +167,13 @@ public function getDefinitions() { * {@inheritdoc} */ public function clearCachedDefinitions() { - if ($this->cache) { + if ($this->cacheBackend) { $cache_keys = array(); // @todo: Use $this->languageManager->languageList() after http://drupal.org/node/1862202 is in. foreach (language_list() as $langcode => $language) { $cache_keys[] = $this->cacheKeyPrefix . ':' .$langcode; } - $this->cache->deleteMultiple($cache_keys); + $this->cacheBackend->deleteMultiple($cache_keys); } $this->definitions = NULL; } @@ -188,7 +188,7 @@ public function clearCachedDefinitions() { * and would actually be returned by the getDefinitions() method. */ protected function getCachedDefinitions() { - if (!isset($this->definitions) && $this->cache && $cache = $this->cache->get($this->cacheKey)) { + if (!isset($this->definitions) && $this->cacheBackend && $cache = $this->cacheBackend->get($this->cacheKey)) { $this->definitions = $cache->data; } return $this->definitions; @@ -201,8 +201,8 @@ protected function getCachedDefinitions() { * List of definitions to store in cache. */ protected function setCachedDefinitions($definitions) { - if ($this->cache) { - $this->cache->set($this->cacheKey, $definitions); + if ($this->cacheBackend) { + $this->cacheBackend->set($this->cacheKey, $definitions); } $this->definitions = $definitions; } diff --git a/core/lib/Drupal/Core/Validation/ConstraintManager.php b/core/lib/Drupal/Core/Validation/ConstraintManager.php index c33c5ce..51f5c33 100644 --- a/core/lib/Drupal/Core/Validation/ConstraintManager.php +++ b/core/lib/Drupal/Core/Validation/ConstraintManager.php @@ -50,7 +50,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac parent::__construct('Validation/Constraint', $namespaces); $this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions')); $this->alterInfo($module_handler, 'validation_constraint'); - $this->setCache($cache, $language_manager, 'validation_constraint'); + $this->setCacheBackend($cache, $language_manager, 'validation_constraint'); } /** diff --git a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php index 4932daf..85763dd 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php +++ b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php @@ -35,6 +35,6 @@ class BlockManager extends DefaultPluginManager { public function __construct(\Traversable $namespaces, CacheBackendInterface $cache, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { parent::__construct('Block', $namespaces); $this->alterInfo($module_handler, 'block'); - $this->setCache($cache, $language_manager, 'block_plugins'); + $this->setCacheBackend($cache, $language_manager, 'block_plugins'); } } diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php index 47872f9..4e859e6 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php +++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php @@ -27,7 +27,7 @@ class ImageToolkitManager extends DefaultPluginManager { */ public function __construct(\Traversable $namespaces, CacheBackendInterface $cache, LanguageManager $language_manager) { parent::__construct('ImageToolkit', $namespaces); - $this->setCache($cache, $language_manager, 'image_toolkit'); + $this->setCacheBackend($cache, $language_manager, 'image_toolkit'); } /** diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index 07de26b..67ee7d5 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -120,7 +120,7 @@ public function testDefaultPluginManagerWithEmptyCache() { ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); - $plugin_manager->setCache($cache_backend, $language_manager, $cid); + $plugin_manager->setCacheBackend($cache_backend, $language_manager, $cid); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); @@ -151,7 +151,7 @@ public function testDefaultPluginManagerWithFilledCache() { ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); - $plugin_manager->setCache($cache_backend, $language_manager, $cid); + $plugin_manager->setCacheBackend($cache_backend, $language_manager, $cid); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); } diff --git a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php index b7fe091..e88008e 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php +++ b/core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php @@ -17,7 +17,7 @@ class TestPluginManager extends DefaultPluginManager { /** - * Constructs aa ConditionManager object. + * Constructs a TestPluginManager object. * * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths