FluentDOM\Loaders::loadFragment PHP Method

loadFragment() public method

Load a data source as a fragment, the content type allows the loader to decide if it supports the data source
public loadFragment ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : DOMDocumentFragment | null
$source mixed
$contentType string
$options array | Traversable | Options
return DOMDocumentFragment | null
    public function loadFragment($source, $contentType, $options = [])
    {
        $fragment = NULL;
        foreach ($this as $loader) {
            /**
             * @var Loadable $loader
             */
            if ($loader->supports($contentType) && ($fragment = $loader->loadFragment($source, $contentType, $options))) {
                break;
            }
        }
        return $fragment instanceof \DOMDocumentFragment ? $fragment : NULL;
    }