public function toDOMElement()

in src/Facebook/InstantArticles/Elements/Audio.php [188:219]


    public function toDOMElement($document = null)
    {
        if (!$document) {
            $document = new \DOMDocument();
        }

        $element = $document->createElement('audio');

        // title markup optional
        if ($this->title) {
            $element->setAttribute('title', $this->title);
        }

        // Autoplay mode markup optional
        if ($this->autoplay) {
            $element->setAttribute('autoplay', 'autoplay');
        }

        // Autoplay mode markup optional
        if ($this->muted) {
            $element->setAttribute('muted', 'muted');
        }

        // Audio URL markup. REQUIRED
        if ($this->url) {
            $source_element = $document->createElement('source');
            $source_element->setAttribute('src', $this->url);
            $element->appendChild($source_element);
        }

        return $element;
    }