Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DomainTooLong example
$end
=
$this
->
checkEndOfDomain
(
)
;
if
(
$end
->
isInvalid
(
)
)
{
return
$end
;
}
$this
->lexer->
stopRecording
(
)
;
$this
->domainPart =
$this
->lexer->
getAccumulatedValues
(
)
;
$length
=
strlen
(
$this
->domainPart
)
;
if
(
$length
> self::DOMAIN_MAX_LENGTH
)
{
return
new
InvalidEmail
(
new
DomainTooLong
(
)
,
$this
->lexer->current->value
)
;
}
return
new
ValidEmail
(
)
;
}
private
function
checkEndOfDomain
(
)
: Result
{
$prev
=
$this
->lexer->
getPrevious
(
)
;
if
(
$prev
->
isA
(
EmailLexer::S_DOT
)
)
{
return
new
InvalidEmail
(
new
DotAtEnd
(
)
,
$this
->lexer->current->value
)
;
}