Get the intrinsic values of a given QTI $variable.

@param Variable $variable
@return array
12309
public static function getVariableValues(Variable $variable) {

        $returnValue = array();

        $baseType = $variable->getBaseType();
        $cardinalityType = $variable->getCardinality();
        $value = $variable->getValue();
        
        // This only works if the variable has a value ;)
        if ($value !== null) {
            
            if ($baseType === BaseType::IDENTIFIER) {
            
                if ($cardinalityType === Cardinality::SINGLE) {
            
                    $returnValue[] = $value->getValue();
                }
                else if($cardinalityType === Cardinality::MULTIPLE) {
            
                    foreach($variable->getValue() as $value) {
            
                        $returnValue[] = $value->getValue();
                    }
                }
            }
        }

        return $returnValue;
    }
1272249
protected function variables()
    {
        return [
            'content'   => $this->value,
            'escape'    => $this->escape,
            'label'     => $this->getLabel(),
            'wrapped'   => $this->border,
            'width'     => $this->width,
        ];
    }
473658
public function getVariableFromMaps($var, TransientVarsInterface $transientVars, PropertySetInterface $ps)
    {
        $firstDot = strpos($var, '.');
        $actualVar = $var;

        if (false !== $firstDot) {
            $actualVar = substr($var, 0, $firstDot);
        }


        $o = null;
        if ($transientVars->offsetExists($actualVar)) {
            $o = $transientVars->offsetGet($actualVar);
        }

        if (null === $o) {
            $o = $ps->getAsActualType($actualVar);
        }

        if (false !== $firstDot) {
            $property = substr($var, $firstDot + 1);
            $o = $this->getPropertyObject($o, $property);
        }

        return $o;
    }
1133242
public function getDefaultValue(string $variableName)
    {
        if (isset($this->defaultValues[$variableName])) {
            return $this->defaultValues[$variableName];
        }

        return null;
    }
1078404
protected function getValuesFromWidget($varValue)
    {
        $alias  = $this->getAliasColumn();
        $idname = $this->get('tag_id');
        $values = $this
            ->getConnection()
            ->createQueryBuilder()
            ->select('v.*')
            ->from($this->getTagSource(), 'v')
            ->where('v.' . $alias . ' IN (:aliases)')
            ->setParameter('aliases', $varValue, Connection::PARAM_STR_ARRAY)
            ->orderBy('v.' . $this->getSortingColumn())
            ->execute();

        $result = [];
        foreach ($values->fetchAll(\PDO::FETCH_ASSOC) as $value) {
            // Adding the sorting from widget.
            $result[$value[$idname]]                      = $value;
            $result[$value[$idname]]['tag_value_sorting'] = \array_search($value[$alias], $varValue);
        }
        uasort($result, function ($value1, $value2) {
            return ($value1['tag_value_sorting'] - $value2['tag_value_sorting']);
        });

        return $result;
    }
539671
protected function _getVars(string $tableName) : array
    {
        $table = Inflector::tableize($tableName);

        $name = Inflector::camelize($tableName) . $this->_getLastModifiedTime($table);

        return [$table, $name];
    }
1342902
public static function getTypeFromPHPVariable($variable)
    {
        if ($variable === null) {
            throw ODMException::cannotInferTypeFromNullValue();
        }

        $phpType = gettype($variable);
        
        if ($phpType === 'string') {
            if ($variable === '') {
                throw new \InvalidArgumentException;
            }

            return self::getType(Type::STRING);
        }

        if ($phpType instanceof NumberValue) {
            //use type coercion to determine the actual php type
            $phpType = gettype((string)$variable + 0);
        }

        if ($phpType === 'integer') {
            return self::getType(Type::INT);
        }

        if ($phpType === 'double') {
            return self::getType(Type::FLOAT);
        }

        if (is_resource($variable) || $variable instanceof StreamInterface || $variable instanceof BinaryValue) {
            return self::getType(Type::BIN);
        }

        if ($phpType === 'object') {
            if ($variable instanceof SetValue) {
                return self::getType(Type::SET);
            }

            if (!$variable instanceof \Traversable && !$variable instanceof \stdClass) {
                throw ODMException::unmappedObjectSerializationNotSupported();
            }

            //Traversable objects fall through to the array case
            $phpType = 'array';
        }

        if ($phpType === 'array') {
            $i = 0;
            foreach ($variable as $k => $v) {
                if (!is_int($k) || $k != $i++) {
                    return self::getType(Type::MAP);
                }
            }

            return self::getType(Type::LIST_);
        }

        if ($phpType === 'boolean') {
            return self::getType(Type::BOOL);
        }

        //NULL, closed resource or unknown type
        throw new \InvalidArgumentException;
    }
