Allows any expression to be used as a field value.

@see http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#aggregation-expressions

@param mixed|self $value
512222
public function expression($value) : self
    {
        $this->requiresCurrentField(__METHOD__);
        $this->expr[$this->currentField] = $this->ensureArray($value);

        return $this;
    }
837162
public function setValue($value)
    {
        if (\is_array($value)) {
            $this->setValueArray($value);
            $value = implode(', ', $value);
        }

        $this->setAttribute('value', $value);

        return $this;
    }
375056
final public function updateValue(Expression $value)
    {
        if ($this->value === $value) {
            return $this;
        }

        return $this->updateValueExpression($value);
    }
74893
public function setValue($value)
    {
        if (is_array($value)) {
            foreach ($value as $childKey => $childValue) {
                $this->children[$childKey] = new static($childValue);
            }
            $this->value = null;
        } else {
            $this->value = $value;
            $this->children = array();
        }
        return $this;
    }
261205
public function set($field, $value = null)
    {
        if (! is_array($field)) {
            $field = [$field => $value];
        }

        foreach ($field as $f => $v) {
            $this->update('$set', $f, $v);
        }

        return $this;
    }
203915
public function setUserValue(string $value) : self
    {
        $this->user_value = $value;
        $this->is_valid = null;
        return $this;
    }
1044992
public function setValue($value=null) :self {
		// append by default or replace html
		$this->attributes['value'] = Format::htmlSafe($value);
		// return self
		return($this);
	}
17205
public static void setValue(Field field, Object self, Object value) {
        try {
            field.set(self, value);
        } catch (IllegalAccessException e) {
            throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_SET_FIELD)
                    .put("field", field.toGenericString());
        }
    }
777871
public function setValue($value)
    {
        $hasType = isset($this->_type) && is_string($this->_type);
        $isMultiple = $hasType && strpos($this->_type, '[]') !== false;

        if ($hasType) {
            $value = $this->_castToExpression($value, $this->_type);
        }

        if ($isMultiple) {
            list($value, $this->_valueExpressions) = $this->_collectExpressions($value);
        }

        $this->_isMultiple = $isMultiple;
        $this->_value = $value;
    }
393402
public function addField(string $field, string $value): self
    {
        $this->fields[$field] = $value;

        return $this;
    }
344427
public function setValue( $value ) {
		$this->value = $this->cleanUpValue( $value );
		// Deselect all options
		foreach ( $this->fields as $field ) {
			$field->getField()->setSelected( false );
		}
		// Select the requested ones
		foreach ( $this->value as $key ) {
			$this->fields[ $key ]->getField()->setSelected( true );
		}
		return $this;
	}
135759
public function setValue($value)
    {
        if ((\is_bool($value))) {
            $this->value = (bool) $value;
        } elseif (\is_object($value) && $value instanceof self) {
            $this->value = $value->getValue();
        } else {
            throw new \InvalidArgumentException('Expected boolean');
        }
    }
1057593
public function setType($value): self
    {
        if (!in_array($value, self::types(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_TYPE, implode(', ', self::types())));
        }

        return $this->setAttribute('type', $value);
    }
65422
public function setValue(   $value)
    {
        
     
        // Set the value of the expression and cast it function of the (defined) base type of the variable
        if ($this->attributes['baseType']){
            switch ($this->attributes['baseType']){
                case 'boolean':
                    if (is_string ($value)){
                        $this->value = (bool)($value=='true'||$value=='1'?1:0);
                    }else if (is_bool ($value)){
                        $this->value = $value;
                    }else if ($value == null){
                        $this->value = null;
                    }else{
                        throw new Exception ('taoQTI_models_classes_QTI_response_ExpressionOperator::setValue : an error occured, the value ['.$value.'] is not a well formed boolean');
                    }
                    break;
                case 'float':
                    $this->value = (float)$value;
                    break;
                case 'integer':
                    $this->value = (int)$value;
                    break;
                case 'identifier':
                case 'string':
                    $this->value = (string)$value;
                    break;
                case 'pair':
                    $this->value = taoQTI_models_classes_Matching_VariableFactory::createJSONValueFromQTIData($value, 'pair');
                    break;
                case 'directedPair':
                    $this->value = taoQTI_models_classes_Matching_VariableFactory::createJSONValueFromQTIData($value, 'directedPair');
                    break;
            }   
        }
        
    }
1205585
public function setValue($value) {
		if($value instanceof Value) {
			$value = $value->getRawValue();
		}
		foreach($this->inputs as $inflector) {
			$value = $inflector($value);
		}
		$this->value = $value;
	}
913415
private function processValue($value)
    {
        $this->valueStack[] = $value;
        $value = $this->resolveValue($value);

        if (is_array($value) || is_object($value)) {
            $this->pushStack($value);
        } else {
            $this->outputJson($value, JsonToken::T_VALUE);
            array_pop($this->valueStack);
        }
    }
1215165
protected function SetJSFieldValue($field, $value)
    {
        $jsField = Str::ToJavascript($field, false);
        $jsValue = Str::ToJavascript($value, false);
        echo "<script>$($jsField).val($jsValue);</script>";
    }