Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Component / Plugin / Context / ContextInterface.php
1 <?php
2
3 namespace Drupal\Component\Plugin\Context;
4
5 /**
6  * Provides data and definitions for plugins during runtime and administration.
7  *
8  * Plugin contexts are satisfied by ContextInterface implementing objects.
9  * These objects always contain a definition of what data they will provide
10  * during runtime. During run time, ContextInterface implementing objects must
11  * also provide the corresponding data value.
12  *
13  * @see \Drupal\Component\Plugin\Context\ContextDefinitionInterface
14  */
15 interface ContextInterface {
16
17   /**
18    * Gets the context value.
19    *
20    * @return mixed
21    *   The currently set context value, or NULL if it is not set.
22    */
23   public function getContextValue();
24
25   /**
26    * Returns whether the context has a value.
27    *
28    * @return bool
29    *   TRUE if the context has a value, FALSE otherwise.
30    */
31   public function hasContextValue();
32
33   /**
34    * Gets the provided definition that the context must conform to.
35    *
36    * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
37    *   The defining characteristic representation of the context.
38    */
39   public function getContextDefinition();
40
41   /**
42    * Gets a list of validation constraints.
43    *
44    * @return array
45    *   Array of constraints, each being an instance of
46    *   \Symfony\Component\Validator\Constraint.
47    */
48   public function getConstraints();
49
50   /**
51    * Validates the set context value.
52    *
53    * @return \Symfony\Component\Validator\ConstraintViolationListInterface
54    *   A list of constraint violations. If the list is empty, validation
55    *   succeeded.
56    */
57   public function validate();
58
59 }