Set defaultValue

@param string $defaultValue

@return Attribute

@throws \InvalidArgumentException
14268
public function setDefaultValue($defaultValue)
    {
        if (!is_string($defaultValue)) {
            throw new \InvalidArgumentException('The attribute defaultValue on the class Attribute has to be string (' . gettype($defaultValue) . ('object' === gettype($defaultValue) ? ' ' . get_class($defaultValue) : '') . ' given).');
        }

        $this->defaultValue = $defaultValue;

        return $this;
    }
795204
public function setDecimalValue($decimalValue)
    {
        if (\is_array($decimalValue) || \is_object($decimalValue)) {
            $m = "Invalid value type for attribute {$this->getFamilyCode()}.{$this->getAttributeCode()}, ";
            $m .= 'expecting float, got '.gettype($decimalValue);
            throw new \UnexpectedValueException($m);
        }
        $this->decimalValue = null === $decimalValue ? null : (float) $decimalValue;

        return $this;
    }
935992
public function getParameter($parameterName, $defaultValue = null)
    {
        if ($this->getConfigResolver()->hasParameter($parameterName)) {
            return $this->getConfigResolver()->getParameter($parameterName);
        }

        return $defaultValue;
    }
515350
public function setDefault($default)
    {
        switch ($this->type) {
            case self::TYPE_STRING:
                if (!\is_string($default)) {
                    throw new \InvalidArgumentException('Default parameter is not a string');
                }

                break;
            case self::TYPE_NUMBER:
                if (!\is_numeric($default)) {
                    throw new \InvalidArgumentException('Default parameter is not a number');
                }

                break;
            case self::TYPE_INTEGER:
                if (!\is_numeric($default) || (int) $default != $default) {
                    throw new \InvalidArgumentException('Default parameter is not an integer');
                }

                break;
            case self::TYPE_DATE:
                if (!$default instanceof \DateTimeImmutable) {
                    throw new \InvalidArgumentException('Default parameter is not a dateTime object');
                }

                break;
            case self::TYPE_BOOLEAN:
                if (!\is_bool($default)) {
                    throw new \InvalidArgumentException('Default parameter is not a boolean');
                }

                break;
            case self::TYPE_FILE:
                throw new \InvalidArgumentException('A default value cannot be set for a file');

                break;
        }

        $this->default = $default;
    }
1147326
public function setTextValue($textValue)
    {
        if (\is_array($textValue) || \is_object($textValue)) {
            $m = "Invalid value type for attribute {$this->getFamilyCode()}.{$this->getAttributeCode()}, ";
            $m .= 'expecting string, got '.gettype($textValue);
            throw new \UnexpectedValueException($m);
        }
        $this->textValue = null === $textValue ? null : (string) $textValue;

        return $this;
    }
696289
public function getArg($name, $defaultValue = null)
    {
        if (array_key_exists($name, $this->args)) {
            return $this->args[$name];
        }

        return $defaultValue;
    }
181590
public DoubleParameter setDefaultValue(double defaultValue) {
		super.setDefaultValue(defaultValue);

		if (hasMinimumValue) {
			if (minimumValueInclusive) {
				Util.checkParameter(defaultValue >= minimumValue,
					"Default value (" + defaultValue + ") must be greater than or equal to minimum (" + minimumValue + ")");
			} else {
				Util.checkParameter(defaultValue > minimumValue,
					"Default value (" + defaultValue + ") must be greater than minimum (" + minimumValue + ")");
			}
		}

		if (hasMaximumValue) {
			if (maximumValueInclusive) {
				Util.checkParameter(defaultValue <= maximumValue,
					"Default value (" + defaultValue + ") must be less than or equal to maximum (" + maximumValue + ")");
			} else {
				Util.checkParameter(defaultValue < maximumValue,
					"Default value (" + defaultValue + ") must be less than maximum (" + maximumValue + ")");
			}
		}

		return this;
	}
1165367
public function getValue($defaultValue = null)
    {
        if ($this->read === false) {
            if (isset($_COOKIE[$this->name])) {
                if ($this->useEncryption === true) {
                    return $this->value = $this->decrypt($_COOKIE[$this->name]);
                }

                return $this->value = $_COOKIE[$this->name];
            }

            return $defaultValue;
        }

        return $this->value;
    }
1181201
public function getNullableValue($defaultValue = self::NULLABLE_DEFAULT)
    {
        $isNullable = !$this->isNotNull();

        return $isNullable === $defaultValue ? ($this->isAlwaysNullable() ? $isNullable : null) : $isNullable;
    }
401138
public function getProperty($key, $defaultValue = null)
    {
        if (array_key_exists($key, $this->storage)) {
            return $this->storage[$key];
        }

        return $defaultValue;
    }
205914
public function getSetting( string $name, $defaultValue = null )
	{
		return $this->isSettingSet($name)
			? $this->settings[$name]
			: $defaultValue;
	}
911204
public function getValueFor($name, $defaultValue = null)
    {
        if (!$this->hasParameter($name)) {
            return $defaultValue;
        }
        return $this->parameters[strtolower($name)]->getValue();
    }
344447
public function getAttribute($attribute, $defaultValue = null)
    {
        return array_get($this->cart->attributes, $attribute, $defaultValue);
    }
977798
public function inject($originalValue)
    {
        foreach ($this->decorators as $decorator) {
            if ($decorator->supports($originalValue) === true) {
                return $decorator->inject($originalValue);
            }
        }

        throw new \InvalidArgumentException(sprintf(
            'No decorator registered supporting the given value: "%s"',
            var_export($originalValue, true)
        ));
    }
385582
protected function extractDefault($defaultValue)
	{
		if(stripos($defaultValue,'timestamp')!==false)
			$this->defaultValue=null;
		else
			parent::extractDefault($defaultValue);
	}
668768
public function setDefault($default)
    {
        $this->default = (string)$default;
        if ($this->default && !in_array($this->default, $this->values, true)) {
            $this->addValue($this->default);
        }
        return $this;
    }
308676
public function setIntegerValue($integerValue)
    {
        if (\is_array($integerValue) || \is_object($integerValue)) {
            $m = "Invalid value type for attribute {$this->getFamilyCode()}.{$this->getAttributeCode()}, ";
            $m .= 'expecting integer, got '.gettype($integerValue);
            throw new \UnexpectedValueException($m);
        }
        $this->integerValue = null === $integerValue ? null : (int) $integerValue;

        return $this;
    }