1185383
public function getVariables()
    {
        $variables = [];

        $order = $order = $this->checkoutSession->getLastRealOrder();

        if ($order) {
            $variables['order.subtotal']        = $order->getBaseSubtotalInclTax();
            $variables['order.discount_total']  = $order->getDiscountAmount();
            $variables['order.shipping_total']  = $order->getShippingAmount();
            $variables['order.grand_total']     = $order->getBaseGrandTotal();
            $variables['order.shipping_method'] = $order->getShippingMethod();
            $variables['order.payment_method']  = $order->getPayment()->getMethod();
            $variables['order.salesrules']      = $order->getAppliedRuleIds();

            $itemId = 0;
            foreach ($order->getAllItems() as $item) {
                $variables = array_merge($variables, $this->getOrderItemVariables($item, $itemId++));
            }
        }

        return $variables;
    }
80021
public function getVariableRefs()
	{
		$variableRefs = array();

		foreach ( $this->filters as $filter )
		{
			$variableRefs = array_merge( $variableRefs, $filter->getVariableRefs() );
		}

		return $variableRefs;
	}
423376
public static function getArray($var)
    {
        if (is_null($var) || empty($var)) {
            return [];
        }

        foreach ($var as $value) {
            if ((gettype($value) == 'object')
                && (get_class($value) == 'SimpleXMLElement')
            ) {
                return (array) $var;
            } elseif (!is_array($value)) {
                return [$var];
            }
        }

        return $var;
    }
392238
private function sanitizeParam($var): array
    {
        if (is_object($var)) {
            if ($var instanceof QueryInterface) {
                $query = [
                    'querystring' => $var->getStatement(),
                    'language' => $var->getLanguage(),
                ];
                if ($var instanceof Query) {
                    $query['limit'] = $var->getLimit();
                    $query['offset'] = $var->getOffset();
                }

                return $query;
            }

            return [sprintf('Object(%s)', get_class($var)), false];
        }

        if (is_array($var)) {
            $a = [];
            $original = true;
            foreach ($var as $k => $v) {
                list($value, $orig) = $this->sanitizeParam($v);
                $original = $original && $orig;
                $a[$k] = $value;
            }

            return [$a, $original];
        }

        if (is_resource($var)) {
            return [sprintf('Resource(%s)', get_resource_type($var)), false];
        }

        return [$var, true];
    }
1193832
protected function resolve_excludes($variable, $default = null) {
        $setting = $default;
        if (is_array($this->{$variable}) or $this->{$variable} === true) {
            $setting = $this->{$variable};
        } else {
            foreach ($this->parent_configs as $parent_config) { // the immediate parent first, base last
                if (!isset($parent_config->{$variable})) {
                    continue;
                }
                if (is_array($parent_config->{$variable}) or $parent_config->{$variable} === true) {
                    $setting = $parent_config->{$variable};
                    break;
                }
            }
        }
        return $setting;
    }
332724
public function getVariable($variableName, $defaultValue = null)
    {
        return isset($this->variables[$variableName]) ?
            $this->variables[$variableName] : $defaultValue;
    }
1346426
public function extractResultVariableProperty($variableId)
    {
        $variableIds = explode('http://',$variableId);
        $parts = explode(static::PROPERTY_SEPARATOR, $variableIds[2]);

        $itemUri = $variableIds[0] . 'http://' . $parts[0];
        $propertyName = empty($parts[1]) ? 'RESPONSE' : $parts[1];

        return [
            $itemUri,
            $propertyName
        ];
    }
162620
protected function getAutoAssignVariablesForView(string $view): array
	{
		if(!isset($this->autoAssignVariables[$view]))
		{
			return [];
		}

		return ($this->autoAssignVariables[$view])();
	}
835187
public function getVariable($key)
    {
        if (isset($this->variables[$key])) {
            return $this->variables[$key];
        }
        return false;
    }
