Ejemplo n.º 1
0
 public function testLink()
 {
     $link = new AtomLink();
     $link->setHref('http://www.example.com')->setLength(45)->setHreflang('en')->setRel('self')->setType('application/xml')->setTitle('My Title')->setTitle('Our Title');
     $this->assertSame('http://www.example.com', $link->getHref());
     $this->assertSame(45, $link->getLength());
     $this->assertSame('en', $link->getHreflang());
     $this->assertSame('self', $link->getRel());
     $this->assertSame('application/xml', $link->getType());
     $this->assertSame('Our Title', $link->getTitle());
 }
Ejemplo n.º 2
0
 public function writeLink(RssWriter $rssWriter, AtomLink $link)
 {
     $writer = $rssWriter->getXmlWriter();
     $writer->startElement('atom:link');
     $writer->writeAttribute('href', $link->getHref());
     if ($link->getLength()) {
         $writer->writeAttribute('length', $link->getLength());
     }
     if ($link->getHreflang()) {
         $writer->writeAttribute('hreflang', $link->getHreflang());
     }
     if ($link->getRel()) {
         $writer->writeAttribute('rel', $link->getRel());
     }
     if ($link->getType()) {
         $writer->writeAttribute('type', $link->getType());
     }
     if ($link->getTitle()) {
         $writer->writeAttribute('title', $link->getTitle());
     }
     $writer->endElement();
 }