@param string $value

@throws DomainException

@return SubscriptionCancel
179248
public function setPolicy($value)
    {
        if (!in_array($value, self::policies(), true)) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_POLICY, implode(', ', self::policies())));
        }

        return $this->setAttribute('policy', $value);
    }
441876
protected function Sub( $value )
	{
		switch ( $value->GetValueCode() )
		{
			case YearMonthDurationProxyFactory::Code:
				/**
				 * @var YearMonthDurationProxy $value
				 */
				// return new YearMonthDurationProxy( new YearMonthDurationValue( $this->_value->HighPartValue - (/* YearMonthDurationValue */ $value->getValue() )->HighPartValue ) );
				$clone = new YearMonthDurationValue( $this->_value->Value );
				$clone->Sub( /* YearMonthDurationValue */ $value->getValue() );
				return new YearMonthDurationProxy( $clone );

			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 )
					)
				);
		}
	}
203915
public function setUserValue(string $value) : self
    {
        $this->user_value = $value;
        $this->is_valid = null;
        return $this;
    }
1035978
public function with($value): ValidableInterface
    {
        parent::with($value);
        
        if (false === ($value instanceof EntityInterface)) {
            throw new ValidatorException(sprintf('Validator accept only (%s) objects', EntityInterface::class));
        }
        
        return $this;
    }
411400
public function setStatus($value)
    {
        if (!in_array($value, self::statuses(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_STATUS, implode(', ', self::statuses())));
        }

        return $this->setAttribute('status', $value);
    }
702439
public function setEmail(string $value) : User
    {

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

        return $this;
    }
1122757
public function setReason($value)
    {
        if (!in_array($value, self::reasons(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_CATEGORY, implode(', ', self::reasons())));
        }

        return $this->setAttribute('reason', $value);
    }
1338137
public static function serializeValue($value)
    {
        if ($value instanceof JsonSerializable || $value instanceof \JsonSerializable) {
            return $value->jsonSerialize();
        }

        if (is_object($value)) {
            foreach (get_object_vars($value) as $nestedKey => $nestedValue) {
                $value->{$nestedKey} = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if (is_array($value)) {
            foreach ($value as &$nestedValue) {
                $nestedValue = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
            throw new DomainException('Please wrap your DateTime objects with Aplazame\Serializer\Date::fromDateTime');
        }

        if (is_float($value)) {
            throw new DomainException('Please wrap your float values with Aplazame\Serializer\Decimal::fromFloat');
        }

        return $value;
    }
296448
public function setPermissions($value)
    {
        $allowedResources = self::allowedResources();
        $allowedMethods = self::allowedMethods();

        if ($value !== null && !is_array($value)) {
            throw new DomainException(self::MSG_INVALID_FORMAT);
        }

        foreach ($value as $rule) {
            if (!is_array($rule)) {
                throw new DomainException(self::MSG_INVALID_FORMAT);
            }

            if (!empty($rule['resourceName']) && !in_array($rule['resourceName'], $allowedResources, true)) {
                throw new DomainException(sprintf(self::MSG_UNEXPECTED_RESOURCE, implode(', ', $allowedResources)));
            }

            if (!empty($rule['resourceIds']) && !is_array($rule['resourceIds'])) {
                throw new DomainException(self::MSG_INVALID_RESOURCE_IDS);
            }

            if (!empty($rule['methods']) && !is_array($rule['methods'])) {
                throw new DomainException(self::MSG_INVALID_METHODS);
            }

            if (!empty($rule['methods'])) {
                foreach ($rule['methods'] as $method) {
                    if (!in_array($method, $allowedMethods, true)) {
                        throw new DomainException(sprintf(self::MSG_UNEXPECTED_METHOD, implode(', ', $allowedMethods)));
                    }
                }
            }
        }

        return $this->setAttribute('permissions', $value);
    }
847241
public function setDatetimeFormat($value)
    {
        if (!in_array($value, self::datetimeFormats(), true)) {
            throw new DomainException(
                sprintf(self::MSG_UNEXPECTED_DATETIME_FORMAT, implode(', ', self::datetimeFormats()))
            );
        }

        return $this->setAttribute('datetimeFormat', $value);
    }
997616
public function setStatus($value)
    {
        $allowedStatuses = self::allowedStatuses();

        if (!in_array($value, $allowedStatuses, true)) {
            throw new DomainException(sprintf(self::MSG_UNEXPECTED_STATUS, implode(', ', $allowedStatuses)));
        }

        return $this->setAttribute('status', $value);
    }
285149
public function append($value)
    {
        if (strpos($value, self::SEPARATOR) !== false) {
            throw new LogicException('A value cannot contain delimiter');
        }

        array_push($this->collection, $value);
        return $this;
    }
440061
public function setSpreadsheetQuery($value)
    {
        if ($value != null) {
            $this->_params['sq'] = $value;
        } else {
            unset($this->_params['sq']);
        }
        return $this;
    }
612280
public function setExcludePolicy($value): self
    {
        if (!in_array($value, self::excludePolicies(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_POLICY, implode(', ', self::excludePolicies())));
        }

        return $this->setAttribute('excludePolicy', $value);
    }
1064613
protected function parseIsPasswordGrantEnabled(string $value): Client
    {
        $value === '1' ? $this->enablePasswordGrant() : $this->disablePasswordGrant();

        return $this;
    }
159080
public function setPromptPolicy($value): self
    {
        if (!in_array($value, self::promptPolicies(), true)) {
            throw new DomainException(sprintf(self::UNEXPECTED_POLICY, implode(', ', self::promptPolicies())));
        }

        return $this->setAttribute('promptPolicy', $value);
    }
588501
public function setTaxCategoryId($value)
    {
        if (!in_array($value, self::allowedTaxCategories(), true)) {
            throw new DomainException(sprintf(
                self::MSG_UNEXPECTED_TAX_CATEGORY,
                implode(', ', self::allowedTaxCategories())
            ));
        }

        return $this->setAttribute('taxCategoryId', $value);
    }