Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isEmail example
/** * @param string[] $addresses * * @throws ConstraintViolationException */
private
function
assertValidAddresses
(
array
$addresses
)
: void
{
$constraints
=
(
new
ConstraintBuilder
(
)
)
->
isNotBlank
(
)
->
isEmail
(
)
->
getConstraints
(
)
;
$violations
=
new
ConstraintViolationList
(
)
;
foreach
(
$addresses
as
$address
)
{
$violations
->
addAll
(
$this
->validator->
validate
(
$address
,
$constraints
)
)
;
}
if
(
$violations
->
count
(
)
> 0
)
{
throw
new
ConstraintViolationException
(
$violations
,
$addresses
)
;
}
}