Update the uncover aspect facts list in the bindings
@param array $uncoveredAspectFacts
@param VariableBinding $binding
169400
private function updateUncoveredAspectFacts( $uncoveredAspectFacts, $binding )
	{
		if ( ! $uncoveredAspectFacts || $binding instanceof ScopeVariableBinding ) return;

		// Get the current fact so the uncovered aspects array
		$fact = $binding->current();

		// Fill any null values in the parent binding with facts from $binding
		// NOTE: Arelle does it this way (see implicitFilter() on line 618 of FormulaEvaluator.py) but it is
		//       necessary that the facts in the parent binding take precedence.  The formula spec say that
		//       any of the facts can be used.  Still, for testing purposes, making this process as close to
		//       the way Arelle operates means it is easier to identify implementation problems.
		foreach ( $binding->uncoveredAspectFacts as $aspect => $fact )
		{
			// Don't change non-null aspects
			if ( ! is_null( $fact ) ) continue;

			// Otherwise, if the corresponding aspect in the existing uncovered aspect facts list is not null apply it.
			if ( ! isset( $uncoveredAspectFacts[ $aspect ] ) || is_null( $uncoveredAspectFacts[ $aspect ] ) ) continue;

			$binding->uncoveredAspectFacts[ $aspect ] = $uncoveredAspectFacts[ $aspect ];
		}
	}
133015
public function toQuery( $variableSet, $factVariableBinding )
	{
		$variable = $this->variable['originalPrefix']
			? "{$this->variable['originalPrefix']}:{$this->variable['name']}"
			: $this->variable['name'];
		$aspects = implode("','", $this->getAspectsCovered( $variableSet, $factVariableBinding ) );
		$class = get_class($this);
		return "(lyquidity:aspectMatch(\$lyquidity:factVariable,\$lyquidity:variableSet,.,\$$variable,('$aspects'),'$class'))";
	}
609516
public static boolean isVariableSet(QuerySolution resultRow, String variableName) {

        if (resultRow != null) {
            return resultRow.contains(variableName);
        }

        return false;
    }
858424
@Override
	public CQVariables getVariables(Bindings bindings) {
		CQVariablesImpl variables = new CQVariablesImpl();

		// Add all of the sling bindings
		SlingHttpServletRequest request = (SlingHttpServletRequest) bindings
				.get("request");
		variables.putAll(bindings);

		// Add all of the CQ stuff
		Resource resource = request.getResource();
		ResourceResolver resolver = request.getResourceResolver();
		XSSAPI xssAPI = xssApi.getRequestSpecificAPI(request);
		ComponentContext componentContext = WCMUtils
				.getComponentContext(request);
		EditContext editContext = componentContext != null ? componentContext
				.getEditContext() : null;
		ValueMap properties = ResourceUtil.getValueMap(resource);
		PageManager pageManager = (PageManager) resolver
				.adaptTo(PageManager.class);
		ValueMap pageProperties = null;
		Page currentPage = null;
		Page resourcePage = null;
		if (pageManager != null) {
			resourcePage = pageManager.getContainingPage(resource);
			currentPage = componentContext != null ? componentContext.getPage()
					: null;
			if (currentPage == null) {
				currentPage = resourcePage;
			}
			if (currentPage == null) {
				pageProperties = null;
			} else {
				pageProperties = new HierarchyNodeInheritanceValueMap(
						currentPage.getContentResource());
			}
		}
		com.day.cq.wcm.api.components.Component component = WCMUtils
				.getComponent(resource);
		Designer designer = (Designer) request.getResourceResolver().adaptTo(
				Designer.class);
		if (designer != null) {
			Design currentDesign;
			if (currentPage == null) {
				currentDesign = null;
			} else {
				String currentDesignKey = REQ_ATTR_PREFIX
						+ currentPage.getPath();
				Object cachedCurrentDesign = request
						.getAttribute(currentDesignKey);
				if (cachedCurrentDesign != null) {
					currentDesign = (Design) cachedCurrentDesign;
				} else {
					currentDesign = designer.getDesign(currentPage);
					request.setAttribute(currentDesignKey, currentDesign);
				}
			}
			Design resourceDesign;
			if (resourcePage == null) {
				resourceDesign = null;
			} else {
				String resourceDesignkey = REQ_ATTR_PREFIX
						+ resourcePage.getPath();
				Object cachedresourceDesign = request
						.getAttribute(resourceDesignkey);
				if (cachedresourceDesign != null) {
					resourceDesign = (Design) cachedresourceDesign;
				} else {
					resourceDesign = designer.getDesign(resourcePage);
					request.setAttribute(resourceDesignkey, resourceDesign);
				}
			}
			Style currentStyle = currentDesign != null
					&& componentContext != null ? currentDesign
					.getStyle(componentContext.getCell()) : null;
			variables.put(CQVariables.DESIGNER, designer);
			variables.put(CQVariables.CURRENT_DESIGN, currentDesign);
			variables.put(CQVariables.RESOURCE_DESIGN, resourceDesign);
			variables.put(CQVariables.CURRENT_STYLE, currentStyle);
		}
		variables.put(CQVariables.XSS_API, xssAPI);
		variables.put(CQVariables.COMPONENT_CONTEXT, componentContext);
		variables.put(CQVariables.EDIT_CONTEXT, editContext);
		variables.put(CQVariables.PROPERTIES, properties);
		variables.put(CQVariables.PAGE_MANAGER, pageManager);
		variables.put(CQVariables.CURRENT_PAGE, currentPage);
		variables.put(CQVariables.RESOURCE_PAGE, resourcePage);
		variables.put(CQVariables.PAGE_PROPERTIES, pageProperties);
		variables.put(CQVariables.COMPONENT, component);
		variables.put(CQVariables.SESSION, resource.getResourceResolver()
				.adaptTo(Session.class));
		return variables;
	}
