Пример #1
0
 /**
  * @param \Sitemapper\SitemapInterface $sitemap
  */
 public function seed(SitemapInterface $sitemap)
 {
     $faker = Faker::create();
     for ($i = 1; $i <= $this->total; $i++) {
         $sitemap->addUrl(new Url($this->hostname . '/' . $faker->uuid));
     }
 }
Пример #2
0
 /**
  * @param \Sitemapper\Url $url
  */
 public function addUrl(Url $url)
 {
     $this->boot();
     // If current map reached the max allowed urls, boot next map
     if ($this->currentSitemap->count() + 1 > $this->maxAllowedUrls) {
         if ($this->autoSave) {
             $this->saveSitemap($this->currentSitemap);
             $this->saveIndex();
         }
         // Boot next map
         $this->bootSitemap();
     }
     // Check if map is saved!
     $this->currentSitemap->addUrl($url);
 }