Formulas/Resources/Formulas/GeneratedFacts.php
private function addUnits( &$document )
	{
		foreach ( $this->units as $unitRef => $unit )
		{
			$entry = array();
			$entry[] = "  <unit id=\"$unitRef\">";

			if ( isset( $unit['divide'] ) )
			{
				$entry[] = "    <divide>";

				if ( isset( $unit['divide']['numerator'] ) && count( $unit['divide']['numerator'] ) )
				{
					$entry[] = "      <unitNumerator>";

					foreach ( $unit['divide']['numerator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitNumerator>";
				}

				if ( isset( $unit['divide']['denominator'] ) && count( $unit['divide']['denominator'] ) )
				{
					$entry[] = "      <unitDenominator>";

					foreach ( $unit['divide']['denominator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitDenominator>";
				}

				$entry[] = "    </divide>";
			}
			else if ( isset( $unit['measures'] ) )
			{
				foreach ( $unit['measures'] as $measure )
				{
					$entry[] = "    <measure>$measure</measure>";
				}
			}
			else
			{
				$xbrli = STANDARD_PREFIX_XBRLI;
				$unit = str_replace( "{$xbrli}:", "", $unit );
				$entry[] = "    <measure>$unit</measure>";
			}
			$entry[] = "  </unit>";
			$entry[] = "";

			$document[] = implode( "\n", $entry );
		}
	}
private function addUnits( &$document )
	{
		foreach ( $this->units as $unitRef => $unit )
		{
			$entry = array();
			$entry[] = "  <unit id=\"$unitRef\">";

			if ( isset( $unit['divide'] ) )
			{
				$entry[] = "    <divide>";

				if ( isset( $unit['divide']['numerator'] ) && count( $unit['divide']['numerator'] ) )
				{
					$entry[] = "      <unitNumerator>";

					foreach ( $unit['divide']['numerator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitNumerator>";
				}

				if ( isset( $unit['divide']['denominator'] ) && count( $unit['divide']['denominator'] ) )
				{
					$entry[] = "      <unitDenominator>";

					foreach ( $unit['divide']['denominator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitDenominator>";
				}

				$entry[] = "    </divide>";
			}
			else if ( isset( $unit['measures'] ) )
			{
				foreach ( $unit['measures'] as $measure )
				{
					$entry[] = "    <measure>$measure</measure>";
				}
			}
			else
			{
				$xbrli = STANDARD_PREFIX_XBRLI;
				$unit = str_replace( "{$xbrli}:", "", $unit );
				$entry[] = "    <measure>$unit</measure>";
			}
			$entry[] = "  </unit>";
			$entry[] = "";

			$document[] = implode( "\n", $entry );
		}
	}
private function addUnits ( & $ document ) { foreach ( $ this -> units as $ unitRef => $ unit ) { $ entry = array ( ) ; $ entry [ ] = "  <unit id=\"$unitRef\">" ; if ( isset ( $ unit [ 'divide' ] ) ) { $ entry [ ] = "    <divide>" ; if ( isset ( $ unit [ 'divide' ] [ 'numerator' ] ) && count ( $ unit [ 'divide' ] [ 'numerator' ] ) ) { $ entry [ ] = "      <unitNumerator>" ; foreach ( $ unit [ 'divide' ] [ 'numerator' ] as $ measure ) { $ entry [ ] = "        <measure>$measure</measure>" ; } $ entry [ ] = "      </unitNumerator>" ; } if ( isset ( $ unit [ 'divide' ] [ 'denominator' ] ) && count ( $ unit [ 'divide' ] [ 'denominator' ] ) ) { $ entry [ ] = "      <unitDenominator>" ; foreach ( $ unit [ 'divide' ] [ 'denominator' ] as $ measure ) { $ entry [ ] = "        <measure>$measure</measure>" ; } $ entry [ ] = "      </unitDenominator>" ; } $ entry [ ] = "    </divide>" ; } else if ( isset ( $ unit [ 'measures' ] ) ) { foreach ( $ unit [ 'measures' ] as $ measure ) { $ entry [ ] = "    <measure>$measure</measure>" ; } } else { $ xbrli = STANDARD_PREFIX_XBRLI ; $ unit = str_replace ( "{$xbrli}:" , "" , $ unit ) ; $ entry [ ] = "    <measure>$unit</measure>" ; } $ entry [ ] = "  </unit>" ; $ entry [ ] = "" ; $ document [ ] = implode ( "\n" , $ entry ) ; } }
An array to which unit information should be added
@param array $document (passed by reference)
An array to which unit information should be added