Hal\AbstractHal::setXMLAttributes PHP Method

setXMLAttributes() public method

public setXMLAttributes ( SimpleXMLElement $xml, Link $link ) : AbstractHal
$xml SimpleXMLElement
$link Link
return AbstractHal
    public function setXMLAttributes(SimpleXMLElement $xml, Link $link)
    {
        $xml->addAttribute('href', $link->getHref());
        if ($link->getRel() && $link->getRel() !== 'self') {
            $xml->addAttribute('rel', $link->getRel());
        }
        if ($link->getName()) {
            $xml->addAttribute('name', $link->getName());
        }
        if ($link->getTitle()) {
            $xml->addAttribute('title', $link->getTitle());
        }
        if ($link->getHreflang()) {
            $xml->addAttribute('hreflang', $link->getHreflang());
        }
        return $this;
    }
AbstractHal