public function apply(ContextInterface $context) { $type = $context->getType(); $typeName = $type->getName(); $rule = array_key_exists($typeName, $this->typeMap) ? $this->typeMap[$typeName] : $this->defaultRule; $rule->apply($context); }