You are here

interface PluginCollectionInterface in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x src/PluginCollectionInterface.php \Drupal\xbbcode\PluginCollectionInterface

Common methods to access a plugin collection.

This abstraction has the simple purpose of allowing functions to take both an associative array of plugins and a full plugin collection instance.

Hierarchy

Expanded class hierarchy of PluginCollectionInterface

All classes that implement PluginCollectionInterface

File

src/PluginCollectionInterface.php, line 15

Namespace

Drupal\xbbcode
View source
interface PluginCollectionInterface extends ArrayAccess, Countable, IteratorAggregate {

  /**
   * Determines if a plugin instance exists.
   *
   * @param string $instance_id
   *   The ID of the plugin instance to check.
   *
   * @return bool
   *   TRUE if the plugin instance exists, FALSE otherwise.
   */
  public function has($instance_id) : bool;

  /**
   * Gets a plugin instance, initializing it if necessary.
   *
   * @param string $instance_id
   *   The ID of the plugin instance being retrieved.
   */
  public function &get($instance_id);

  /**
   * Stores an initialized plugin.
   *
   * @param string $instance_id
   *   The ID of the plugin instance being stored.
   * @param mixed $value
   *   An instantiated plugin.
   */
  public function set($instance_id, $value);

  /**
   * Removes an initialized plugin.
   *
   * The plugin can still be used; it will be reinitialized.
   *
   * @param string $instance_id
   *   The ID of the plugin instance to remove.
   */
  public function remove($instance_id);

}

Members

Namesort descending Modifiers Type Description Overrides
PluginCollectionInterface::get public function Gets a plugin instance, initializing it if necessary.
PluginCollectionInterface::has public function Determines if a plugin instance exists.
PluginCollectionInterface::remove public function Removes an initialized plugin.
PluginCollectionInterface::set public function Stores an initialized plugin.