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

loadFragment() public method

See also: Loadable::loadFragment
public loadFragment ( string $source, string $contentType, array | Traversable | Options $options = [] ) : DocumentFragment | null
$source string
$contentType string
$options array | Traversable | Options
return FluentDOM\DocumentFragment | null
    public function loadFragment($source, $contentType, $options = [])
    {
        $hasHeaderLine = isset($options['FIELDS']) ? FALSE : isset($options['HEADER']) && $options['HEADER'];
        $this->configure($options);
        if ($this->supports($contentType) && ($lines = $this->getLines($source))) {
            $document = new Document('1.0', 'UTF-8');
            $fragment = $document->createDocumentFragment();
            $this->appendLines($fragment, $lines, $hasHeaderLine, isset($options['FIELDS']) ? $options['FIELDS'] : NULL);
            return $fragment;
        }
        return NULL;
    }