XBRL.php
public function processNodeByPath( &$nodes, &$paths, $node, $successCallback = false, $failureCallback = false )
	{
		$result = true;
		if ( is_null( $nodes ) ) return;

		foreach ( $paths as $pathKey => $path )
		{
			unset( $currentNodes );
			unset( $currentNode );
			unset( $parentNode );

			$currentNodes =& $nodes;
			$currentPath = "";
			$currentNode = false;
			$parentNode = false;

			$pathsParts = explode( '/', $path );
			for ( $i = 0; $i < count( $pathsParts ); $i++ )
			{
				if ( ! isset( $currentNodes[ $pathsParts[ $i ] ] ) )
				{
					// XBRL_Log::getInstance()->err( "This is bad" );
					unset( $currentNodes );
					$currentNodes = false;
					$parentNode = false;
					break;
				}

				$currentNode =& $currentNodes[ $pathsParts[ $i ] ];

				if ( $pathsParts[ $i ] == $node )
				{
					break;
				}

				$parentNode = $currentNode;

				if ( isset( $currentNode['children'] ) )
				{
					$currentNodes =& $currentNode['children'];
				}

			}

			if ( ! $currentNodes )
			{
				if ( $failureCallback )
				{
					$failureCallback( $path );
				}
				else
				{
					XBRL_Log::getInstance()->warning( "There are no current nodes so something went wrong evaluating the path '$path'" );
				}
				continue;
			}

			if ( ! $successCallback ) continue;
			$successCallback( $currentNode, $path, $parentNode === false ? $parentNode : $parentNode['label'] );
		}

		return $result;
	}
public function processNodeByPath( &$nodes, &$paths, $node, $successCallback = false, $failureCallback = false )
	{
		$result = true;
		if ( is_null( $nodes ) ) return;

		foreach ( $paths as $pathKey => $path )
		{
			unset( $currentNodes );
			unset( $currentNode );
			unset( $parentNode );

			$currentNodes =& $nodes;
			$currentPath = "";
			$currentNode = false;
			$parentNode = false;

			$pathsParts = explode( '/', $path );
			for ( $i = 0; $i < count( $pathsParts ); $i++ )
			{
				if ( ! isset( $currentNodes[ $pathsParts[ $i ] ] ) )
				{
					// XBRL_Log::getInstance()->err( "This is bad" );
					unset( $currentNodes );
					$currentNodes = false;
					$parentNode = false;
					break;
				}

				$currentNode =& $currentNodes[ $pathsParts[ $i ] ];

				if ( $pathsParts[ $i ] == $node )
				{
					break;
				}

				$parentNode = $currentNode;

				if ( isset( $currentNode['children'] ) )
				{
					$currentNodes =& $currentNode['children'];
				}

			}

			if ( ! $currentNodes )
			{
				if ( $failureCallback )
				{
					$failureCallback( $path );
				}
				else
				{
					XBRL_Log::getInstance()->warning( "There are no current nodes so something went wrong evaluating the path '$path'" );
				}
				continue;
			}

			if ( ! $successCallback ) continue;
			$successCallback( $currentNode, $path, $parentNode === false ? $parentNode : $parentNode['label'] );
		}

		return $result;
	}
public function processNodeByPath ( & $ nodes , & $ paths , $ node , $ successCallback = false , $ failureCallback = false ) { $ result = true ; if ( is_null ( $ nodes ) ) return ; foreach ( $ paths as $ pathKey => $ path ) { unset ( $ currentNodes ) ; unset ( $ currentNode ) ; unset ( $ parentNode ) ; $ currentNodes = & $ nodes ; $ currentPath = "" ; $ currentNode = false ; $ parentNode = false ; $ pathsParts = explode ( '/' , $ path ) ; for ( $ i = 0 ; $ i < count ( $ pathsParts ) ; $ i ++ ) { if ( ! isset ( $ currentNodes [ $ pathsParts [ $ i ] ] ) ) { // XBRL_Log::getInstance()->err( "This is bad" );
 unset ( $ currentNodes ) ; $ currentNodes = false ; $ parentNode = false ; break ; } $ currentNode = & $ currentNodes [ $ pathsParts [ $ i ] ] ; if ( $ pathsParts [ $ i ] == $ node ) { break ; } $ parentNode = $ currentNode ; if ( isset ( $ currentNode [ 'children' ] ) ) { $ currentNodes = & $ currentNode [ 'children' ] ; } } if ( ! $ currentNodes ) { if ( $ failureCallback ) { $ failureCallback ( $ path ) ; } else { XBRL_Log :: getInstance ( ) -> warning ( "There are no current nodes so something went wrong evaluating the path '$path'" ) ; } continue ; } if ( ! $ successCallback ) continue ; $ successCallback ( $ currentNode , $ path , $ parentNode === false ? $ parentNode : $ parentNode [ 'label' ] ) ; } return $ result ; }
Find all nodes assocated with an array of paths then call a callback when found or not found
@param array $nodes		 		A root node collection in which to find $node
@param array $paths		 		An array of path indices
@param string $node		 		A label representing the node to find
@param function $successCallback	A function to call when a node is located.
Will pass $node, the path to $node and the parent key of $node.
The parent key will be false if $node is the root.
@param function $failureCallback Called if $node is not found in $nodes.  Passes $path.
@return boolean|array	 		An array representing the the node of $node from the $nodes hierarchy
Find all nodes assocated with an array of paths then call a callback when found or not found