FluentDOM\Loader\Text\CSV::appendLines PHP Method

appendLines() private method

Append the provided lines to the parent.
private appendLines ( DOMNode $parent, $lines, $hasHeaderLine, array $fields = NULL )
$parent DOMNode
$lines
$hasHeaderLine
$fields array
    private function appendLines(\DOMNode $parent, $lines, $hasHeaderLine, array $fields = NULL)
    {
        $document = $parent instanceof \DOMDocument ? $parent : $parent->ownerDocument;
        $headers = NULL;
        foreach ($lines as $line) {
            if ($headers === NULL) {
                $headers = $this->getHeaders($line, $hasHeaderLine, $fields);
                if ($hasHeaderLine) {
                    continue;
                }
            }
            $parent->appendChild($node = $document->createElement(self::DEFAULT_QNAME));
            foreach ($line as $index => $field) {
                if (isset($headers[$index])) {
                    $this->appendField($node, $headers[$index], $field);
                }
            }
        }
    }