Formulas/Resources/Formulas/Formula.php
private function getUnitAspectValue( $source, $evaluationResult, $log )
	{
		// Get the unit from the source
		if ( is_null( $this->unitRule ) )
		{
			if ( ! $this->source )
			{
				return false;
			}

			$sourceFact = $this->getSourceFactWithErrorLogging( $source, $evaluationResult, ASPECT_UNIT, $log );
			$unitRef = FactValues::getUnitRef( $sourceFact );

			if ( ! $unitRef ) return null;

			// TODO What is in the $unit array
			$unit = $this->xbrlInstance->getUnit( $unitRef );
			return array( $unitRef => $unit );
		}
		else
		{
			/**
			 * @var Unit $unit
			 */
			$unit = Unit::fromArray( $this->unitRule );
			// This function will throw an exception if there is a problem so there is no return value to check
			$this->checkSAVConflicts( $unit->source, ASPECT_UNIT, $evaluationResult, $log );
			return $unit->getValue( $this, $evaluationResult, $log );
		}

	}
private function getUnitAspectValue( $source, $evaluationResult, $log )
	{
		// Get the unit from the source
		if ( is_null( $this->unitRule ) )
		{
			if ( ! $this->source )
			{
				return false;
			}

			$sourceFact = $this->getSourceFactWithErrorLogging( $source, $evaluationResult, ASPECT_UNIT, $log );
			$unitRef = FactValues::getUnitRef( $sourceFact );

			if ( ! $unitRef ) return null;

			// TODO What is in the $unit array
			$unit = $this->xbrlInstance->getUnit( $unitRef );
			return array( $unitRef => $unit );
		}
		else
		{
			/**
			 * @var Unit $unit
			 */
			$unit = Unit::fromArray( $this->unitRule );
			// This function will throw an exception if there is a problem so there is no return value to check
			$this->checkSAVConflicts( $unit->source, ASPECT_UNIT, $evaluationResult, $log );
			return $unit->getValue( $this, $evaluationResult, $log );
		}

	}
private function getUnitAspectValue ( $ source , $ evaluationResult , $ log ) { // Get the unit from the source
 if ( is_null ( $ this -> unitRule ) ) { if ( ! $ this -> source ) { return false ; } $ sourceFact = $ this -> getSourceFactWithErrorLogging ( $ source , $ evaluationResult , ASPECT_UNIT , $ log ) ; $ unitRef = FactValues :: getUnitRef ( $ sourceFact ) ; if ( ! $ unitRef ) return null ; // TODO What is in the $unit array
 $ unit = $ this -> xbrlInstance -> getUnit ( $ unitRef ) ; return array ( $ unitRef => $ unit ) ; } else { /**
			 * @var Unit $unit
			 */ $ unit = Unit :: fromArray ( $ this -> unitRule ) ; // This function will throw an exception if there is a problem so there is no return value to check
 $ this -> checkSAVConflicts ( $ unit -> source , ASPECT_UNIT , $ evaluationResult , $ log ) ; return $ unit -> getValue ( $ this , $ evaluationResult , $ log ) ; } }
Get the unit to be used for this fact.  If a unit rule does not exist, use the formula source value
@param string $source
@param array $evaluationResult
@param \XBRL_Log $log
@return array|null
Get the unit to be used for this fact . If a unit rule does not exist use the formula source value