protected function addCommentToQueueOrLdif(Ldif $ldif)
{
$comment = $this->getContinuedValues(substr($this->currentLine(), 1));
// Remove the single space from the start of a comment, but leave the others intact.
if ($this->startsWith(' ', $comment)) {
$comment = substr($comment, 1);
}
// If we already have an entry added to LDIF, then the comment should go in the queue for the next entry.
if (count($ldif->getEntries()) > 0) {
$this->commentQueue[] = $comment;
// Check the section of the LDIF to look for an empty line. If so, assume it's for a future entry.
} elseif (array_search('', array_slice($this->lines, 0, $this->line))) {
$this->commentQueue[] = $comment;
// No empty lines and we have not reached an entry yet, so this should be a comment for the LDIF overall.
} else {
$ldif->addComment($comment);
}
}