Provides a binding the chance to set a fallback value and return true or return false
Set a fallback value for the related variable if it has a fallback value
@param VariableSet $variableSet
@param bool alwaysUseFallbackValue
@return boolean
335470
public function setFallbackValue( $variableSet, $alwaysUseFallbackValue = false )
	{
		if ( is_null( $this->var->fallbackValue ) ) return false;
		if ( ! $alwaysUseFallbackValue && ! is_null( $this->facts ) ) return false;

		$this->facts = null;

		$vars = $variableSet->getParametersAsVars();

		// Evaluate the fallback value.  Should return an XPath2Item
		$fallbackResult = $this->var->evaluateXPath( $variableSet, $this->var->fallbackValue, $vars );
		$this->yieldedFact = $fallbackResult;
		$this->isFallback = true;

		return true;
	}
332503
public function toQuery( $variableSet, $factVariableBinding )
	{
		$expressions = array();

		// Include the qnames if being called as part of a boolean filter or there are qname expressions
		if ( $this->inBoolean || $this->qnameExpressions )
		foreach ( $this->qnames as $qname )
		{
			$name = qname( $qname );
			$expressions[] = "(fn:node-name(..) eq fn:QName('{$name->namespaceURI}','{$name->localName}'))";
		}

		foreach ( $this->qnameExpressions as $qnameExpression )
		{
			$expressions[] = "(fn:node-name(..) eq {$qnameExpression})";
		}

		return implode( " or ", $expressions );
	}
381535
public function use_fallback($boolean = NULL)
	{
		if ($boolean === NULL)
		{
			return $this->_use_fallback;
		}
		$this->_use_fallback = $boolean;
		return $this;
	}
242000
public function getLabelMeta($property = null, $fallbackValue = "")
    {
        if (is_null($property)) {
            $varReturn = $this->__labelmeta;
        } elseif (isset($this->__labelmeta[$property])
            && !is_null($this->__labelmeta[$property])
        ) {
            $varReturn = $this->__labelmeta[$property];
        } else {
            $varReturn = $fallbackValue;
        }

        return $varReturn;
    }
803092
public function getValue( $variableSet, $evaluationResult, $log )
	{
		// Should already have been validated that if there is no source, there MUST be a complete entity identifier aspect is defined.
		if ( $this->source )
		{
			$sourceFact = $variableSet->getSourceFact( $this->source, $evaluationResult, ASPECT_ENTITY_IDENTIFIER, $log );
			if ( is_null( $sourceFact ) )
			{
				$source = is_array( $this->source ) ? "{$this->source['originalPrefix']}:{$this->source['name']}" : $this->source;
				$log->formula_validation( "Formula", "Invalid or missing source fact for entity identifier",
					array(
						'source' => $source,
						'error' => 'xbrlfe:undefinedSAV'
					)
				);
			}

			$contextRef = FactValues::getContextRef( $sourceFact );
			if ( ! $contextRef ) return null;
			$context = $variableSet->xbrlInstance->getContext( $contextRef );
			$identifier = isset( $context['entity']['identifier'] )
				? $context['entity']['identifier']
				: array();
		}

		if ( $this->scheme )
		{
			$result = $this->evaluateXPath( $variableSet, "{$this->scheme} cast as xs:string", $evaluationResult['vars'] );
			$identifier['scheme'] = is_object( $result ) ? $result->getValue() : $result;
		}

		if ( $this->value )
		{
			$result = $this->evaluateXPath( $variableSet, "({$this->value}) cast as xs:string", $evaluationResult['vars'] );
			$identifier['value'] = is_object( $result ) ? $result->getValue() : $result;
		}

		return $identifier;
	}
