Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Component / Plugin / Discovery / StaticDiscovery.php
1 <?php
2
3 namespace Drupal\Component\Plugin\Discovery;
4
5 /**
6  * A discovery mechanism that allows plugin definitions to be manually
7  * registered rather than actively discovered.
8  */
9 class StaticDiscovery implements DiscoveryInterface {
10
11   use DiscoveryCachedTrait;
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getDefinitions() {
17     if (!$this->definitions) {
18       $this->definitions = [];
19     }
20     return $this->definitions;
21   }
22
23   /**
24    * Sets a plugin definition.
25    */
26   public function setDefinition($plugin, $definition) {
27     $this->definitions[$plugin] = $definition;
28   }
29
30   /**
31    * Deletes a plugin definition.
32    */
33   public function deleteDefinition($plugin) {
34     unset($this->definitions[$plugin]);
35   }
36
37 }