public function createSitemapIndex(Iterator $sitemaps)
    {
        $groupName = $this->randomHash();
        $sitemapIndexes = new ArrayObject();
        $sitemapIndex = new SitemapIndex();
        $lastmod = date(DateTime::W3C);
        foreach ($sitemaps as $sitemapPath) {
            // Ignoring because this is an edge case for HUGE sites...like Facebook.
            // @codeCoverageIgnoreStart
            if ($sitemapIndex->hasMaxUrlCount()) {
                $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));
                $sitemapIndex = new SitemapIndex();
            }
            // @codeCoverageIgnoreEnd

            $sitemapIndex->add($this->fileUrl($sitemapPath), $lastmod);
        }
        $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));

        // This will probably never happen, as it would mean over 2.5 Billion URLs in the
        // sitemap.  So unless Facebook uses this library, this will never happen, so ignore
        // it from code coverage.
        // @codeCoverageIgnoreStart
        if ($sitemapIndexes->count() > 1) {
            return $this->createSitemapIndex($sitemapIndexes->getIterator());
        }
        // @codeCoverageIgnoreEnd

        return $this->fileUrl($sitemapIndexes[0]);
    }
public function createSitemapIndex(Iterator $sitemaps)
    {
        $groupName = $this->randomHash();
        $sitemapIndexes = new ArrayObject();
        $sitemapIndex = new SitemapIndex();
        $lastmod = date(DateTime::W3C);
        foreach ($sitemaps as $sitemapPath) {
            // Ignoring because this is an edge case for HUGE sites...like Facebook.
            // @codeCoverageIgnoreStart
            if ($sitemapIndex->hasMaxUrlCount()) {
                $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));
                $sitemapIndex = new SitemapIndex();
            }
            // @codeCoverageIgnoreEnd

            $sitemapIndex->add($this->fileUrl($sitemapPath), $lastmod);
        }
        $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));

        // This will probably never happen, as it would mean over 2.5 Billion URLs in the
        // sitemap.  So unless Facebook uses this library, this will never happen, so ignore
        // it from code coverage.
        // @codeCoverageIgnoreStart
        if ($sitemapIndexes->count() > 1) {
            return $this->createSitemapIndex($sitemapIndexes->getIterator());
        }
        // @codeCoverageIgnoreEnd

        return $this->fileUrl($sitemapIndexes[0]);
    }
public function createSitemapIndex ( Iterator $ sitemaps ) { $ groupName = $ this -> randomHash ( ) ; $ sitemapIndexes = new ArrayObject ( ) ; $ sitemapIndex = new SitemapIndex ( ) ; $ lastmod = date ( DateTime :: W3C ) ; foreach ( $ sitemaps as $ sitemapPath ) { // Ignoring because this is an edge case for HUGE sites...like Facebook. // @codeCoverageIgnoreStart if ( $ sitemapIndex -> hasMaxUrlCount ( ) ) { $ sitemapIndexes -> append ( $ this -> writeSitemap ( $ groupName , $ sitemapIndex ) ) ; $ sitemapIndex = new SitemapIndex ( ) ; } // @codeCoverageIgnoreEnd $ sitemapIndex -> add ( $ this -> fileUrl ( $ sitemapPath ) , $ lastmod ) ; } $ sitemapIndexes -> append ( $ this -> writeSitemap ( $ groupName , $ sitemapIndex ) ) ; // This will probably never happen, as it would mean over 2.5 Billion URLs in the // sitemap.  So unless Facebook uses this library, this will never happen, so ignore // it from code coverage. // @codeCoverageIgnoreStart if ( $ sitemapIndexes -> count ( ) > 1 ) { return $ this -> createSitemapIndex ( $ sitemapIndexes -> getIterator ( ) ) ; } // @codeCoverageIgnoreEnd return $ this -> fileUrl ( $ sitemapIndexes [ 0 ] ) ; }
Creates a Sitemap index given an Iterator of Sitemaps
@param Iterator $sitemaps
@return mixed
Creates a Sitemap index given an Iterator of Sitemaps