/** * @param SimpleXMLElement $xml * @param 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; }
/** * * @param Link $link */ protected function _addLinks(Link $link) { if ($link->getRel() != 'self' && !is_numeric($link->getRel())) { $this->_addLink($link); } }