Newer
Older
Dries Buytaert
committed
<?php
namespace Drupal\Component\Plugin\Context;
/**
* A generic context interface for wrapping data a plugin needs to operate.
*/
interface ContextInterface {
/**
* Gets the context value.
*
* @return mixed
Angie Byron
committed
* The currently set context value, or NULL if it is not set.
Dries Buytaert
committed
*/
public function getContextValue();
/**
* Returns whether the context has a value.
*
* @return bool
* TRUE if the context has a value, FALSE otherwise.
*/
public function hasContextValue();
Dries Buytaert
committed
/**
* Gets the provided definition that the context must conform to.
*
Angie Byron
committed
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
Dries Buytaert
committed
* The defining characteristic representation of the context.
*/
public function getContextDefinition();
/**
Angie Byron
committed
* Gets a list of validation constraints.
Dries Buytaert
committed
*
Angie Byron
committed
* @return array
* Array of constraints, each being an instance of
* \Symfony\Component\Validator\Constraint.
*/
public function getConstraints();
/**
* Validates the set context value.
Dries Buytaert
committed
*
Angie Byron
committed
* @return \Symfony\Component\Validator\ConstraintViolationListInterface
* A list of constraint violations. If the list is empty, validation
* succeeded.
Dries Buytaert
committed
*/
Angie Byron
committed
public function validate();