/** * Sets the value of a context. * * @param string $name * The name. * @param mixed $value * The context value. * * @throws \LogicException * Thrown if the passed context is not defined. * * @return $this */ public function setContextValue($name, $value) { if (!isset($this->contextDefinitions[$name])) { throw new \LogicException("The specified context '{$name}' is not defined."); } $this->state->setVariable($name, $this->contextDefinitions[$name], $value); return $this; }