Evaluate the variable description
@param  mixed $variable
@return string
422483
protected function evalVarLabel($variable)
    {
        $type = $this->getType($variable);
        switch ($type) {
            case 'object':
                return $this->evalObjLabel($variable);

            case 'array':
                return $type . '('.count($variable).')';

            default:
                return $type;
        }
    }
1151769
public static function isEmpty($variable): bool
    {
        $result = true;
        if (!empty($variable) && is_array($variable)) {
            foreach ($variable as $value) {
                $result = $result && self::isEmpty($value);
            }
        } else {
            $result = empty($variable);
        }

        return $result;
    }
125551
public function toBody($var)
    {
        $results = '';

        foreach ($this->getParser()->toArray() as $name => $types) {
            if (in_array($name, $this->ignores)) {
                continue;
            }

            $results .= "\t\t\t\t\t".'<td>{!! $'.$var.'->'.$name.' !!}</td>'.PHP_EOL;
        }

        return $results;
    }
841794
public function resolve($var)
    {

        # if $var is array - it contains filters to apply
        $filters = array();
        if (is_array($var)) {
            $name = array_shift($var);
            $filters = isset($var['filters']) ? $var['filters'] : array();
        } else {
            $name = $var;
        }

        $result = null;

        # Lookup basic types, null, boolean, numeric and string
        # Variable starts with : (:users.name) to short-circuit lookup
        if ($name[0] === ':') {
            $object = $this->getVariable(substr($name, 1));
            if (!is_null($object)) {
                $result = $object;
            }
        } else {
            if ($name === 'true') {
                $result = true;
            } elseif ($name === 'false') {
                $result = false;
            } elseif (preg_match('/^-?\d+(\.\d+)?$/', $name, $matches)) {
                $result = isset($matches[1]) ? floatval($name) : intval($name);
            } elseif (preg_match('/^"([^"\\\\]*(?:\\.[^"\\\\]*)*)"|'.
                           '\'([^\'\\\\]*(?:\\.[^\'\\\\]*)*)\'$/', $name)) {
                $result = stripcslashes(substr($name, 1, -1));
            }
        }
        if (!empty(self::$lookupTable) && $result == null) {
            $result = $this->externalLookup($name);
        }
        $result = $this->applyFilters($result, $filters);

        return $result;
    }
327185
protected function evalObjDesc($variable)
    {
        $output = [];
        if ($variable instanceof ComponentBase) {
            $details = $variable->componentDetails();
            $output[] = '<abbr title="'.array_get($details, 'description').'">';
            $output[] = array_get($details, 'name');
            $output[] = '</abbr>';
        }

        return implode('', $output);
    }
1031784
public function values($variable)
    {
        foreach ($this->keywordList('VALUES') as $keyword) {
            if ($keyword->subKeys[0] == $variable) {
                return $keyword->values;
            }
        }
        throw new RuntimeException(sprintf('Could not determine values of "%s".', $variable));
    }
971614
public static function getEnv($variable = null) {
		$cmd = preg_match("/WIN/Ai", PHP_OS) ? 'set' : 'printenv';
		$output = self::run($cmd)->output;

		$env = [];

		foreach ($output as $line) {
			list($key, $value) = explode("=", $line, 2);

			if ($variable && strtolower($key) === strtolower($variable)) {
				return $value;
			}

			$env[$key] = $value;
		}

		return $env;
	}
394957
public function addRawVariable(Variable $variable)
    {
        if (!isset($this->branchVariables[1])) {
            $this->branchVariables[1] = [];
        }
        $this->branchVariables[1][$variable->getName()] = $variable;

        return $variable;
    }
963072
public function request($variable)
    {
        $order = ini_get('request_order');

        if (empty($order)) {
            $order = ini_get('variables_order');
        }

        $len = strlen($order);

        for ($i = 0; $i < $len; ++$i) {
            $character = strtoupper($order[$i]);

            if ($character == 'G') {
                if ($this->get($variable)) return $this->get($variable);
            } else if ($character == 'P') {
                if ($this->post($variable)) return $this->post($variable);
            } else if ($character == 'C') {
                if ($this->cookie($variable)) return $this->cookie($variable);
            }
        }

        return null;
    }
527409
protected function evalVarDump($variable)
    {
        $dumper = new HtmlDumper;
        $cloner = new VarCloner;

        $output = '<div style="display:none">';
        $output .= $dumper->dump($cloner->cloneVar($variable), true);
        $output .= '</div>';

        return $output;
    }
185631
public static function convertVariableToString($variable) {
		$string = '';
		if (is_array($variable)) {
			$string = self::viewArray($variable);
		} elseif (is_object($variable)) {
			$string = '<strong>|Object:<pre>';
			$string .= print_r($variable, TRUE);
			$string .= '</pre>|</strong>';
		} elseif ((string) $variable !== '') {
			$string = '<strong>|' . htmlspecialchars((string) $variable) . '|</strong>';
		} else {
			$string = '<strong>| debug |</strong>';
		}

		return $string;
	}
843466
public static String get(VariableElement variable) {
    StringBuilder result = new StringBuilder();
    AnnotationMirror qualifier = getQualifier(variable.getAnnotationMirrors());
    if (qualifier != null) {
      qualifierToString(qualifier, result);
    }
    typeToString(variable.asType(), result, '$');
    return result.toString();
  }
580613
public function contains(Variable $variable)
    {
        return (
            isset($this->readAccess[$variable->getName()]) ||
            isset($this->changeAccess[$variable->getName()])
        );
    }
1362286
public function evaluate($variable = array())
    {
        $returnValue = (bool) false;

        
        
        common_Logger::i('Evaluating Expression uri: '. $this->getUri(), array('Generis Expression'));
        common_Logger::i('Evaluating Expression name: '. $this->getLabel(), array('Generis Expression'));
		if ($this->getUri() == RulesRdf::INSTANCE_EXPRESSION_TRUE) {
			return true;
		}
    	if ($this->getUri() == RulesRdf::INSTANCE_EXPRESSION_FALSE) {
			return false;
		}
		$returnValue = $this->expEval($variable);
		$logValue = $returnValue ? ' TRUE ' : ' FALSE ';
		common_Logger::i('Value : '. $logValue, array('Generis Expression'));
        

        return (bool) $returnValue;
    }
1127597
public static function get($variable) {
		// If it exists, and we do not want to overwrite, then throw exception
		if (! self::has($variable)) {
			throw new \Exception("{$variable} does not exist in the store.");
		}

		return (bool)self::$_memcache->get($variable);
	}
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;
    }
146531
private function _printVar($var)
    {
        if (is_string($var)) {
            $search = array("\x00", "\x0a", "\x0d", "\x1a", "\x09");
            $replace = array('\0', '\n', '\r', '\Z', '\t');

            return ('"'.str_replace($search, $replace, $var).'"');
        } elseif (is_bool($var)) {
            if ($var) {
                return ('true');
            } else {
                return ('false');
            }
        } elseif (is_array($var)) {
            $strResult = 'array( ';
            $strComma = '';
            foreach ($var as $key=>$val) {
                $strResult .= $strComma.$this->_printVar($key).' => '.$this->_printVar($val);
                $strComma = ', ';
            }
            $strResult .= ' )';

            return ($strResult);
        }
        // anything else, just let php try to print it
        return (var_export($var, true));
    }