@param string $value

@throws DomainException
@return Subscription
499693
public function setOrderType($value)
    {
        if (!in_array($value, self::orderTypes(), true)) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_TYPE, implode(', ', self::orderTypes())));
        }

        return $this->setAttribute('orderType', $value);
    }
872722
public function setContentInset($value) {
    if (is_object($value) && !$value instanceof ContentInset) {
      $this->triggerError('Object not of type ContentInset');
    }
    else {
      $this->contentInset = $value;
    }
    return $this;
  }
39468
protected function setDataValue($data, $field, $value)
    {
        if (!isset($this->dataNamesMap[$field]['set'])) {

            if (true === $this->ignoreNotMappedFields) {
                return $this;
            }

            throw new \DomainException('Field have not mapping with Data instance (field: ' . $field . ')');
        }

        $method = $this->dataNamesMap[$field]['set'];

        $data->{$method}($value);

        return $this;
    }
695776
protected function Sub( $value )
	{
	    switch ( $value->GetValueCode() )
	    {
	        case TimeProxyFactory::Code:
	            return new DayTimeDurationProxy( TimeValue::Sub( $this->_value, /* TimeValue */ $value->getValue() ) );

	        case DayTimeDurationProxyFactory::Code:
	        	/**
	        	 * @var DayTimeDurationProxy $value
	        	 */
	        	// Clone the DateValue contained in the proxy or the original is changed
	        	$clone = new TimeValue( clone $this->_value->Value );
	        	$value->getValue()->Value->invert = ! $value->getValue()->Value->invert;
	        	return new TimeProxy( TimeValue::AddDayTimeDuration( $clone, $value->getValue() ) );
	        	// return new TimeProxy( TimeValue::Add(  $this->_value, - /* DayTimeDurationValue */ $value->getValue() ) );

	        default:
	            throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::BinaryOperatorNotDefined,
					array(
						"op:sub",
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $value->getValue() ), XmlTypeCardinality::One )
					)
				);
	    }
	}
394570
public function filter($value)
    {

        // If it's already a timestamp, return it as is.
        if (preg_match('/^-?\d+$/', $value) === 1) {
            if ($value < 0) {
                throw new \DomainException('Invalid value');
            }
            return $value;
        }

        // Allow SQL specials.
        if ($this->getConfig('allowSqlSpecials') === true) {
            $temp = strtolower($value);
            if ($temp === 'now()' || $temp === 'current_timestamp') {
                return time();
            }
        }

        // Catch invalid strings.
        $time = strtotime($value);
        if ($time === false) {
            throw new \DomainException('Invalid value');
        }

        return $time;

    }
917730
final public function offsetSet($key, $value)
	{
		$key = (string) $key;

		if ( array_key_exists($key, $this->_stack) ) {
			throw new \DomainException('Key already exists.');
		}

		$this->_stack[$key] = $value;
	}
7396
public function setName(?string $value) : User
    {

        if ($this->data['name'] !== $value) {
            $this->data['name'] = $value;
            $this->setModified('name');
        }

        return $this;
    }
914421
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof ContentInfo) {
            throw new TransformationFailedException('Expected a ' . ContentInfo::class . ' object.');
        }

        return $value->id;
    }
1135924
public function transform($value)
    {
        if (null === $value) {
            return "";
        }

        if (false === $value instanceof NodeTranslation) {
            throw new TransformationFailedException("Value must be instance of NodeTranslation");
        }

        return $this->router->generate('_slug', [
            '_locale' => $value->getLang(),
            'url' => $value->getUrl(),
        ]);
    }
104546
public function setAfterAttemptPolicy($value)
    {
        if (!in_array(
            $value,
            [self::AFTER_ATTEMPT_POLICY_NONE, self::AFTER_ATTEMPT_POLICY_CHANGE_RENEWAL_TIME],
            true
        )) {
            throw new DomainException('Invalid after attempt policy');
        }

        return $this->setAttribute('afterAttemptPolicy', $value);
    }
82322
public function setSex($value)
    {
        if ($value !== self::SEX_MALE &&
           $value !== self::SEX_FEMALE &&
           $value !== self::SEX_OTHERS) {
            throw new DomainError("Invalid sex");
        }
        $this->parameters['sex'] = $value;
        return $this;
    }
1064613
protected function parseIsPasswordGrantEnabled(string $value): Client
    {
        $value === '1' ? $this->enablePasswordGrant() : $this->disablePasswordGrant();

        return $this;
    }
321499
public function setCoreEmailsubject($value)
    {
        $this->setFieldName('emailsubject');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
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);
    }
372783
public static function fromValue($value): self
    {
        if ($value instanceof self) {
            return $value;
        }

        if (\is_string($value)) {
            try {
                return self::fromJson($value);
            } catch (InvalidArgumentException $e) {
                return self::fromJsonFile($value);
            }
        }

        if (\is_array($value)) {
            return self::fromArray($value);
        }

        throw new InvalidArgumentException('Invalid service account specification.');
    }
923019
public function setCoreEmailsender($value)
    {
        $this->setFieldName('emailsender');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
1143812
protected function Sub($value)
	{
		switch ( $value->GetValueCode() )
		{
			case DateTimeProxyFactory::Code:
				return new DayTimeDurationProxy( DateTimeValue::Sub( $this->_value, /* DateTimeValue */ $value->getValue() ) );

			case YearMonthDurationProxyFactory::Code:
				/**
				 * @var DayTimeDurationProxy $value
				 */
				// Clone the DateValue contained in the proxy or the original is changed
				$clone = DateTimeValue::fromDate( $this->_value->S, clone $this->_value->Value, ! $this->_value->IsLocal );
				$value->getValue()->Value->invert = ! $value->getValue()->Value->invert;
				return new DateTimeProxy( DateTimeValue::AddYearMonthDuration( $clone, $value->getValue() ) );
				// return new DateTimeProxy( DateTimeValue::Add( $this->_value, - /* YearMonthDurationValue */ $value->getValue() ) );

			case DayTimeDurationProxyFactory::Code:
				/**
				 * @var DayTimeDurationProxy $value
				 */
				// Clone the DateValue contained in the proxy or the original is changed
				$clone = DateTimeValue::fromDate( $this->_value->S, clone $this->_value->Value, ! $this->_value->IsLocal );
				$value->getValue()->Value->invert = ! $value->getValue()->Value->invert;
				return new DateTimeProxy( DateTimeValue::AddDayTimeDuration( $clone, $value->getValue() ) );
				// return new DateTimeProxy( DateTimeValue::Add( $this->_value, - /* DayTimeDurationValue */ $value->getValue() ) );

			default:
				throw XPath2Exception::withErrorCodeAndParams("XPTY0004", Resources::BinaryOperatorNotDefined,
					array(
						"op:sub",
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $this->_value), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $value->getValue() ), XmlTypeCardinality::One )
					)
				);
		}
	}