Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Core / Plugin / CachedDiscoveryClearer.php
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 }