This method aims to get the parent element that matches a valid Wsdl element (aka struct)
public getSuitableParent ( boolean $checkName = true, array $additionalTags = [], integer $maxDeep = self::MAX_DEEP, boolean $strict = false ) : null | |
||
$checkName | boolean | whether to validate the attribute named "name" or not |
$additionalTags | array | |
$maxDeep | integer | |
$strict | boolean | used by overridden methods to avoid infinite loop |
return | null | |
/** * @param Tag $tag */ public function parseTag(Tag $tag) { $parent = $tag->getSuitableParent(); if ($parent instanceof Tag) { $model = $this->getModel($parent); if ($model instanceof Struct) { if ($tag->hasAttributeName() && ($modelAttribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) { return $this->parseTagAttributes($tag, $model, $modelAttribute); } $this->parseTagAttributes($tag, $model); } } $this->parseTagAttributes($tag); }
/** * Finds parent node of this documentation node without taking care of the name attribute for enumeration. * This case is managed first because enumerations are contained by elements and * the method could climb to its parent without stopping on the enumeration tag. * Indeed, depending on the node, it may contain or not the attribute named "name" so we have to split each case. * @see \WsdlToPhp\PackageGenerator\DomHandler\Wsdl\Tag\AbstractTag::getSuitableParent() */ public function getSuitableParent($checkName = true, array $additionalTags = array(), $maxDeep = self::MAX_DEEP, $strict = false) { if ($strict === false) { $enumerationTag = $this->getStrictParent(WsdlDocument::TAG_ENUMERATION); if ($enumerationTag instanceof TagEnumeration) { return $enumerationTag; } } /** * Reset current tag as using getStrictParent method set currentTag to enumeration * as soon as currentTag has been set, if a valid DOMElement is found * then without taking care of the actual DOMElement tag name, * a TagEnumeration is always returned. * Moreover, we reset current tag only if we're not in the case of the call * for the current $this->getStrictParent(WsdlDocument::TAG_ENUMERATION); call. * @todo If it's possible, find a cleaner way to solve this 'issue' */ if ($strict === false) { $this->getDomDocumentHandler()->setCurrentTag(''); } return parent::getSuitableParent($checkName, $additionalTags, $maxDeep, $strict); }