gossi\codegen\model\parts\TypeDocblockGeneratorPart::generateTypeTag PHP Method

generateTypeTag() protected method

Generates a type tag (return or var) but checks if one exists and updates this one
protected generateTypeTag ( gossi\docblock\tags\AbstractTag $tag )
$tag gossi\docblock\tags\AbstractTag
    protected function generateTypeTag(AbstractTag $tag)
    {
        $docblock = $this->getDocblock();
        $type = $this->getType();
        if (!empty($type)) {
            // try to find tag at first and update
            $tags = $docblock->getTags($tag->getTagName());
            if ($tags->size() > 0) {
                $ttag = $tags->get(0);
                $ttag->setType($this->getType());
                $ttag->setDescription($this->getTypeDescription());
            } else {
                $docblock->appendTag($tag->setType($this->getType())->setDescription($this->getTypeDescription()));
            }
        }
    }