protected function formatBody(Url $url)
 {
     $buffer = "\t" . '<loc>' . $this->escape($url->getLoc()) . '</loc>' . "\n";
     if ($url->getLastmod() !== null) {
         $buffer .= "\t" . '<lastmod>' . $this->escape($url->getLastmod()) . '</lastmod>' . "\n";
     }
     if ($url->getChangefreq() !== null) {
         $buffer .= "\t" . '<changefreq>' . $this->escape($url->getChangefreq()) . '</changefreq>' . "\n";
     }
     if ($url->getPriority() !== null) {
         $buffer .= "\t" . '<priority>' . $this->escape($url->getPriority()) . '</priority>' . "\n";
     }
     foreach ($url->getVideos() as $video) {
         $buffer .= $this->formatVideo($video);
     }
     foreach ($url->getImages() as $image) {
         $buffer .= $this->formatImage($image);
     }
     return $buffer;
 }
Пример #2
0
 /**
  * @dataProvider changefreqProvider
  */
 public function testChangefreq($changefreq)
 {
     $url = new Url();
     $url->setChangefreq($changefreq);
     $this->assertEquals($changefreq, $url->getChangefreq());
 }