739694
public function validate( $variableSet, $nsMgr )
	{
		$log = \XBRL_Log::getInstance();

		try
		{
			if ( isset( $this->value ) && ! empty( $this->value ) )
			{
				$expression = XPath2Expression::Compile( $this->value, $nsMgr );
				$this->valueXPath2expression = $expression;

				if ( ! $this->source && ! $this->unitRule )
				{
					$qnames = $expression->getParameterQNames();
					$vars = array();
					foreach( $qnames as $qname )
					{
						$vars[ $qname->clarkNotation() ] = 1;
					}
					$resultType = $expression->GetResultType( $vars );

					// If the result is number then there MUST be a unit rule
					if ( $resultType == XPath2ResultType::Number )
					{
						$log->formula_validation( "Formula", "A formula with a numeric result MUST have a unit rule",
							array(
								'error' => 'xbrlfe:missingUnitRule'
							)
						);
					}
				}
			}
		}
		catch ( XPath2Exception $ex )
		{
			// BMS 2018-03-27 Test 21201 V-01 requires that this compile failure return xbrlve:noCustomFunctionSignature
			//				  because the custom function my-own:ending-balance does not exist
			$log->formula_validation( "Formula", "Failed to compile value expression",
				array(
					'formula' => $this->label,
					'value' => $this->value,
					'error' => $ex->ErrorCode == 'XPST0017' ? "xbrlve:noCustomFunctionSignature" : $ex->ErrorCode,
					'reason' => $ex->getMessage()
				)
			);

			return false;

		}
		catch ( FormulasException $ex )
		{
			throw $ex;
		}
		catch ( \Exception $ex )
		{
			// BMS 2018-03-27 Test 21201 V-01 requires that this compile failure return xbrlve:noCustomFunctionSignature
			//				  becauase the custom function my-own:ending-balance does not exist
			$log->formula_validation( "Formula", "Failed to compile value expression",
				array(
					'formula' => $this->label,
					'value' => $this->value,
					'error' => $ex instanceof XPath2Exception ? ( $ex->ErrorCode == 'XPST0017' ? "err:XPST0017" : $ex->ErrorCode ) : get_class( $ex ),
					'reason' => $ex->getMessage()
				)
			);

			return false;
		}

		if ( $this->tupleLocationRule )
		{
			// The name given in the rule MUST be one of the scope dependency indexes
			if ( ! isset( $this->scopeDependencies[ $this->tupleLocationRule ] ) )
			{
				// Not valid so remove the rule
				$log->warning( "The tuple loctation rule ({$this->tupleLocationRule}) on formula '{$this->label}' does not match the name on a variable scope arc so will be ignored." );
				$this->tupleLocationRule = null;
			}

		}

		if ( $this->decimalsRule && ! is_numeric( $this->precisionRule ) )
		{
			try
			{
				$xpath2Expression = XPath2Expression::Compile( $this->decimalsRule, $nsMgr );
			}
			catch ( XPath2Exception $ex )
			{
				\XBRL_Log::getInstance()->formula_validation( "Formula decimal value", "Failed to compile expression",
					array(
						'qname expression' => $this->decimalsRule,
						'error' => $ex instanceof XPath2Exception ? ( $ex->ErrorCode == 'XPST0017' ? "xbrlve:noCustomFunctionSignature" : $ex->ErrorCode ) : get_class( $ex ),
						'reason' => $ex->getMessage()
					)
				);
			}
			catch ( \Exception $ex )
			{
				// BMS 2018-03-27 Test 21201 V-02 requires that this compile failure return xbrlve:noCustomFunctionSignature
				//				  becauase the custom function my-own:ending-balance does not exist
				\XBRL_Log::getInstance()->formula_validation( "Formula decimal value", "Failed to compile expression",
					array(
						'qname expression' => $this->decimalsRule,
						'error' => $ex instanceof XPath2Exception ? ( $ex->ErrorCode == 'XPST0017' ? "err:XPST0017" : $ex->ErrorCode ) : get_class( $ex ),
						'reason' => $ex->getMessage()
					)
				);
			}
		}

		if ( $this->precisionRule && ! is_numeric( $this->precisionRule ) )
		{
			try
			{
				$xpath2Expression = XPath2Expression::Compile( $this->precisionRule, $nsMgr );
			}
			catch ( XPath2Exception $ex )
			{
				\XBRL_Log::getInstance()->formula_validation( "Formula precision value", "Failed to compile expression",
					array(
						'qname expression' => $this->precisionRule,
						'error' => $ex instanceof XPath2Exception ? ( $ex->ErrorCode == 'XPST0017' ? "xbrlve:noCustomFunctionSignature" : $ex->ErrorCode ) : get_class( $ex ),
						'reason' => $ex->getMessage()
					)
				);
			}
			catch ( \Exception $ex )
			{
				// BMS 2018-03-27 Test 21201 V-01 requires that this compile failure return xbrlve:noCustomFunctionSignature
				//				  becauase the custom function my-own:ending-balance does not exist
				\XBRL_Log::getInstance()->formula_validation( "Formula precision value", "Failed to compile expression",
					array(
						'qname expression' => $this->precisionRule,
						'error' => $ex instanceof XPath2Exception ? ( $ex->ErrorCode == 'XPST0017' ? "err:XPST0017" : $ex->ErrorCode ) : get_class( $ex ),
						'reason' => $ex->getMessage()
					)
				);
			}
		}

		// If there is no source then concept MUST be explicitly declared
		if ( is_null( $this->source ) )
		{
			if ( is_null( $this->conceptRule ) )
			{
				$log->formula_validation( "Formula", "If there is no source then a concept aspect rule MUST be explicitly declared but is not provided",
					array(
						'formula' => $this->label,
						'error' => 'xbrlfe:missingConceptRule'
					)
				);
			}

			if ( is_null( $this->entityIdentifierRule ) )
			{
				$log->formula_validation( "Formula", "If there is no source then an entity aspect rule MUST be explicitly declared but is not provided",
					array(
						'formula' => $this->label,
						'error' => 'xbrlfe:missingEntityIdentifierRule'
					)
				);
			}

			if ( is_null( $this->periodRule ) )
			{
				$log->formula_validation( "Formula", "If there is no source then an period aspect rule MUST be explicitly declared but is not provided",
					array(
						'formula' => $this->label,
						'error' => 'xbrlfe:missingPeriodRule'
					)
				);
			}

			// Create a qname from either the qname or the expression
			/**
			 * @var QName $qname
			 */
			$qname = null;
			if ( $this->conceptRule['qnameExpression'] )
			{
				foreach ( $this->conceptRule['qnameExpression'] as $qnameExpression )
				{
					// Check any variables in the expression are valid
					$expression = XPath2Expression::Compile( $qnameExpression, $this->nsMgr );
					$variableRefs = $expression->getParameterQNames();
					foreach ( $variableRefs as $variableQName )
					{
						if ( ! isset( $this->variablesByQName[ $variableQName->clarkNotation() ] ) )
						{
							$log->formula_validation( "Concept rule", "The variable reference in the concept rule qname expression is not to a valid variable",
								array(
									'formula' => $this->label,
									'variable reference' => $variableQName->clarkNotation(),
									'error' => 'xbrlfe:conceptExpressionInvalid'
								)
							);
						}
					}
				}
			}
			else
			{
				$qname = new QName( $this->conceptRule['qname'][0]['originalPrefix'], $this->conceptRule['qname'][0]['namespace'], $this->conceptRule['qname'][0]['name'] );

				// BMS 2018-03-19 Must have been having too many mince pies.  These tests are relevant whenever there is a known concept.
				// 				  They have been moved lower down
				// BMS 2018-01-05 Now not sure why these tests are needed.
	 			// Next find out if the qname refers to a variable.  If it does look for a filter that defines a concept
	 			// Begin by assuming the qname refers to a taxonomy element
	 			$concept = $qname;
	 			if ( isset( $this->variablesByQName[ $concept->clarkNotation() ] ) )
	 			{
	 				/**
	 				 * @var ConceptName $selectedFilter
	 				 */
	 				$selectedFilter = null;
	 				foreach ( $this->variablesByQName[ $concept->clarkNotation() ]->filters as $filter )
	 				{
	 					if ( ! $filter instanceof ConceptName ) continue;
	 					$selectedFilter = $filter;
	 					break;
	 				}

	 				if ( $selectedFilter )
	 				{
						$concept = null;
						$totalFilters = count( $selectedFilter->qnames ) + count( $selectedFilter->qnameExpressions );
						if ( $totalFilters == 1 )
						{
							// It's one of these
							foreach ( $selectedFilter->qnames as $filterQName )
							{
								$concept = qname( $filterQName );
								$taxonomy = $this->xbrlTaxonomy->getTaxonomyForNamespace( $concept->namespaceURI );
								$concept->prefix = $taxonomy->getPrefix();
							}

							if ( ! $concept )
							{
								foreach ( $selectedFilter->qnameExpressions as $filterQNameExpression )
				 				{
									$result = $this->evaluateXPath( $this, $this->conceptRule->$filterQNameExpression );
									$concept = new QName( $result->Prefix, $result->NamespaceUri, $result->LocalName );
			 					}
							}
						}

						if ( $totalFilters != 1 || ! $concept )
						{
							$log->formula_validation( "Formula", "There is no formula source but the concept aspect rule does not define a reference to a schema element",
								array(
									'formula' => $this->label,
									'error' => 'xbrlfe:missingConceptRule'
								)
							);
						}
	 				}
	 				else
	 				{
	 					// If the concept references a variable and there is no filter then the
	 					// the concept cannot be resolved statically.
	 					$concept = null;
	 				}
				}

				if ( $concept )
				{
					// BMS 2017-12-24 Move the following tests here because surely they are only relevant when there is no formula source
					/**
					 * @var SchemaTypes $types
					 */
					$types = \XBRL_Types::getInstance();
					$conceptElement = $this->xbrlTaxonomy->getElementByName( $concept->localName );
					// Or could do it this way
					// $conceptElement = $types->getElement( $this->conceptRule['qname'][0]['name'], $this->conceptRule['qname'][0]['originalPrefix'] );
					// $isNumeric = $types->resolvesToBaseType( $conceptElement['types'][0], array( 'xs:decimal', 'xs:decimal' ) );
					if ( ! $conceptElement )
					{
						$log->formula_validation( "Formula", "The concept provided by the concept aspect rule is not a valid schema element",
							array(
								'formula' => $label,
								'error' => 'xbrlfe:missingConceptRule'
							)
						);
					}

					// BMS 2018-04-09 Extra test candidate not required any more but it doesn't hurt.
					$isNumeric = $types->resolvesToBaseType( $conceptElement['type'], array( 'xs:decimal', 'xsd:decimal' ) );
					if ( is_null( $this->source ) && is_null( $this->unitRule ) )
					{
						// Check to see if the concept references a numeric type
						if ( $isNumeric )
						{
							$log->formula_validation( "Formula", "If there is no source and the concept references a numeric type then a unit aspect rule MUST be explicitly declared but is not provided",
								array(
									'formula' => $this->label,
									'error' => 'xbrlfe:missingUnitRule'
								)
							);
						}
					}
					else if ( ! is_null( $this->unitRule ) )
					{
						if ( ! $isNumeric )
						{
							$log->formula_validation( "Formula", "The concept aspect rule defines a non-numeric concept so a unit is not valid",
								array(
									'formula' => $this->label,
									'error' => 'xbrlfe:conflictingAspectRules'
								)
							);
						}
					}

					// BMS 2018-03-19 Don't know why this is here when it is defined below
					// // Make sure there is no conflict between the concept and period aspect rule
					// if ( ! is_null( $this->periodRule ) )
					// {
					// 	if ( ! is_null( $this->periodRule['rav'] ) && $this->periodRule['rav'] != $conceptElement['periodType'] )
					// 	{
					// 		$log->formula_validation( "Formula", "The type of the period aspect rule conflicts with the period type of the concept aspect rule",
					// 			array(
					// 				'period aspect type' => $this->periodRule['rav'],
					// 				'concept period type' => $conceptElement['periodType'],
					// 				'formula' => $this->label,
					// 				'error' => 'xbrlfe:conflictingAspectRules'
					// 			)
					// 		);
					// 	}
					// }
				}
			}
		}
		else // $source is not null
		{
			$sourceQName = new QName( $this->source['originalPrefix'], $this->source['namespace'], $this->source['name'] );

			// If the if the source is not the uncovered qname make sure the referenced variable exists
			// if ( $sourceQName->namespaceURI != \XBRL_Constants::$standardPrefixes[ STANDARD_PREFIX_FORMULA ] ||
			//	 $sourceQName->localName != "uncovered" )
			if ( ! $this->getIsFormulaUncoveredQName( $sourceQName ) )
			{
				if ( ! isset( $this->variablesByQName[ $sourceQName->clarkNotation() ] ) ||
					 ! $this->variablesByQName[ $sourceQName->clarkNotation() ] instanceof FactVariable
				)
				{
					$log->formula_validation( "Formula", "",
						array(
							'concept' => $sourceQName->prefix ? "{$sourceQName->prefix}:{$sourceQName->localName}" : $sourceQName->localName,
							'formula' => $this->label,
							'error' => 'xbrlfe:nonexistentSourceVariable',
						)
					);
				}

				/**
				 * Look for the variable
				 * @var FactVariable $variable
				 */
				$variable = $this->variablesByQName[ $sourceQName->clarkNotation() ];
				if ( $variable->bindAsSequence )
				{
					// TODO Should check the XPath implied by the fallback value but, for now,
					//	    copy Arelle and fail if there is any fallback value
					$log->formula_validation( "Formula", "Formula source is a fact variable that binds as a sequence",
						array(
							'formula' => $this->label,
							'source' => $sourceQName->prefix ? "{$sourceQName->prefix}:{$sourceQName->localName}" : $sourceQName->localName,
							'error' => 'xbrlfe:defaultAspectValueConflicts',
						)
					);
				}
			}

			if ( $this->conceptRule['qname'] )
			{
				// BMS 2015-03-26
				// If the concept rule is really a source then the qname will reference a variable so reset
				$concept = new QName( $this->conceptRule['qname'][0]['originalPrefix'], $this->conceptRule['qname'][0]['namespace'], $this->conceptRule['qname'][0]['name'] );
				if ( isset( $this->variablesByQName[ $concept->clarkNotation() ] ) )
				{
					$concept = null;
				}
			}
		}

		if ( isset( $concept ) )
		{
			// BMS 2018-03-19 Must have been having too many mince pies.  These tests are relevant whenever there is a known concept.
			// 				  So they belong here.
			// BMS 2017-12-24 Move the following tests here because surely they are only relevant when there is no formula source
			$types = \XBRL_Types::getInstance();
			$conceptElement = $this->xbrlTaxonomy->getElementByName( $concept->localName );
			// Or could do it this way
			// $conceptElement = $types->getElement( $this->conceptRule['qname'][0]['name'], $this->conceptRule['qname'][0]['originalPrefix'] );
			// $isNumeric = $types->resolvesToBaseType( $conceptElement['types'][0], array( 'xs:decimal', 'xsd:decimal' ) );
			if ( ! $conceptElement )
			{
				$log->formula_validation( "Formula", "The concept provided by the concept aspect rule is not a valid schema element",
					array(
						'formula' => $label,
						'error' => 'xbrlfe:missingConceptRule'
					)
				);
			}

			// BMS 2018-04-09 Extra test candidate not required any more but it doesn't hurt.
			$isNumeric = $types->resolvesToBaseType( $conceptElement['type'], array( 'xs:decimal', 'xsd:decimal' ) );
			if ( is_null( $this->source ) && is_null( $this->unitRule ) )
			{
				// Check to see if the concept references a numeric type
				if ( $isNumeric )
				{
					$log->formula_validation( "Formula", "If there is no source and the concept references a numeric type then a unit aspect rule MUST be explicitly declared but is not provided",
						array(
							'formula' => $this->label,
							'error' => 'xbrlfe:missingUnitRule'
						)
					);
				}
			}
			else if ( ! is_null( $this->unitRule ) )
			{
				if ( ! $isNumeric )
				{
					$log->formula_validation( "Formula", "The concept aspect rule defines a non-numeric concept so a unit is not valid",
						array(
							'formula' => $this->label,
							'error' => 'xbrlfe:conflictingAspectRules'
						)
					);
				}
			}

			// Make sure there is no conflict between the concept and period aspect rule
			if ( ! is_null( $this->periodRule ) )
			{
				if ( ! is_null( $this->periodRule['rav'] ) && $this->periodRule['rav'] != $conceptElement['periodType'] )
				{
					$log->formula_validation( "Formula", "The type of the period aspect rule conflicts with the period type of the concept aspect rule",
						array(
							'period aspect type' => $this->periodRule['rav'],
							'concept period type' => $conceptElement['periodType'],
							'formula' => $this->label,
							'error' => 'xbrlfe:conflictingAspectRules'
						)
					);
				}
			}

		}

		$sources = $this->getAspectSources();
		foreach ( $sources as $ruleName => $source )
		{
			if ( $this->getIsFormulaUncoveredQName( $source ) ) continue;

			$sourceQName = new QName( $source['originalPrefix'], $source['namespace'], $source['name'] );
			/**
			 * Look for the variable
			 * @var FactVariable $variable
			 */
			$variable = $this->variablesByQName[ $sourceQName->clarkNotation() ];
			if ( ! $variable->fallbackValue ) continue;

			// TODO Should check the XPath implied by the fallback value but, for now,
			//	    copy Arelle and fail if there is any fallback value
			$log->formula_validation( "Formula aspects", "Formula source is a fact variable that has a fallback value",
				array(
					'formula' => $this->label,
					'rule' => $ruleName,
					'error' => 'xbrlfe:bindEmptySourceVariable',
				)
			);
		}

		return true;
	}
