XBRL.php
private function promoteToPrimaryItem( $memberId, $parentId, &$newPrimaryItems, &$targetMembers, $targetRoleUri )
	{
		// Might have been promoted already because its also a child of another member
		if ( ! isset( $targetMembers[ $memberId ] ) ) return;

		if ( ! $parentId ) $parentId = $memberId;

		// Might already exist as a primary item
		if ( isset( $newPrimaryItems[ $memberId ] ) )
		{
			// In which case add a parent reference
			if ( $parentId != $memberId )
			{
				$newPrimaryItems[ $memberId ]['parents'][ $parentId ] = $targetMembers[ $memberId ]['parents'][ $parentId ];
			}
			$newPrimaryItems[ $memberId ]['roleUri'] = $targetRoleUri;
			return;
		}

		if ( ! isset( $newPrimaryItems[ $parentId ] ) )
		{
			XBRL_Log::getInstance()->warning( "Error trying to promote a member '$memberId' to primary item." );
			return;
		}

		$newPrimaryItems[ $memberId ] = array(
			'arcrole' => $targetMembers[ $memberId ]['parents'][ $parentId ]['arcrole'],
			'hypercubes' => array(), // $newPrimaryItems[ $parentId ]['hypercubes'],
			'parents' => array(
				$parentId => $targetMembers[ $memberId ]['parents'][ $parentId ],
			),
			'roleUri' => $targetRoleUri,
		);
	}
private function promoteToPrimaryItem( $memberId, $parentId, &$newPrimaryItems, &$targetMembers, $targetRoleUri )
	{
		// Might have been promoted already because its also a child of another member
		if ( ! isset( $targetMembers[ $memberId ] ) ) return;

		if ( ! $parentId ) $parentId = $memberId;

		// Might already exist as a primary item
		if ( isset( $newPrimaryItems[ $memberId ] ) )
		{
			// In which case add a parent reference
			if ( $parentId != $memberId )
			{
				$newPrimaryItems[ $memberId ]['parents'][ $parentId ] = $targetMembers[ $memberId ]['parents'][ $parentId ];
			}
			$newPrimaryItems[ $memberId ]['roleUri'] = $targetRoleUri;
			return;
		}

		if ( ! isset( $newPrimaryItems[ $parentId ] ) )
		{
			XBRL_Log::getInstance()->warning( "Error trying to promote a member '$memberId' to primary item." );
			return;
		}

		$newPrimaryItems[ $memberId ] = array(
			'arcrole' => $targetMembers[ $memberId ]['parents'][ $parentId ]['arcrole'],
			'hypercubes' => array(), // $newPrimaryItems[ $parentId ]['hypercubes'],
			'parents' => array(
				$parentId => $targetMembers[ $memberId ]['parents'][ $parentId ],
			),
			'roleUri' => $targetRoleUri,
		);
	}
private function promoteToPrimaryItem ( $ memberId , $ parentId , & $ newPrimaryItems , & $ targetMembers , $ targetRoleUri ) { // Might have been promoted already because its also a child of another member
 if ( ! isset ( $ targetMembers [ $ memberId ] ) ) return ; if ( ! $ parentId ) $ parentId = $ memberId ; // Might already exist as a primary item
 if ( isset ( $ newPrimaryItems [ $ memberId ] ) ) { // In which case add a parent reference
 if ( $ parentId != $ memberId ) { $ newPrimaryItems [ $ memberId ] [ 'parents' ] [ $ parentId ] = $ targetMembers [ $ memberId ] [ 'parents' ] [ $ parentId ] ; } $ newPrimaryItems [ $ memberId ] [ 'roleUri' ] = $ targetRoleUri ; return ; } if ( ! isset ( $ newPrimaryItems [ $ parentId ] ) ) { XBRL_Log :: getInstance ( ) -> warning ( "Error trying to promote a member '$memberId' to primary item." ) ; return ; } $ newPrimaryItems [ $ memberId ] = array ( 'arcrole' => $ targetMembers [ $ memberId ] [ 'parents' ] [ $ parentId ] [ 'arcrole' ] , 'hypercubes' => array ( ) , // $newPrimaryItems[ $parentId ]['hypercubes'],
 'parents' => array ( $ parentId => $ targetMembers [ $ memberId ] [ 'parents' ] [ $ parentId ] , ) , 'roleUri' => $ targetRoleUri , ) ; }
Converts a member definition in a target role into a primary item definition in a new role

@param string $memberId The id of the member to be promoted
@param string $parentId The id of the member's parent.  May be 'false' if the member and parent ids are the same
@param array $newPrimaryItems An array of elements representing the new role being created
@param array $targetMembers An array of elements representing the role being merged
@param array $targetRoleUri The uri of the target role
Converts a member definition in a target role into a primary item definition in a new role