private function createSerializerDelegate(
            Annotations $annotations,
            string $defaultTagName
    ): XmlSerializerDelegate {
        if ($annotations->contain('XmlAttribute')) {
            $xmlAttribute = $annotations->firstNamed('XmlAttribute');
            return new Attribute(
                    $xmlAttribute->attributeName(),
                    $xmlAttribute->getValueByName('skipEmpty', true)
            );
        } elseif ($annotations->contain('XmlFragment')) {
            $xmlFragment = $annotations->firstNamed('XmlFragment');
            return new Fragment(
                    false !== $xmlFragment->tagName() ? $xmlFragment->tagName() : null,
                    $xmlFragment->getValueByName('transformNewLineToBr', false)
            );
        } elseif ($annotations->contain('XmlTag')) {
            $xmlTag = $annotations->firstNamed('XmlTag');
            return new Tag(
                    false !== $xmlTag->tagName() ? $xmlTag->tagName() : '',
                    $xmlTag->getValueByName('elementTagName')
            );
        }

        return new Tag($defaultTagName);
    }
private function createSerializerDelegate(
            Annotations $annotations,
            string $defaultTagName
    ): XmlSerializerDelegate {
        if ($annotations->contain('XmlAttribute')) {
            $xmlAttribute = $annotations->firstNamed('XmlAttribute');
            return new Attribute(
                    $xmlAttribute->attributeName(),
                    $xmlAttribute->getValueByName('skipEmpty', true)
            );
        } elseif ($annotations->contain('XmlFragment')) {
            $xmlFragment = $annotations->firstNamed('XmlFragment');
            return new Fragment(
                    false !== $xmlFragment->tagName() ? $xmlFragment->tagName() : null,
                    $xmlFragment->getValueByName('transformNewLineToBr', false)
            );
        } elseif ($annotations->contain('XmlTag')) {
            $xmlTag = $annotations->firstNamed('XmlTag');
            return new Tag(
                    false !== $xmlTag->tagName() ? $xmlTag->tagName() : '',
                    $xmlTag->getValueByName('elementTagName')
            );
        }

        return new Tag($defaultTagName);
    }
private function createSerializerDelegate ( Annotations $ annotations , string $ defaultTagName ) : XmlSerializerDelegate { if ( $ annotations -> contain ( 'XmlAttribute' ) ) { $ xmlAttribute = $ annotations -> firstNamed ( 'XmlAttribute' ) ; return new Attribute ( $ xmlAttribute -> attributeName ( ) , $ xmlAttribute -> getValueByName ( 'skipEmpty' , true ) ) ; } elseif ( $ annotations -> contain ( 'XmlFragment' ) ) { $ xmlFragment = $ annotations -> firstNamed ( 'XmlFragment' ) ; return new Fragment ( false !== $ xmlFragment -> tagName ( ) ? $ xmlFragment -> tagName ( ) : null , $ xmlFragment -> getValueByName ( 'transformNewLineToBr' , false ) ) ; } elseif ( $ annotations -> contain ( 'XmlTag' ) ) { $ xmlTag = $ annotations -> firstNamed ( 'XmlTag' ) ; return new Tag ( false !== $ xmlTag -> tagName ( ) ? $ xmlTag -> tagName ( ) : '' , $ xmlTag -> getValueByName ( 'elementTagName' ) ) ; } return new Tag ( $ defaultTagName ) ; }
extracts informations about annotated element

@param   \stubbles\lang\reflect\annotation\Annotations  $annotations     annotations of the element to serialize
@param   string                                         $defaultTagName  default tag name in case element is not annotated
@return  \stubbles\xml\serializer\delegate\XmlSerializerDelegate
extracts informations about annotated element