Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
CRAP | |
57.14% |
4 / 7 |
| StaticDiscovery | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
5.26 | |
57.14% |
4 / 7 |
| getDefinitions | |
0.00% |
0 / 1 |
2.15 | |
66.67% |
2 / 3 |
|||
| setDefinition | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| deleteDefinition | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Component\Plugin\Discovery\StaticDiscovery. | |
| */ | |
| namespace Drupal\Component\Plugin\Discovery; | |
| /** | |
| * A discovery mechanism that allows plugin definitions to be manually | |
| * registered rather than actively discovered. | |
| */ | |
| class StaticDiscovery implements DiscoveryInterface { | |
| use DiscoveryCachedTrait; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getDefinitions() { | |
| if (!$this->definitions) { | |
| $this->definitions = array(); | |
| } | |
| return $this->definitions; | |
| } | |
| /** | |
| * Sets a plugin definition. | |
| */ | |
| public function setDefinition($plugin, $definition) { | |
| $this->definitions[$plugin] = $definition; | |
| } | |
| /** | |
| * Deletes a plugin definition. | |
| */ | |
| public function deleteDefinition($plugin) { | |
| unset($this->definitions[$plugin]); | |
| } | |
| } |