446861
static void throwMissingVariable(ViewDataBinding binding, int bindingVariable, @LayoutRes int layoutRes) {
        Context context = binding.getRoot().getContext();
        Resources resources = context.getResources();
        String layoutName = resources.getResourceName(layoutRes);
        String bindingVariableName = DataBindingUtil.convertBrIdToString(bindingVariable);
        throw new IllegalStateException("Could not bind variable '" + bindingVariableName + "' in layout '" + layoutName + "'");
    }
770975
public function toQuery( $variableSet, $factVariableBinding )
	{
		$clause = "";
		if ( $this->qname )
		{
			$clause = "fn:QName('{$this->qname['namespace']}','{$this->qname['originalPrefix']}:{$this->qname['name']}')";
		}
		else if ( $this->qnameExpression )
		{
			$clause = $this->qnameExpression;
		}
		else
		{
			return null;
		}

		return "(xfi:is-numeric(fn:node-name(.)) and count(xfi:unit-numerator(xfi:unit(.))) eq 1 and count(xfi:unit-denominator(xfi:unit(.))) eq 0 and xfi:measure-name(xfi:unit-numerator(xfi:unit(.))[1]) eq $clause)";
	}
339103
@Override
  public void checkIllegalBinding(Binding binding, Scope scope) {
    Class<?> clazz;
    switch (binding.getMode()) {
      case SIMPLE:
        clazz = binding.getKey();
        break;
      case CLASS:
        clazz = binding.getImplementationClass();
        break;
      case PROVIDER_CLASS:
        clazz = binding.getProviderClass();
        break;
      default:
        return;
    }

    for (Annotation annotation : clazz.getAnnotations()) {
      Class<? extends Annotation> annotationType = annotation.annotationType();
      if (annotationType.isAnnotationPresent(javax.inject.Scope.class)) {
        if (!scope.isBoundToScopeAnnotation(annotationType)) {
          throw new IllegalBindingException(format("Class %s cannot be bound."
                  + " It has a scope annotation: %s that is not supported by current scope: %s",
              clazz.getName(), annotationType.getName(), scope.getName()));
        }
      }
    }
  }
1046966
public function toQuery( $variableSet, $factVariableBinding )
	{
		$variable = new QName( $this->variable['originalPrefix'], $this->variable['namespace'], $this->variable['name'] );

		// Look for this variable among the bindings.  If it exists
		// and has a fallback value the the query is just false()
		if ( isset( $variableSet->factVariableBindings[ $variable->clarkNotation() ] ) )
		{
			/**
			 * @var FactVariableBinding $binding
			 */
			$binding = $variableSet->factVariableBindings[ $variable->clarkNotation() ];
			if ( $binding->isFallback )
			{
				return "false()";
			}
		}
		else // BMS 201803-07 What else could it be? if ( isset( $variableSet->generalVariableBindings[ $variable->clarkNotation() ] ) )
		{
			return "false()";
		}

		$this->allowAspectsCovered = true;
		$result = parent::toQuery( $variableSet, $factVariableBinding );
		// Once the filter has been created the class should return the filters applied
		// $this->allowAspectsCovered = false;

		return $result;
	}
