Formulas/Resources/Formulas/GeneratedFacts.php
private function indexConcepts( $nav, $xbrlInstance, &$index = array(), $path = "" )
	{
		// $index = array();
		$flag = true;
		$first = $nav->getLineNo();
		$taxonomy = $xbrlInstance->getInstanceTaxonomy();

		do
		{
			$name = "{$nav->getNamespaceURI()}:{$nav->getLocalName()}";
			if ( $path ) $name = "$path,$name";
			$num = $nav->getLineNo() - $first + 1;
			if ( FactValues::isTuple( $nav ) )
			{
				$index[ $name ][ null ][ null ][ $num ][] = $nav->CloneInstance();
				$childNav = $nav->CloneInstance();
				if ( $childNav->MoveToChild( XPathNodeType::Element ) )
				{
					$result = $this->indexConcepts( $childNav, $xbrlInstance, $index, $name );
					// $index = array_merge_recursive( $index, $result );
				}
			}
			else
			{
				$contextRef = $nav->GetAttribute( "contextRef", null );
				$unitRef = $nav->GetAttribute( "unitRef", null );

				$index[ $name ][ $contextRef ][ $unitRef ][ $num ][] = $nav->CloneInstance();
			}
			$flag = $nav->MoveToNext( XPathNodeType::Element );
		}
		while ( $flag );

		return $index;
	}
private function indexConcepts( $nav, $xbrlInstance, &$index = array(), $path = "" )
	{
		// $index = array();
		$flag = true;
		$first = $nav->getLineNo();
		$taxonomy = $xbrlInstance->getInstanceTaxonomy();

		do
		{
			$name = "{$nav->getNamespaceURI()}:{$nav->getLocalName()}";
			if ( $path ) $name = "$path,$name";
			$num = $nav->getLineNo() - $first + 1;
			if ( FactValues::isTuple( $nav ) )
			{
				$index[ $name ][ null ][ null ][ $num ][] = $nav->CloneInstance();
				$childNav = $nav->CloneInstance();
				if ( $childNav->MoveToChild( XPathNodeType::Element ) )
				{
					$result = $this->indexConcepts( $childNav, $xbrlInstance, $index, $name );
					// $index = array_merge_recursive( $index, $result );
				}
			}
			else
			{
				$contextRef = $nav->GetAttribute( "contextRef", null );
				$unitRef = $nav->GetAttribute( "unitRef", null );

				$index[ $name ][ $contextRef ][ $unitRef ][ $num ][] = $nav->CloneInstance();
			}
			$flag = $nav->MoveToNext( XPathNodeType::Element );
		}
		while ( $flag );

		return $index;
	}
private function indexConcepts ( $ nav , $ xbrlInstance , & $ index = array ( ) , $ path = "" ) { // $index = array();
 $ flag = true ; $ first = $ nav -> getLineNo ( ) ; $ taxonomy = $ xbrlInstance -> getInstanceTaxonomy ( ) ; do { $ name = "{$nav->getNamespaceURI()}:{$nav->getLocalName()}" ; if ( $ path ) $ name = "$path,$name" ; $ num = $ nav -> getLineNo ( ) - $ first + 1 ; if ( FactValues :: isTuple ( $ nav ) ) { $ index [ $ name ] [ null ] [ null ] [ $ num ] [ ] = $ nav -> CloneInstance ( ) ; $ childNav = $ nav -> CloneInstance ( ) ; if ( $ childNav -> MoveToChild ( XPathNodeType :: Element ) ) { $ result = $ this -> indexConcepts ( $ childNav , $ xbrlInstance , $ index , $ name ) ; // $index = array_merge_recursive( $index, $result );
 } } else { $ contextRef = $ nav -> GetAttribute ( "contextRef" , null ) ; $ unitRef = $ nav -> GetAttribute ( "unitRef" , null ) ; $ index [ $ name ] [ $ contextRef ] [ $ unitRef ] [ $ num ] [ ] = $ nav -> CloneInstance ( ) ; } $ flag = $ nav -> MoveToNext ( XPathNodeType :: Element ) ; } while ( $ flag ) ; return $ index ; }
Creates an indexed array of concepts.  The index is concept|contextRef|unitRef => nav
The unit maybe empty if there is no unit
@param DOMXPathNavigator $nav
@param \XBRL_Instance $xbrlInstance
@param array $index (by reference) A list of concepts
@param string $path (by reference)
@return A list of concepts
Creates an indexed array of concepts . The index is concept|contextRef|unitRef = > nav The unit maybe empty if there is no unit