1251074
function setVariable( $blockName, $variableName, $variableValue )
    {
        if ( !$this->isSettingReadOnly( $this->filename(), $blockName, $variableName ) )
            return false;

        $this->BlockValues[$blockName][$variableName] = $variableValue;
        $this->ModifiedBlockValues[$blockName][$variableName] = true;
    }
1133242
public function getDefaultValue(string $variableName)
    {
        if (isset($this->defaultValues[$variableName])) {
            return $this->defaultValues[$variableName];
        }

        return null;
    }
639180
public function updateFieldSet(&$fieldset)
    {
        if (!$fieldset->fieldByName($this->getName())) {
            $field = new HiddenField($this->getName(), null, $this->getValue());
            $fieldset->push($field);
            return $field;
        } else {
            return false;
        }
    }
711012
public function Filter( $facts, $variableSet )
	{
		// If the filter is being used in a boolean filter or there is a qname expresssion then return the input facts
		if ( $this->inBoolean || $this->qnameExpressions ) return $facts;

		if ( ! $this->qnames ) return $facts;

		$matched = array();
		$notMatched = array();
		foreach ( $facts as /** @var XPathNavigator $fact */ $fact )
		{
			$clark = "{{$fact->getNamespaceURI()}}{$fact->getLocalName()}";

			if ( in_array( $clark, $this->qnames ) )
			{
				$matched[] = $fact->CloneInstance();
			}
			else
			{
				$notMatched[] = $fact->CloneInstance();
			}
		}

		return DocumentOrderNodeIterator::fromItemset( $this->complement ? $notMatched : $matched );
	}