1200306
protected void writeVarBinding( VarBinding binding)
    {
    writer_
      .element( VAR_TAG)
      .attribute( NAME_ATR, binding.getVar())
      .attribute( VALUE_ATR, String.valueOf( binding.getValue()))
      .write();
    }
604453
public function toQuery( $variableSet, $factVariableBinding )
	{
		/**
		 * These are the arguments to the xfi:concept-relationships function
	     * #source
		 * #linkrole
		 * #arcrole
		 * #axis
		 * #generations
		 * #linkname
		 * #arcname
		 */

		$source = $this->variable
					? ( "fn:node-name(" . ( $this->variable['originalPrefix'] ? "\${$this->variable['originalPrefix']}:$this->variable['name']" : "\${$this->variable['name']}" ) . ")" )
					: ( $this->qnameExpression
							? $this->qnameExpression
							: "QName('" . qname($this->qname, $variableSet->nsMgr->getNamespaces())->namespaceURI . "', '" . qname($this->qname, $variableSet->nsMgr->getNamespaces())->localName . "')"
					  );

		$linkrole = $this->linkrole
					? "'{$this->linkrole}'"
					: ( $this->linkroleExpression
							? $this->linkroleExpression
							: "()"
					  );

		$arcrole = $this->arcrole
					? "'{$this->arcrole}'"
					: ( $this->arcroleExpression
							? $this->arcroleExpression
							: "()"
					  );

		$axis = "{$this->axis}";
		$generations = $this->generations ? $this->generations : "()";

		$linkname = $this->linkname
					? "'{$this->linkname}'"
					: ( $this->linknameExpression
							? $this->linknameExpression
							: "()"
					  );

		$arcname = $this->arcname
					? "'{$this->arcname}'"
					: ( $this->arcnameExpression
							? $this->arcnameExpression
							: "()"
					  );

		$test = $this->test
					? $this->test
					: "true()";

		// Alternative line end goes here (for query formatting)
		$le = "";

		$query = "( $le" .
				 "	( $le" .
				 "		some \$relationship in $le" .
				 "			xfi:concept-relationships( $le" .
				 "				$source, $le" .
				 "				$linkrole, $le" .
				 "				$arcrole, $le" .
				 "				" . str_replace( "-or-self", "", "'$axis'" ) . ",$le" .
		//		 "				fn:replace($axis,'-or-self',''), $le" .
				 "				$generations, $le" .
				 "				$linkname, $le" .
				 "				$arcname $le" .
				 "			) $le" .
				 "		satisfies $le" .
				 "			( $le" .
				 "				\$relationship[$test] and $le" .
				 "				(fn:node-name(.) eq $le" .
             	 "					( $le" .
             	 "						if (matches('$axis','ancestor|parent')) $le" .
              	 "						then xfi:relationship-from-concept(\$relationship) $le" .
              	 "						else xfi:relationship-to-concept(\$relationship) $le" .
              	 "					) $le" .
              	 "				) $le" .
              	 "			) $le" .
              	 "  ) $le";

		$clause1 = "" .
				 "	or $le" .
				 "	( $le" .
		//		 "		fn:starts-with($axis,'sibling') and $le" .
				 "		fn:empty( $le" .
				 "			xfi:concept-relationships( $source, $linkrole, $arcrole, 'parent', 1, $linkname, $arcname) $le" .
				 "		) and $le" .
				 "		fn:empty( $le" .
				 "			xfi:concept-relationships( fn:node-name(.), $linkrole, $arcrole, 'parent', 1, $linkname, $arcname) $le" .
				 "		) and $le" .
				 "		fn:exists( $le" .
				 "			xfi:concept-relationships( fn:node-name(.), $linkrole, $arcrole, 'child', 1, $linkname, $arcname) $le" .
				 "		) and $le" .
				 "		(fn:node-name(.) ne $source) $le" .
				 "	) $le";

		$clause2 = "" .
				 "	or $le" .
				 "	( $le" .
		//		 "		fn:ends-with($axis,'-or-self') $le" .
		//		 " 		and $le" .
		//		 "		( $le" .
				 "			if ( QName('http://www.xbrl.org/2008/function/instance','root') eq $source) $le" .
				 "			then $le" .
				 "			( $le" .
				 "				fn:empty( $le" .
				 "					xfi:concept-relationships( fn:node-name(.), $linkrole, $arcrole, 'parent', 1, $linkname, $arcname) $le" .
				 "				) and $le" .
				 "				fn:exists( $le" .
				 "					xfi:concept-relationships( fn:node-name(.), $linkrole, $arcrole, 'child', 1, $linkname, $arcname) $le" .
				 "				) $le" .
				 "			) $le" .
				 "			else $le" .
				 "			( $le" .
				 "				fn:node-name(.) eq $source $le" .
				 "			) $le" .
		//		 "		) $le" .
				 "  ) $le";

		$query = $query . ( \XBRL::startsWith( $axis, 'sibling' ) ? $clause1 : "" ) . ( \XBRL::endsWith( $axis, '-or-self' ) ? $clause2 : "" );
		$query .= ") $le";
		if ( empty( $le ) )
		{
			$query = preg_replace( "/\s\t+/", " ", $query );
		}
		echo $query;
		return $query;
	}
