Formulas/Resources/Formulas/GeneratedFacts.php
private function addContexts( &$document, $xbrldiPrefix )
	{
		foreach ( $this->contexts as $contextRef => $context )
		{
			$document[] = "  <context id=\"$contextRef\">";

			if ( isset( $context['entity'] ) )
			{
				$document[] = "    <entity>";

				if ( isset( $context['entity']['identifier'] ) )
				{
					$document[] = "      <identifier scheme=\"{$context['entity']['identifier']['scheme']}\">{$context['entity']['identifier']['value']}</identifier>";
				}

				if ( isset( $context['entity']['segment'] ) )
				{
					$this->addComponent( "segment", $context['entity']['segment'], $document, "      ", $xbrldiPrefix );
				}

				if ( isset( $context['entity']['scenario'] ) )
				{
					$this->addComponent( "scenario", $context['entity']['scenario'], $document, "    ", $xbrldiPrefix );
				}

				$document[] = "    </entity>";
			}

			if ( isset( $context['period'] ) )
			{
				$document[] = "    <period>";

				if ( $context['period']['is_instant'] )
				{
					$document[] = "      <instant>{$context['period']['startDate']}</instant>";
				}
				else if ( isset( $context['period']['type'] ) && $context['period']['type'] == 'forever' )
				{
					$document[] = "      <forever/>";
				}
				else if ( isset( $context['period']['type'] ) && $context['period']['type'] == 'duration' )
				{
					$document[] = "      <startDate>{$context['period']['startDate']}</startDate>";
					$document[] = "      <endDate>{$context['period']['endDate']}</endDate>";
				}
				$document[] = "    </period>";
			}

			if ( isset( $context['segment'] ) )
			{
				$this->addComponent( "segment", $context['segment'], $document, "    ", $xbrldiPrefix );
			}

			if ( isset( $context['scenario'] ) )
			{
				$this->addComponent( "scenario", $context['scenario'], $document, "  ", $xbrldiPrefix );
			}

			$document[] = "  </context>";
			$document[] = "";
		}
	}
private function addContexts( &$document, $xbrldiPrefix )
	{
		foreach ( $this->contexts as $contextRef => $context )
		{
			$document[] = "  <context id=\"$contextRef\">";

			if ( isset( $context['entity'] ) )
			{
				$document[] = "    <entity>";

				if ( isset( $context['entity']['identifier'] ) )
				{
					$document[] = "      <identifier scheme=\"{$context['entity']['identifier']['scheme']}\">{$context['entity']['identifier']['value']}</identifier>";
				}

				if ( isset( $context['entity']['segment'] ) )
				{
					$this->addComponent( "segment", $context['entity']['segment'], $document, "      ", $xbrldiPrefix );
				}

				if ( isset( $context['entity']['scenario'] ) )
				{
					$this->addComponent( "scenario", $context['entity']['scenario'], $document, "    ", $xbrldiPrefix );
				}

				$document[] = "    </entity>";
			}

			if ( isset( $context['period'] ) )
			{
				$document[] = "    <period>";

				if ( $context['period']['is_instant'] )
				{
					$document[] = "      <instant>{$context['period']['startDate']}</instant>";
				}
				else if ( isset( $context['period']['type'] ) && $context['period']['type'] == 'forever' )
				{
					$document[] = "      <forever/>";
				}
				else if ( isset( $context['period']['type'] ) && $context['period']['type'] == 'duration' )
				{
					$document[] = "      <startDate>{$context['period']['startDate']}</startDate>";
					$document[] = "      <endDate>{$context['period']['endDate']}</endDate>";
				}
				$document[] = "    </period>";
			}

			if ( isset( $context['segment'] ) )
			{
				$this->addComponent( "segment", $context['segment'], $document, "    ", $xbrldiPrefix );
			}

			if ( isset( $context['scenario'] ) )
			{
				$this->addComponent( "scenario", $context['scenario'], $document, "  ", $xbrldiPrefix );
			}

			$document[] = "  </context>";
			$document[] = "";
		}
	}
private function addContexts ( & $ document , $ xbrldiPrefix ) { foreach ( $ this -> contexts as $ contextRef => $ context ) { $ document [ ] = "  <context id=\"$contextRef\">" ; if ( isset ( $ context [ 'entity' ] ) ) { $ document [ ] = "    <entity>" ; if ( isset ( $ context [ 'entity' ] [ 'identifier' ] ) ) { $ document [ ] = "      <identifier scheme=\"{$context['entity']['identifier']['scheme']}\">{$context['entity']['identifier']['value']}</identifier>" ; } if ( isset ( $ context [ 'entity' ] [ 'segment' ] ) ) { $ this -> addComponent ( "segment" , $ context [ 'entity' ] [ 'segment' ] , $ document , "      " , $ xbrldiPrefix ) ; } if ( isset ( $ context [ 'entity' ] [ 'scenario' ] ) ) { $ this -> addComponent ( "scenario" , $ context [ 'entity' ] [ 'scenario' ] , $ document , "    " , $ xbrldiPrefix ) ; } $ document [ ] = "    </entity>" ; } if ( isset ( $ context [ 'period' ] ) ) { $ document [ ] = "    <period>" ; if ( $ context [ 'period' ] [ 'is_instant' ] ) { $ document [ ] = "      <instant>{$context['period']['startDate']}</instant>" ; } else if ( isset ( $ context [ 'period' ] [ 'type' ] ) && $ context [ 'period' ] [ 'type' ] == 'forever' ) { $ document [ ] = "      <forever/>" ; } else if ( isset ( $ context [ 'period' ] [ 'type' ] ) && $ context [ 'period' ] [ 'type' ] == 'duration' ) { $ document [ ] = "      <startDate>{$context['period']['startDate']}</startDate>" ; $ document [ ] = "      <endDate>{$context['period']['endDate']}</endDate>" ; } $ document [ ] = "    </period>" ; } if ( isset ( $ context [ 'segment' ] ) ) { $ this -> addComponent ( "segment" , $ context [ 'segment' ] , $ document , "    " , $ xbrldiPrefix ) ; } if ( isset ( $ context [ 'scenario' ] ) ) { $ this -> addComponent ( "scenario" , $ context [ 'scenario' ] , $ document , "  " , $ xbrldiPrefix ) ; } $ document [ ] = "  </context>" ; $ document [ ] = "" ; } }
An array to which context information should be added
@param array $document (passed by reference)
@param string $xbrldiPrefix
An array to which context information should be added