Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
NoRFCWarningsValidation example
$constraint
->mode =
$this
->defaultMode;
}
if
(
!\
in_array
(
$constraint
->mode, Email::VALIDATION_MODES, true
)
)
{
throw
new
InvalidArgumentException
(
sprintf
(
'The "%s::$mode" parameter value is not valid.',
get_debug_type
(
$constraint
)
)
)
;
}
if
(
Email::VALIDATION_MODE_STRICT ===
$constraint
->mode
)
{
$strictValidator
=
new
EguliasEmailValidator
(
)
;
if
(
interface_exists
(
EmailValidation::
class
)
&& !
$strictValidator
->
isValid
(
$value
,
new
NoRFCWarningsValidation
(
)
)
)
{
$this
->context->
buildViolation
(
$constraint
->message
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
Email::INVALID_FORMAT_ERROR
)
->
addViolation
(
)
;
return
;
}
elseif
(
!
interface_exists
(
EmailValidation::
class
)
&& !
$strictValidator
->
isValid
(
$value
, false, true
)
)
{
$this
->context->
buildViolation
(
$constraint
->message
)
->
setParameter
(
'{{ value }}',
$this
->
formatValue
(
$value
)
)
->
setCode
(
Email::INVALID_FORMAT_ERROR
)
->
addViolation
(
)
;