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

load() public method

See also: Loadable::load
public load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : Document | Result | null
$source mixed
$contentType string
$options array | Traversable | Options
return FluentDOM\Document | FluentDOM\Loader\Result | null
    public function load($source, $contentType, $options = [])
    {
        $hasHeaderLine = isset($options['HEADER']) ? (bool) $options['HEADER'] : !isset($options['FIELDS']);
        $this->configure($options);
        if ($this->supports($contentType) && ($lines = $this->getLines($source))) {
            $document = new Document('1.0', 'UTF-8');
            $document->appendChild($list = $document->createElementNS(self::XMLNS, 'json:json'));
            $list->setAttributeNS(self::XMLNS, 'json:type', 'array');
            $this->appendLines($list, $lines, $hasHeaderLine, isset($options['FIELDS']) ? $options['FIELDS'] : NULL);
            return $document;
        }
        return NULL;
    }