Example #1
0
 /**
  * Sets XML attributes for RApiHalDocumentLink
  * 
  * @param   SimpleXMLElement     $xml   XML document
  * @param   RApiHalDocumentLink  $link  Link element
  *
  * @return RApiHalDocumentBase
  */
 public function setXMLAttributes(SimpleXMLElement $xml, RApiHalDocumentLink $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;
 }
Example #2
0
 /**
  * Adds links to the current resource
  *
  * @param   RApiHalDocumentLink  $link  Link
  *
  * @return void
  */
 protected function _addLinks(RApiHalDocumentLink $link)
 {
     if ($link->getRel() != 'self' && !is_numeric($link->getRel())) {
         $this->_addLink($link);
     }
 }