public appliesToContext ( Phpro\SoapClient\CodeGenerator\Context\ContextInterface $context ) : boolean | ||
$context | Phpro\SoapClient\CodeGenerator\Context\ContextInterface | |
Résultat | boolean |
public function appliesToContext(ContextInterface $context)
{
if (!$context instanceof TypeContext && !$context instanceof PropertyContext) {
return false;
}
$type = $context->getType();
$typeExists = array_key_exists($type->getName(), $this->typeMap);
// The default rule will be used here:
if (!$typeExists) {
return $this->defaultRule->appliesToContext($context);
}
// It's possible to define a null rule, which means that no code will be generated.
$rule = $this->typeMap[$type->getName()];
if ($rule === null) {
return false;
}
return $rule->appliesToContext($context);
}