public function loadFragment($source, $contentType, $options = [])
{
if (!$this->supports($contentType)) {
return NULL;
} elseif (is_string($source)) {
$this->_xmlLoader = $this->_xmlLoader ?: new Xml();
return $this->_xmlLoader->loadFragment($source, 'text/xml');
} elseif ($source instanceof \SimpleXMLElement) {
$node = dom_import_simplexml($source);
$fragment = $node->ownerDocument->createDocumentFragment();
$fragment->appendChild($node->cloneNode(TRUE));
return $fragment;
}
throw new InvalidArgument('source', ['SimpleXMLElement', 'string']);
}