private function addSingleLanguageItem($location, $lastModified, $changeFrequency, $priority)
    {
        $this->validateLocation($location);


        $this->writer->startElement('url');

        $this->writer->writeElement('loc', $location);

        if ($lastModified !== null) {
            $this->writer->writeElement('lastmod', date('c', $lastModified));
        }

        if ($changeFrequency !== null) {
            if (!in_array($changeFrequency, $this->validFrequencies, true)) {
                throw new \InvalidArgumentException(
                    'Please specify valid changeFrequency. Valid values are: '
                    . implode(', ', $this->validFrequencies)
                    . "You have specified: {$changeFrequency}."
                );
            }

            $this->writer->writeElement('changefreq', $changeFrequency);
        }

        if ($priority !== null) {
            if (!is_numeric($priority) || $priority < 0 || $priority > 1) {
                throw new \InvalidArgumentException(
                    "Please specify valid priority. Valid values range from 0.0 to 1.0. You have specified: {$priority}."
                );
            }
            $this->writer->writeElement('priority', number_format($priority, 1, '.', ','));
        }

        $this->writer->endElement();
    }
private function addSingleLanguageItem($location, $lastModified, $changeFrequency, $priority)
    {
        $this->validateLocation($location);


        $this->writer->startElement('url');

        $this->writer->writeElement('loc', $location);

        if ($lastModified !== null) {
            $this->writer->writeElement('lastmod', date('c', $lastModified));
        }

        if ($changeFrequency !== null) {
            if (!in_array($changeFrequency, $this->validFrequencies, true)) {
                throw new \InvalidArgumentException(
                    'Please specify valid changeFrequency. Valid values are: '
                    . implode(', ', $this->validFrequencies)
                    . "You have specified: {$changeFrequency}."
                );
            }

            $this->writer->writeElement('changefreq', $changeFrequency);
        }

        if ($priority !== null) {
            if (!is_numeric($priority) || $priority < 0 || $priority > 1) {
                throw new \InvalidArgumentException(
                    "Please specify valid priority. Valid values range from 0.0 to 1.0. You have specified: {$priority}."
                );
            }
            $this->writer->writeElement('priority', number_format($priority, 1, '.', ','));
        }

        $this->writer->endElement();
    }
private function addSingleLanguageItem ( $ location , $ lastModified , $ changeFrequency , $ priority ) { $ this -> validateLocation ( $ location ) ; $ this -> writer -> startElement ( 'url' ) ; $ this -> writer -> writeElement ( 'loc' , $ location ) ; if ( $ lastModified !== null ) { $ this -> writer -> writeElement ( 'lastmod' , date ( 'c' , $ lastModified ) ) ; } if ( $ changeFrequency !== null ) { if ( ! in_array ( $ changeFrequency , $ this -> validFrequencies , true ) ) { throw new \ InvalidArgumentException ( 'Please specify valid changeFrequency. Valid values are: ' . implode ( ', ' , $ this -> validFrequencies ) . "You have specified: {$changeFrequency}." ) ; } $ this -> writer -> writeElement ( 'changefreq' , $ changeFrequency ) ; } if ( $ priority !== null ) { if ( ! is_numeric ( $ priority ) || $ priority < 0 || $ priority > 1 ) { throw new \ InvalidArgumentException ( "Please specify valid priority. Valid values range from 0.0 to 1.0. You have specified: {$priority}." ) ; } $ this -> writer -> writeElement ( 'priority' , number_format ( $ priority , 1 , '.' , ',' ) ) ; } $ this -> writer -> endElement ( ) ; }
Adds a new single item to sitemap

@param string $location location item URL
@param integer $lastModified last modification timestamp
@param float $changeFrequency change frequency. Use one of self:: constants here
@param string $priority item's priority (0.0-1.0). Default null is equal to 0.5

@throws \InvalidArgumentException

@see addItem
Adds a new single item to sitemap