1296748
void showVariationsWindow(String resource) {

        final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);
        CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() {

            public void run() {

                window.close();

            }

        }, Mode.FlexCache);
        try {
            CmsResource resourceObject = getRootCms().readResource(CmsFlexCacheKey.getResourceName(resource));
            variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject));
        } catch (CmsException e) {
            //
        }
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource));
        window.setContent(variationsDialog);
        UI.getCurrent().addWindow(window);
    }
1235803
private function showAspectInfo(SymfonyStyle $io, Aspect $aspect): void
    {
        $refAspect  = new ReflectionObject($aspect);
        $aspectName = $refAspect->getName();
        $io->section($aspectName);
        $io->writeln('Defined in: <info>' . $refAspect->getFileName() . '</info>');
        $docComment = $refAspect->getDocComment();
        if ($docComment) {
            $io->writeln($this->getPrettyText($docComment));
        }
        $this->showAspectPointcutsAndAdvisors($io, $aspect);
    }
871149
public void setAdaptedCoveredText(String v) {
    if (MMAXAnnotation_Type.featOkTst && ((MMAXAnnotation_Type)jcasType).casFeat_adaptedCoveredText == null)
      jcasType.jcas.throwFeatMissing("adaptedCoveredText", "de.julielab.jules.types.mmax.MMAXAnnotation");
    jcasType.ll_cas.ll_setStringValue(addr, ((MMAXAnnotation_Type)jcasType).casFeatCode_adaptedCoveredText, v);}
233880
public function show()
    {
        if (!$this->isHidden())
            return;

        $updateHiddenStm = $this->connection->prepare("UPDATE Page SET hidden=? WHERE page_id = ?");
        $updateHiddenStm->bindParam(1, $this->hidden);
        $updateHiddenStm->bindParam(2, $this->page_id);
        $this->hidden = false;
        $updateHiddenStm->execute();
    }
368251
protected String determineProfileBinding(final Pair<AuthnRequest, MessageContext> authenticationContext,
                                             final Assertion assertion) {

        val authnRequest = authenticationContext.getKey();
        val pair = getRegisteredServiceAndFacade(authnRequest);
        val facade = pair.getValue();

        val binding = StringUtils.defaultIfBlank(authnRequest.getProtocolBinding(), SAMLConstants.SAML2_POST_BINDING_URI);
        LOGGER.debug("Determined authentication request binding is [{}], issued by [{}]", binding, authnRequest.getIssuer().getValue());

        val entityId = facade.getEntityId();
        LOGGER.debug("Checking metadata for [{}] to see if binding [{}] is supported", entityId, binding);
        val svc = facade.getAssertionConsumerService(binding);
        LOGGER.debug("Binding [{}] is supported by [{}]", svc.getBinding(), entityId);
        return binding;
    }
829740
public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) {
        if (scopeCleaner.isRunning()) {
            scopeBindings.putAll(bindings);
        }
    }