855853
public function toQuery( $variableSet, $factVariableBinding )
	{
		if ( ! $this->substitutionGroups )
		{
			return null;
		}

		$clauses = array();

		if ( isset( $this->substitutionGroups['qnames'] ) && $this->substitutionGroups['qnames'] )
		foreach ( $this->substitutionGroups['qnames'] as $qname )
		{
			$name = qname( $qname );
			$clauses[] = $this->strict
				? "fn:QName('{$name->namespaceURI}','{$name->localName}') eq (xfi:concept-substitutions(fn:node-name(.)))[1]"
				: "fn:QName('{$name->namespaceURI}','{$name->localName}') = xfi:concept-substitutions(fn:node-name(.))";
		}

		if ( isset( $this->substitutionGroups['qnameExpressions'] ) && $this->substitutionGroups['qnameExpressions'] )
		foreach ( $this->substitutionGroups['qnameExpressions'] as $qnameExpression )
		{
			$clauses[] = $this->strict
				? "{$qnameExpression} eq (xfi:concept-substitutions(fn:node-name(.)))[1]"
				: "{$qnameExpression} = xfi:concept-substitutions(fn:node-name(.))";
		}

		return implode( " or ", $clauses );

	}
400439
public function Filter( $facts, $variableSet )
	{
		// Look for the variable
		$vars = $variableSet->getBindingsAsVars();
		$clark = str_replace( "{}", "", "{{$this->variable['namespace']}}{$this->variable['name']}" );
		if ( ! isset( $vars[ $clark ] ) )
		{
			// Should probably throw some kind of error here
			throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $clark );
		}

		/**
		 * @var \DOMNode[] $candidates
		 */
		$candidate = null;
		$var = $vars[ $clark ];
		if ( $var instanceof XPath2NodeIterator )
		{
			$node = reset( $var->ToList() );
			if ( is_null( $node ) )
			{
				throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $clark );
			}

			$candidate = $node->getUnderlyingObject();
		}
		else
		{
			$candidate = $var->getUnderlyingObject();
		}

		$matched = array();
		$notMatched = array();

		$candidateParent = $candidate->parentNode;

		// The fact can be an
		foreach ( $facts as $fact )
		{
			$node = $fact->getUnderlyingObject();
			$factParent = $node->parentNode;

			if ( $candidateParent->isSameNode( $factParent ) )
			{
				$matched[] = $fact->CloneInstance();
			}
			else
			{
				$notMatched[] = $fact->CloneInstance();
			}
		}

		return DocumentOrderNodeIterator::fromItemset( $this->complement ? $notMatched : $matched );

		return $facts;
	}