473770
public function expEval($variable = array())
    {
        
		$terminalExpression = $this->getTerminalExpression();
		

    	if ($terminalExpression->getUri() == RulesRdf::INSTANCE_EMPTY_TERM_URI){
			$firstPart = $this->getFirstExpression()->expEval($variable) ;
			
			if($this->getLogicalOperator()->getUri() == RulesRdf::INSTANCE_AND_OPERATOR) {
				if ($firstPart == false) {
					common_Logger::i('CUT : first Expression == FALSE and OPERATOR = AND', array('Generis Expression'));
					return false;
				}
			}
			if($this->getLogicalOperator()->getUri() == RulesRdf::INSTANCE_OR_OPERATOR) {

				if ($firstPart == true) {
					common_Logger::i('CUT : first Expression == TRUE and OPERATOR = OR', array('Generis Expression'));
					return true;
				}
			}
			$secondPart = $this->getSecondExpression()->expEval($variable);

			//if both part are simple value
			if($firstPart instanceof core_kernel_classes_Container 
				&& $secondPart instanceof core_kernel_classes_Container) {
					common_Logger::d('Both Part are Container', array('Generis Expression'));
					$returnValue = $this->operatorEval($firstPart,$secondPart);	

			}
			
			//both are vector
			else if ($firstPart instanceof core_kernel_classes_ContainerCollection 
					&& $secondPart instanceof core_kernel_classes_ContainerCollection ) {
						$returnValue = false;
						foreach ($firstPart->getIterator() as $subLeftPart)
						{
							//analyse left collection and remove any container in it which is not literal
							if (!($subLeftPart instanceof core_kernel_classes_Resource))
							{
								foreach ($secondPart->getIterator() as $subRightPart)
								{
									 //analyse right collection and remove any container in it which is not literal
									if (!($subRightPart instanceof core_kernel_classes_Resource))
									//print_r($subLeftPart);print_r($subRightPart);
									{
										$returnValue = $returnValue || $this->operatorEval($subLeftPart,$subRightPart);
									}
								}
							}
						}
						//die("the evaluation is ". $returnValue);
						
						//throw new common_Exception('not implemented yet', __FILE__,__LINE__);
			}
			// first is a vector second is a value
			else if (($firstPart instanceof core_kernel_classes_ContainerCollection) 
					&& ($secondPart instanceof core_kernel_classes_Container )) {
				$tempResult = false;
				foreach ($firstPart->getIterator() as $container) {
					common_Logger::d('FirstPart Part is ContainerCollection Second is Container', array('Generis Expression'));
					//TODO For now consider that if only  one value of the table return true, 
					
					//TODO exist unique need to be added
					
					if ($this->getLogicalOperator()->getUri() != RulesRdf::INSTANCE_DIFFERENT_OPERATOR_URI)
					{
						$tempResult = $tempResult || $this->operatorEval($container,$secondPart);
					}
					else
					{
						if ($this->operatorEval($container,$secondPart))
						{
							$tempResult = true;
						}
						else
						{
							break;
							$tempResult = false;
						}
					}
				}
				$returnValue = $tempResult;
			}
			// first is a value second is a vector
			else if (($firstPart instanceof core_kernel_classes_Container) 
					&& ($secondPart instanceof core_kernel_classes_ContainerCollection )) {
				foreach ($secondPart->getIterator() as $container) {
					common_Logger::d('FirstPart Part Container is  Second is ContainerCollection', array('Generis Expression'));
					
					//TODO For now consider that all value of the table need to be equal to return true, , 
					//TODO exist unique need to be added
					$tempResult = $tempResult && $this->operatorEval($firstPart,$container);
						
				}
				$returnValue = $tempResult;
			}
			//case we compare boolean
			else {
				common_Logger::d('Both part are boolean', array('Generis Expression'));
			
				switch($this->getLogicalOperator()->getUri()) {
					case RulesRdf::INSTANCE_OR_OPERATOR : {
						$returnValue = $firstPart || $secondPart ;
						
						break;
					}
					case RulesRdf::INSTANCE_AND_OPERATOR : {
						$returnValue = $firstPart &&  $secondPart ;
						break;
					}
					default : {
						var_dump($this);
						throw new common_Exception('Expression ' . $this->getLabel() . ' do not have knowm operator');
					}
				}
			}
		}
		else {
			if ($terminalExpression != null) {
				common_Logger::d('Evaluating Terminal Expression', array('Generis Expression'));
				$returnValue = $terminalExpression->evaluate($variable);
				common_Logger::d('Result : ' . $returnValue, array('Generis Expression'));
			}
			else {
				throw new common_Exception('terminal expression is null');
			}
			
		}
		return $returnValue;
        
    }