Further modules included.
[yaffs-website] / web / modules / contrib / libraries / src / Plugin / MissingPluginConfigurationException.php
1 <?php
2
3 namespace Drupal\libraries\Plugin;
4
5 use Drupal\Component\Plugin\Exception\PluginException;
6
7 /**
8  * Provides an exception class for missing plugin configuration.
9  *
10  * The plugin system allows passing arbitrary data to plugins in form of the
11  * $configuration array. Some plugins, however, may depend on certain keys to
12  * be present in $configuration. This exception class can be used if such keys
13  * are missing.
14  *
15  * @todo Provide accessors for the passed-in information.
16  */
17 class MissingPluginConfigurationException extends PluginException {
18
19   /**
20    * Constructs an exception for a missing plugin configuration value.
21    *
22    * @param string $plugin_id
23    *   The plugin ID.
24    * @param $plugin_definition
25    *   The plugin definition
26    * @param array $configuration
27    *   The plugin configuration.
28    * @param $missing_key
29    *   The missing key in the configuration.
30    * @param string $message
31    *   (optional) The exception message.
32    * @param int $code
33    *   (optional) The error code.
34    * @param \Exception $previous
35    *   (optional) The previous exception.
36    */
37   public function __construct(
38     $plugin_id,
39     $plugin_definition,
40     array $configuration,
41     $missing_key,
42     $message = '',
43     $code = 0,
44     \Exception $previous = NULL
45   ) {
46     $message = $message ?: "The '{$missing_key}' key is missing in the configuration of the '{$plugin_id}' plugin.";
47     parent::__construct($message, $code, $previous);
48   }
49
50 }