comparison core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Plugin;
4
5 use Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface;
6
7 /**
8 * Defines a class which is capable of clearing the cache on plugin managers.
9 */
10 class CachedDiscoveryClearer implements CachedDiscoveryClearerInterface {
11
12 /**
13 * The stored discoveries.
14 *
15 * @var \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface[]
16 */
17 protected $cachedDiscoveries = [];
18
19 /**
20 * {@inheritdoc}
21 */
22 public function addCachedDiscovery(CachedDiscoveryInterface $cached_discovery) {
23 $this->cachedDiscoveries[] = $cached_discovery;
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function clearCachedDefinitions() {
30 foreach ($this->cachedDiscoveries as $cached_discovery) {
31 $cached_discovery->clearCachedDefinitions();
32 }
33 }
34
35 }