Chris@13: Chris@13: */ Chris@13: abstract class AbstractContextAwareMatcher extends AbstractMatcher implements ContextAware Chris@13: { Chris@13: /** Chris@13: * Context instance (for ContextAware interface). Chris@13: * Chris@13: * @var Context Chris@13: */ Chris@13: protected $context; Chris@13: Chris@13: /** Chris@13: * ContextAware interface. Chris@13: * Chris@13: * @param Context $context Chris@13: */ Chris@13: public function setContext(Context $context) Chris@13: { Chris@13: $this->context = $context; Chris@13: } Chris@13: Chris@13: /** Chris@13: * Get a Context variable by name. Chris@13: * Chris@13: * @param string $var Variable name Chris@13: * Chris@13: * @return mixed Chris@13: */ Chris@13: protected function getVariable($var) Chris@13: { Chris@13: return $this->context->get($var); Chris@13: } Chris@13: Chris@13: /** Chris@13: * Get all variables in the current Context. Chris@13: * Chris@13: * @return array Chris@13: */ Chris@13: protected function getVariables() Chris@13: { Chris@13: return $this->context->getAll(); Chris@13: } Chris@13: }