XPathFunctions/lyquidity/iterators/InstanceFactsIterator.php
public static function fromIterator( $context, $sourceIterator, $mode, $nonNilOnly = false )
	{
		if ( ! $sourceIterator instanceof XPath2NodeIterator )
		{
			return EmptyIterator::$Shared;
		}

		$test = new NodeTest( SequenceTypes::$Element );
		$iterator = $mode == XFI_TUPLE_ITEMS || $mode == XFI_TUPLE_TUPLES
			? ChildNodeIterator::fromNodeTest($context, $test, $sourceIterator )
			: ChildOverDescendantsNodeIterator::fromParts( $context, array( $test ), $sourceIterator );

		$result = new InstanceFactsIterator( $context );
		$result->nonNilOnly = $nonNilOnly;
		$result->iterator = $iterator;

		if ( $mode == XFI_INSTANCE_ALL_FACTS )
		{
			$result->substitutionGroups = array_merge( InstanceFactsIterator::$itemSubstitutionGroup, InstanceFactsIterator::$tupleSubstitutionGroup );
		}
		else if ( $mode == XFI_INSTANCE_ITEMS || $mode == XFI_TUPLE_ITEMS )
		{
			$result->substitutionGroups = InstanceFactsIterator::$itemSubstitutionGroup;
		}
		else if ( $mode == XFI_INSTANCE_TUPLES || $mode == XFI_TUPLE_TUPLES )
		{
			$result->substitutionGroups = InstanceFactsIterator::$tupleSubstitutionGroup;
		}

		return $result;
	}
public static function fromIterator( $context, $sourceIterator, $mode, $nonNilOnly = false )
	{
		if ( ! $sourceIterator instanceof XPath2NodeIterator )
		{
			return EmptyIterator::$Shared;
		}

		$test = new NodeTest( SequenceTypes::$Element );
		$iterator = $mode == XFI_TUPLE_ITEMS || $mode == XFI_TUPLE_TUPLES
			? ChildNodeIterator::fromNodeTest($context, $test, $sourceIterator )
			: ChildOverDescendantsNodeIterator::fromParts( $context, array( $test ), $sourceIterator );

		$result = new InstanceFactsIterator( $context );
		$result->nonNilOnly = $nonNilOnly;
		$result->iterator = $iterator;

		if ( $mode == XFI_INSTANCE_ALL_FACTS )
		{
			$result->substitutionGroups = array_merge( InstanceFactsIterator::$itemSubstitutionGroup, InstanceFactsIterator::$tupleSubstitutionGroup );
		}
		else if ( $mode == XFI_INSTANCE_ITEMS || $mode == XFI_TUPLE_ITEMS )
		{
			$result->substitutionGroups = InstanceFactsIterator::$itemSubstitutionGroup;
		}
		else if ( $mode == XFI_INSTANCE_TUPLES || $mode == XFI_TUPLE_TUPLES )
		{
			$result->substitutionGroups = InstanceFactsIterator::$tupleSubstitutionGroup;
		}

		return $result;
	}
public static function fromIterator ( $ context , $ sourceIterator , $ mode , $ nonNilOnly = false ) { if ( ! $ sourceIterator instanceof XPath2NodeIterator ) { return EmptyIterator :: $ Shared ; } $ test = new NodeTest ( SequenceTypes :: $ Element ) ; $ iterator = $ mode == XFI_TUPLE_ITEMS || $ mode == XFI_TUPLE_TUPLES ? ChildNodeIterator :: fromNodeTest ( $ context , $ test , $ sourceIterator ) : ChildOverDescendantsNodeIterator :: fromParts ( $ context , array ( $ test ) , $ sourceIterator ) ; $ result = new InstanceFactsIterator ( $ context ) ; $ result -> nonNilOnly = $ nonNilOnly ; $ result -> iterator = $ iterator ; if ( $ mode == XFI_INSTANCE_ALL_FACTS ) { $ result -> substitutionGroups = array_merge ( InstanceFactsIterator :: $ itemSubstitutionGroup , InstanceFactsIterator :: $ tupleSubstitutionGroup ) ; } else if ( $ mode == XFI_INSTANCE_ITEMS || $ mode == XFI_TUPLE_ITEMS ) { $ result -> substitutionGroups = InstanceFactsIterator :: $ itemSubstitutionGroup ; } else if ( $ mode == XFI_INSTANCE_TUPLES || $ mode == XFI_TUPLE_TUPLES ) { $ result -> substitutionGroups = InstanceFactsIterator :: $ tupleSubstitutionGroup ; } return $ result ; }
Static Constructor creates an instance from an iterator created by the caller
@param XPath2Context $context
@param XPath2NodeIterator $sourceIterator
@param int One of XFI_INSTANCE_ALL_FACTS, XFI_INSTANCE_ITEMS, XFI_INSTANCE_TUPLES, XFI_TUPLE_ITEMS
@param bool $nonNilOnly (optional) Default is false
@return InstanceFactsIterator
Static Constructor creates an instance from an iterator created by the caller