673706
function fallBack(fallback) {
  return computed({
    get() { return fallback; },
    set(_, v) { return v === undefined ? fallback : v; }
  });
}
119682
public function getFieldMeta($property = null, $fallbackValue = "")
    {
        if (is_null($property)) {
            $varReturn = $this->__fieldmeta;
        } elseif (isset($this->__fieldmeta[$property])
            && !is_null($this->__fieldmeta[$property])
        ) {
            $varReturn = $this->__fieldmeta[$property];
        } else {
            $varReturn = $fallbackValue;
        }

        return $varReturn;
    }
681207
public function setWidths(array $widths, $fallback = false) {
		if ($fallback) {
			foreach ( $this->_widths as $index => $value ) {
			    $widths[$index] = $value;
			}
		}
		$this->_widths = $widths;
	}
1265793
public void addValueSet(ValueSet theValueSet) {
		Validate.notBlank(theValueSet.getUrl(), "theValueSet.getUrl() must not return a value");
		myValueSets.put(theValueSet.getUrl(), theValueSet);
	}
1037340
public function addFallback($name, $fallbackName)
    {
        if (!isset($this->fallbacks[$name])) {
            $this->fallbacks[$name] = array();
        }
        $this->fallbacks[$name][] = $fallbackName;
        return $this;
    }