public function addItem($location, $lastModified = null, $changeFrequency = null, $priority = null)
    {
        if ($this->urlsCount >= $this->maxUrls) {
            $this->finishFile();
        }

        if ($this->writerBackend === null) {
            $this->createNewFile();
        }

        if (is_array($location)) {
            $this->addMultiLanguageItem($location, $lastModified, $changeFrequency, $priority);
        } else {
            $this->addSingleLanguageItem($location, $lastModified, $changeFrequency, $priority);
        }

        $this->urlsCount++;

        if ($this->urlsCount % $this->bufferSize === 0) {
            $this->flush();
        }
    }