original_string: public function ComparePosition( $other, $useLineNo = false)
  	{
  		$thisDomNode = $this->getUnderlyingObject();
  		$otherDomNode = $other->getUnderlyingObject();
  		$doc1 = $thisDomNode->baseURI;
  		$doc2 = $otherDomNode->baseURI;
  
  		if ( strcasecmp( $doc1, $doc2 ) != 0 )
  		// if ( spl_object_hash( $this->domNode->ownerDocument ) != spl_object_hash( $other->getUnderlyingObject()->ownerDocument ) )
  			return XmlNodeOrder::Unknown;
  
  		$thisPath = $thisDomNode->getNodePath();
  		$otherPath = $otherDomNode->getNodePath();
  
  		// Convert node names into a set positions
  		// This is necessary because the getNodePath returns named nodes.
  		// However there has to be a question mark over performance since
  		// an XPath query is being performed for every segment of both the
  		// 'this' path and the 'other' path.
  		// In the case where a parent has named child nodes that are not
  		// in a lexical order such as:
  		// <a>
  		//  <c/>
  		//  <b/>
  		// </a>
  		// Then sorting on the path will result in a list that is not
  		// document ordered. By changing the name for the correct position
  		// in the parent the set of paths can be sorted.
  		$convert = function( $xPath, $nodePath )
  		{
  			$parts = explode( "/", $nodePath );
  			$length = 0;
  			foreach ( $parts as $key => &$part )
  			{
  				$length++;
  				if ( $part == "" ) continue;
  
  				$length += strlen( $part );
  				$result = $xPath->evaluate( "count(" . substr( $nodePath, 0, $length -1 ) . "/preceding-sibling::*) + 1" );
  				$part = $result;
  			}
  			unset( $part );
  
  			return implode( "/", $parts );
  		};
  
  		$xPath = new \DOMXPath( $thisDomNode instanceof \DOMDocument ? $thisDomNode : $thisDomNode->ownerDocument );
  		$thisPath = $convert( $xPath, $thisPath );
  		$xPath = new \DOMXPath( $otherDomNode instanceof \DOMDocument ? $otherDomNode : $otherDomNode->ownerDocument );
  		$otherPath = $convert( $xPath, $otherPath );
  
  		if ( $useLineNo )
  		{
  			$thisPath = $thisDomNode->getLineNo() . "-" . $thisPath;
  			$otherPath = $otherDomNode->getLineNo() . "-" . $otherPath;
  		}
  
  		// Using strnatcasecmp so /xx[20] will follow /xx[3] which does not happen with other sort types
  		$compare = strnatcasecmp( $thisPath, $otherPath );
  		return $compare == 0
  			? XmlNodeOrder::Same
  			: ( $compare < 0 ? XmlNodeOrder::Before : XmlNodeOrder::After );
  	}
code: public function ComparePosition( $other, $useLineNo = false)
  	{
  		$thisDomNode = $this->getUnderlyingObject();
  		$otherDomNode = $other->getUnderlyingObject();
  		$doc1 = $thisDomNode->baseURI;
  		$doc2 = $otherDomNode->baseURI;
  
  		if ( strcasecmp( $doc1, $doc2 ) != 0 )
  		// if ( spl_object_hash( $this->domNode->ownerDocument ) != spl_object_hash( $other->getUnderlyingObject()->ownerDocument ) )
  			return XmlNodeOrder::Unknown;
  
  		$thisPath = $thisDomNode->getNodePath();
  		$otherPath = $otherDomNode->getNodePath();
  
  		// Convert node names into a set positions
  		// This is necessary because the getNodePath returns named nodes.
  		// However there has to be a question mark over performance since
  		// an XPath query is being performed for every segment of both the
  		// 'this' path and the 'other' path.
  		// In the case where a parent has named child nodes that are not
  		// in a lexical order such as:
  		// <a>
  		//  <c/>
  		//  <b/>
  		// </a>
  		// Then sorting on the path will result in a list that is not
  		// document ordered. By changing the name for the correct position
  		// in the parent the set of paths can be sorted.
  		$convert = function( $xPath, $nodePath )
  		{
  			$parts = explode( "/", $nodePath );
  			$length = 0;
  			foreach ( $parts as $key => &$part )
  			{
  				$length++;
  				if ( $part == "" ) continue;
  
  				$length += strlen( $part );
  				$result = $xPath->evaluate( "count(" . substr( $nodePath, 0, $length -1 ) . "/preceding-sibling::*) + 1" );
  				$part = $result;
  			}
  			unset( $part );
  
  			return implode( "/", $parts );
  		};
  
  		$xPath = new \DOMXPath( $thisDomNode instanceof \DOMDocument ? $thisDomNode : $thisDomNode->ownerDocument );
  		$thisPath = $convert( $xPath, $thisPath );
  		$xPath = new \DOMXPath( $otherDomNode instanceof \DOMDocument ? $otherDomNode : $otherDomNode->ownerDocument );
  		$otherPath = $convert( $xPath, $otherPath );
  
  		if ( $useLineNo )
  		{
  			$thisPath = $thisDomNode->getLineNo() . "-" . $thisPath;
  			$otherPath = $otherDomNode->getLineNo() . "-" . $otherPath;
  		}
  
  		// Using strnatcasecmp so /xx[20] will follow /xx[3] which does not happen with other sort types
  		$compare = strnatcasecmp( $thisPath, $otherPath );
  		return $compare == 0
  			? XmlNodeOrder::Same
  			: ( $compare < 0 ? XmlNodeOrder::Before : XmlNodeOrder::After );
  	}