813039
public function evaluateResult()
	{
		global $debug_statements;

		if ( $debug_statements )
		{
			\XBRL_Log::getInstance()->info( "Process formula" ) ;
		}

		try
		{
			// Check all variables are not all fallback and that preconditions are met
			if ( parent::evaluateResult() )
			{
				$vars = $this->getBindingsAsVars();
				$covered = array();
				$defined = array();

				foreach ( $this->factVariableBindings as $qname => /** @var VariableBinding $binding */ $binding )
				{
					$covered[ $qname ] = $binding->aspectsCovered;
					$defined[ $qname ] = $binding->aspectsDefined;
				}

				$result = $this->value
					? parent::evaluateXPathExpression( $this, $this->valueXPath2expression, $vars )
					: EmptyIterator::$Shared;

				$lastFactBinding = $this->getLastFactBinding();
				if ( ! $lastFactBinding )
				{
					// If a formula has no variables (like a tuple) then there will be no binding so create a dummy one.
					// This is needed so the aspects defined are propagated
					$lastFactBinding = new FactVariableBinding( $this->xbrlInstance, null );
					$lastFactBinding->facts = EmptyIterator::$Shared;
					$lastFactBinding->aspectsDefined = $this->covers;
					$pos = array_search( ASPECT_DIMENSIONS, $lastFactBinding->aspectsDefined );
					if ( $pos !== false ) unset( $lastFactBinding->aspectsDefined[ $pos ] );
				}

				$evaluationResult = array(
					'result' => $result,
					'vars' => $vars,
					'covered' => $covered,
					'defined' => $defined,
					'lastFactBinding' => $lastFactBinding,
					'variableSet' => $this->label,
					'isTuple' => $this instanceof Tuple,
					'GUID' => \XBRL::GUID(),
				);

				$evaluationResult['uncoveredAspectFacts'] = $evaluationResult['lastFactBinding'] instanceof FactVariableBinding
					? $evaluationResult['lastFactBinding']->uncoveredAspectFacts
					: array();

				if ( $this->tupleLocationRule && isset( $this->scopeDependencies[ $this->tupleLocationRule] ) )
				{
					$scopeArc = $this->scopeDependencies[ $this->tupleLocationRule];
					$sourceFormula = $scopeArc['from'];

					// Look for the ScopeVaribleBinding with the same index as the $scopeArc['name']
					$scopeBindingQName = new QName( $scopeArc['name']['originalPrefix'], $scopeArc['name']['namespace'], $scopeArc['name']['name'] );
					if ( isset( $this->factVariableBindings[ $scopeBindingQName->clarkNotation() ] ) )
					{
						/**
						 * @var ScopeVariableBinding $scopeBinding
						 */
						$scopeBinding = $this->factVariableBindings[ $scopeBindingQName->clarkNotation() ];
						if ( $scopeBinding instanceof ScopeVariableBinding )
						{
							$evaluationResult['parentTupleGUID'] = $scopeBinding->scopeFactGUID;
							$evaluationResult['tuple'] = $sourceFormula;
						}
					}

					// // Look for the first previous evaluation that has a variable set value of $source formula
					// $sourceFormulaResults = array_filter( $this->evaluationResults, function( $evaluationResult ) use( $sourceFormula )
					// {
					// 	return $evaluationResult['variableSet'] == $sourceFormula;
					// } );
                    //
					// if ( count( $sourceFormulaResults ) == 1 )
					// {
					// 	$previousResult = reset( $sourceFormulaResults );
					// 	$evaluationIndex = key( $sourceFormulaResults );
                    //
					// 	$evaluationResult['parentTupleGUID'] = $evaluationIndex; // $previousResult['tupleGUID'];
					// 	$evaluationResult['tuple'] = $previousResult['variableSet'];
					// }
					// else
					// {
					// 	// Look for a previous evaluation result from the source formula that has the same uncovered aspect facts
					// 	foreach ( $sourceFormulaResults as $evaluationIndex => $previousResult )
					// 	{
					// 		$commonAspects = array_intersect( array_keys( $previousResult['uncoveredAspectFacts'] ), array_keys( $evaluationResult['uncoveredAspectFacts'] ) );
					// 		foreach ( $commonAspects as $aspect )
					// 		{
					// 			if ( is_null( $previousResult['uncoveredAspectFacts'][ $aspect ] ) || is_null( $evaluationResult['uncoveredAspectFacts'][ $aspect ] ) ) continue;
					// 			/**
					// 			 * @var DOMXPathNavigator $previousFact
					// 			 */
					// 			$previousFact = $previousResult['uncoveredAspectFacts'][ $aspect ];
					// 			/**
					// 			 * @var DOMXPathNavigator $evaluationFact
					// 			 */
					// 			$evaluationFact = $evaluationResult['uncoveredAspectFacts'][ $aspect ];
                    //
					// 			if ( $previousFact->getUnderlyingObject()->getNodePath() != $evaluationFact->getUnderlyingObject()->getNodePath() ) continue;
                    //
					// 			$evaluationResult['parentTupleGUID'] = $evaluationIndex; // $previousResult['tupleGUID'];
					// 			$evaluationResult['tuple'] = $previousResult['variableSet'];
                    //
					// 			break 2;
					// 		}
					// 	}
					// }
				}

				$this->evaluationResults[ $evaluationResult['GUID'] ] = $evaluationResult;

				return true;
			}
		}
		catch( XPath2Exception $ex )
		{
			throw $ex;
		}
		catch( \Exception $ex )
		{
			// Do nothing
		}

		return false;
	}