CloneInstance
@return XPath2NodeIterator
769353
public function CloneInstance()
	{
		$result = new AttributeNodeIterator();
		$result->AssignFrom( $this );
		$result->ignoreIdAttributes = $this->ignoreIdAttributes;
		return $result;
	}
332104
public function CloneInstance()
	{
		$result = new PrecedingNodeIterator();
		$result->AssignFrom( $this );
		$result->kind = $this->kind;
		return $result;
	}
1329727
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                AnyMatcher::instance(),
                WildcardMatcher::instance(),
                InlineExporter::instance()
            );
            self::$instance
                ->addMatcherDriver(HamcrestMatcherDriver::instance());
        }

        return self::$instance;
    }
1166294
public function next() {
		$next = $this->domnode;
		if(!$next)
			return new Node(null);
		while(true) {
			$next = $next->nextSibling;
			if(!$next)
				return new Node(null);
			if($next->nodeType == XML_ELEMENT_NODE)
				return new Node($next);
		}
	}
443124
public function copy()
    {
        $list = [];
        foreach ($this->getIterator() as $key => $value) {
            $list[$key] = \is_object($value) ? clone $value : $value;
        }

        return $this->createFrom($list);
    }
629620
function () {
                var r = this.cloneImplementation();
                if (typeof (r) !== typeof (this))
                    throw new Error("Error in implementation of cloneImplementation: not returning object of correct type");
                r.name = this.name;
                r.grammarName = this.grammarName;
                r._createAstNode = this._createAstNode;
                return r;
            }
1030303
public DTMIterator cloneWithReset() throws CloneNotSupportedException
  {
  	NodeSequence seq = (NodeSequence)super.clone();
    seq.m_next = 0;
    if (m_cache != null) {
        // In making this clone of an iterator we are making
        // another NodeSequence object it has a reference
        // to the same IteratorCache object as the original
        // so we need to remember that more than one
        // NodeSequence object shares the cache.
        m_cache.increaseUseCount();
    }
    
    return seq;
  }
1241207
public function duplicate()
    {
        $db = Loader::db();
        $em = \ORM::entityManager();

        $versions = $this->versions;
        $thumbs = Type::getVersionList();
        
        // duplicate the core file object
        $nf = clone $this;
        $dh = Loader::helper('date');
        $date = $dh->getOverridableNow();
        $nf->fDateAdded = new Carbon($date);

        $em->persist($nf);
        $em->flush();

        $folder = $this->getFileFolderObject();
        $folderNode = \Concrete\Core\Tree\Node\Type\File::add($nf, $folder);
        $nf->folderTreeNodeID = $folder->getTreeNodeID();

        $em->persist($nf);
        $em->flush();

        // clear out the versions
        $nf->versions = new ArrayCollection();

        $fi = Core::make('helper/file');
        $cf = Core::make('helper/concrete/file');
        $importer = new Importer();
        $filesystem = $this->getFileStorageLocationObject()->getFileSystemObject();
        foreach ($versions as $version) {
            if ($version->isApproved()) {
                $cloneVersion = clone $version;
                $cloneVersion->setFileVersionID(1);
                $cloneVersion->setFile($nf);

                $em->persist($cloneVersion);
                $em->flush();

                $cloneVersion->duplicateUnderlyingFile();

                foreach ($version->getAttributes() as $value) {
                    $value = clone $value;
                    $value->setVersion($cloneVersion);
                    $em->persist($value);
                }

                $em->flush();

                $nf->versions->add($cloneVersion);
                foreach ($thumbs as $type) {
                    $cloneVersion->duplicateUnderlyingThumbnailFiles($type, $version);
                }
            }
        }

        $em->persist($nf);
        $em->flush();

        $v = [$this->fID];
        $q = 'select fID, paID, pkID from FilePermissionAssignments where fID = ?';
        $r = $db->query($q, $v);
        while ($row = $r->fetchRow()) {
            $v = [$nf->getFileID(), $row['paID'], $row['pkID']];
            $q = 'insert into FilePermissionAssignments (fID, paID, pkID) values (?, ?, ?)';
            $db->query($q, $v);
        }

        $fe = new \Concrete\Core\File\Event\DuplicateFile($this);
        $fe->setNewFileObject($nf);
        Events::dispatch('on_file_duplicate', $fe);

        return $nf;
    }
918440
protected function getClonedNodes()
    {
        $cloned_nodes = array();

        foreach ($this->nodes as $node) {
            $cloned_node = $node->cloneNode(true);

            if ($cloned_node instanceof \DOMElement && $cloned_node->hasAttribute('dqn_tmp_id')) {
                $cloned_node->removeAttribute('dqn_tmp_id');
            }

            $cloned_nodes[] = $cloned_node;
        }

        return $cloned_nodes;
    }
256586
public function build(): SetInspectedNodeRequest
	{
		$instance = new SetInspectedNodeRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		return $instance;
	}
1068579
def _clone_node(self) -> 'Tag':
        
        clone = type(self)()
        for attr in self.attributes:
            clone.setAttribute(attr, self.getAttribute(attr))
        for c in self.classList:
            clone.addClass(c)
        clone.style.update(self.style)
        # TODO: should clone event listeners???
        return clone
528464
public SimpleXmlNode shallowCopy() {
    SimpleXmlNode copy = new SimpleXmlNode(_name);
    copy.setText(_text);
    copy.getAttributes().putAll(_attributes);
    return copy;
  }
1126747
public DTMIterator cloneWithReset() throws CloneNotSupportedException
  {

    DescendantIterator clone = (DescendantIterator) super.cloneWithReset();
    clone.m_traverser = m_traverser;

    clone.resetProximityPositions();

    return clone;
  }
970674
public Iterable<SimpleXmlNode> getDescendents() {
    return new Iterable<SimpleXmlNode>() {
      @Override
      public Iterator<SimpleXmlNode> iterator() {
        return new DescendentsIterator(SimpleXmlNode.this);
      }
    };
  }
478414
public function duplicate()
    {
        if (false === $this->is_duplicated) {
            $this->_duplicate();
            $this->is_duplicated = true;
            $this->node = parent::getNode();
        }
        return $this;
    }
965149
def copyNodeList(self):
        
        ret = libxml2mod.xmlCopyNodeList(self._o)
        if ret is None:raise treeError('xmlCopyNodeList() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
1362085
function cloneNode(doc,node,deep){
	var node2 = new node.constructor();
	for(var n in node){
		var v = node[n];
		if(typeof v != 'object' ){
			if(v != node2[n]){
				node2[n] = v;
			}
		}
	}
	if(node.childNodes){
		node2.childNodes = new NodeList();
	}
	node2.ownerDocument = doc;
	switch (node2.nodeType) {
	case ELEMENT_NODE:
		var attrs	= node.attributes;
		var attrs2	= node2.attributes = new NamedNodeMap();
		var len = attrs.length
		attrs2._ownerElement = node2;
		for(var i=0;i<len;i++){
			node2.setAttributeNode(cloneNode(doc,attrs.item(i),true));
		}
		break;;
	case ATTRIBUTE_NODE:
		deep = true;
	}
	if(deep){
		var child = node.firstChild;
		while(child){
			node2.appendChild(cloneNode(doc,child,deep));
			child = child.nextSibling;
		}
	}
	return node2;
}