Small if refactor

This commit is contained in:
Eduardo Gulias Davis
2014-05-08 12:51:25 +02:00
parent 77ea3babe3
commit 73b80f1383
+8 -7
View File
@@ -324,7 +324,6 @@ class EmailParser
$this->warnEscaping();
if ($this->lexer->isNextTokenAny(
array(
EmailLexer::INVALID, EmailLexer::S_LOWERTHAN, EmailLexer::S_GREATERTHAN
@@ -384,16 +383,18 @@ class EmailParser
{
$previous = $this->lexer->getPrevious();
if ($this->lexer->token['type'] === EmailLexer::CRLF && $this->lexer->isNextToken(EmailLexer::CRLF)) {
throw new \InvalidArgumentException("ERR_FWS_CRLF_X2");
if ($this->lexer->token['type'] === EmailLexer::CRLF) {
if ($this->lexer->isNextToken(EmailLexer::CRLF)) {
throw new \InvalidArgumentException("ERR_FWS_CRLF_X2");
}
if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) {
throw new \InvalidArgumentException("ERR_FWS_CRLF_END");
}
}
if ($this->lexer->token['type'] === EmailLexer::S_CR) {
throw new \InvalidArgumentException("ERR_CR_NO_LF");
}
if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB)) &&
$this->lexer->token['type'] === EmailLexer::CRLF ) {
throw new \InvalidArgumentException("ERR_FWS_CRLF_END");
}
if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) {
throw new \InvalidArgumentException("ERR_ATEXT_AFTER_CFWS");