code_tokens: public function ComparePosition ( $ other , $ useLineNo = false ) { $ thisDomNode = $ this -> getUnderlyingObject ( ) ; $ otherDomNode = $ other -> getUnderlyingObject ( ) ; $ doc1 = $ thisDomNode -> baseURI ; $ doc2 = $ otherDomNode -> baseURI ; if ( strcasecmp ( $ doc1 , $ doc2 ) != 0 ) // if ( spl_object_hash( $this->domNode->ownerDocument ) != spl_object_hash( $other->getUnderlyingObject()->ownerDocument ) )
   return XmlNodeOrder :: Unknown ; $ thisPath = $ thisDomNode -> getNodePath ( ) ; $ otherPath = $ otherDomNode -> getNodePath ( ) ; // Convert node names into a set positions
   // This is necessary because the getNodePath returns named nodes.
   // However there has to be a question mark over performance since
   // an XPath query is being performed for every segment of both the
   // 'this' path and the 'other' path.
   // In the case where a parent has named child nodes that are not
   // in a lexical order such as:
   // <a>
   //  <c/>
   //  <b/>
   // </a>
   // Then sorting on the path will result in a list that is not
   // document ordered. By changing the name for the correct position
   // in the parent the set of paths can be sorted.
   $ convert = function ( $ xPath , $ nodePath ) { $ parts = explode ( "/" , $ nodePath ) ; $ length = 0 ; foreach ( $ parts as $ key => & $ part ) { $ length ++ ; if ( $ part == "" ) continue ; $ length += strlen ( $ part ) ; $ result = $ xPath -> evaluate ( "count(" . substr ( $ nodePath , 0 , $ length - 1 ) . "/preceding-sibling::*) + 1" ) ; $ part = $ result ; } unset ( $ part ) ; return implode ( "/" , $ parts ) ; } ; $ xPath = new \ DOMXPath ( $ thisDomNode instanceof \ DOMDocument ? $ thisDomNode : $ thisDomNode -> ownerDocument ) ; $ thisPath = $ convert ( $ xPath , $ thisPath ) ; $ xPath = new \ DOMXPath ( $ otherDomNode instanceof \ DOMDocument ? $ otherDomNode : $ otherDomNode -> ownerDocument ) ; $ otherPath = $ convert ( $ xPath , $ otherPath ) ; if ( $ useLineNo ) { $ thisPath = $ thisDomNode -> getLineNo ( ) . "-" . $ thisPath ; $ otherPath = $ otherDomNode -> getLineNo ( ) . "-" . $ otherPath ; } // Using strnatcasecmp so /xx[20] will follow /xx[3] which does not happen with other sort types
   $ compare = strnatcasecmp ( $ thisPath , $ otherPath ) ; return $ compare == 0 ? XmlNodeOrder :: Same : ( $ compare < 0 ? XmlNodeOrder :: Before : XmlNodeOrder :: After ) ; }
docstring: Compares the position of the current XPathNavigator with the
  position of the XPathNavigator specified.
  
  @param XPathNavigator $other : The XPathNavigator to compare against.
  @param bool $useLineNo (Default: false)
  @return XmlNodeOrder An XmlNodeOrder value representing the comparative position of the two XPathNavigator objects.
docstring_tokens: Compares the position of the current XPathNavigator with the position of the XPathNavigator specified .