/** * @param AttributeHandler $tagAttribute * @param AbstractModel $model * @param StructAttribute $structAttribute */ protected function parseTagAttributeType(AttributeHandler $tagAttribute, AbstractModel $model, StructAttribute $structAttribute = null) { if ($structAttribute instanceof StructAttribute) { $type = $tagAttribute->getValue(); if ($type !== null) { $typeModel = $this->generator->getStruct($type); $modelAttributeType = $structAttribute->getType(); if ($typeModel instanceof Struct && (empty($modelAttributeType) || strtolower($modelAttributeType) === 'unknown')) { if ($typeModel->getIsRestriction()) { $structAttribute->setType($typeModel->getName()); } elseif (!$typeModel->getIsStruct() && $typeModel->getInheritance()) { $structAttribute->setType($typeModel->getInheritance()); } } } } else { $model->addMeta($tagAttribute->getName(), $tagAttribute->getValue(true)); } }
/** * @param StructAttributeModel $attribute * @param string $returnArrayType * @return bool */ protected function useBrackets(StructAttributeModel $attribute, $returnArrayType = true) { return $returnArrayType && $attribute->isArray(); }
/** * @param PhpAnnotationBlock $annotationBlock * @param StructAttributeModel $attribute * @return Struct */ protected function addStructMethodsGetAnnotationBlockFromXmlAttribute(PhpAnnotationBlock $annotationBlock, StructAttributeModel $attribute) { if ($attribute->isXml()) { $annotationBlock->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\\DOMDocument::loadXML()'))->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\\DOMDocument::hasChildNodes()'))->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\\DOMDocument::saveXML()'))->addChild(new PhpAnnotation(self::ANNOTATION_USES, '\\DOMNode::item()'))->addChild(new PhpAnnotation(self::ANNOTATION_USES, sprintf('%s::%s()', $this->getModel()->getPackagedName(true), $attribute->getSetterName())))->addChild(new PhpAnnotation(self::ANNOTATION_PARAM, 'bool $asString true: returns XML string, false: returns \\DOMDocument')); } return $this; }