if ($this->operator === self::OPERATOR_EMPTY
) { return $constraints;
} $constraints['zipCodes'
] =
[new NotBlank(),
new ArrayOfType('string'
)];
return $constraints;
} protected function matchZipCode(CustomerAddressEntity
$address): bool
{ $zipCode =
$this->
sanitizeZipCode($address);
if ($this->zipCodes === null &&
$this->operator !== self::OPERATOR_EMPTY
) { throw new UnsupportedValueException(\
gettype($this->zipCodes
), self::
class);
} $compareZipCode = \
is_array($this->zipCodes
) ?
$this->zipCodes
[0
] : null;
return match ($this->operator
) { Rule::OPERATOR_EQ => !
empty($this->
getMatches($zipCode)),
Rule::OPERATOR_NEQ =>
empty($this->
getMatches($zipCode)),
self::OPERATOR_GTE =>
is_numeric($zipCode) &&
is_numeric($compareZipCode) && FloatComparator::
greaterThanOrEquals((float) $zipCode,
(float) $compareZipCode),