Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 150
Zeile 5... Zeile 5...
5
use Egulias\EmailValidator\EmailLexer;
5
use Egulias\EmailValidator\EmailLexer;
6
use Egulias\EmailValidator\Result\InvalidEmail;
6
use Egulias\EmailValidator\Result\InvalidEmail;
7
use Egulias\EmailValidator\Result\Reason\ConsecutiveDot;
7
use Egulias\EmailValidator\Result\Reason\ConsecutiveDot;
8
use Egulias\EmailValidator\Result\Result;
8
use Egulias\EmailValidator\Result\Result;
9
use Egulias\EmailValidator\Result\ValidEmail;
9
use Egulias\EmailValidator\Result\ValidEmail;
-
 
10
use Egulias\EmailValidator\Warning\Warning;
Zeile 10... Zeile 11...
10
 
11
 
11
abstract class PartParser
12
abstract class PartParser
12
{
13
{
13
    /**
14
    /**
14
     * @var array
15
     * @var Warning[]
15
     */
16
     */
Zeile 16... Zeile 17...
16
    protected $warnings = [];
17
    protected $warnings = [];
17
 
18
 
Zeile 23... Zeile 24...
23
    public function __construct(EmailLexer $lexer)
24
    public function __construct(EmailLexer $lexer)
24
    {
25
    {
25
        $this->lexer = $lexer;
26
        $this->lexer = $lexer;
26
    }
27
    }
Zeile 27... Zeile 28...
27
 
28
 
Zeile 28... Zeile 29...
28
    abstract public function parse() : Result;
29
    abstract public function parse(): Result;
29
 
30
 
30
    /**
31
    /**
31
     * @return \Egulias\EmailValidator\Warning\Warning[]
32
     * @return Warning[]
32
     */
33
     */
33
    public function getWarnings()
34
    public function getWarnings()
34
    {
35
    {
Zeile 35... Zeile 36...
35
        return $this->warnings;
36
        return $this->warnings;
36
    }
37
    }
37
 
38
 
38
    protected function parseFWS() : Result
39
    protected function parseFWS(): Result
39
    {
40
    {
40
        $foldingWS = new FoldingWhiteSpace($this->lexer);
41
        $foldingWS = new FoldingWhiteSpace($this->lexer);
41
        $resultFWS = $foldingWS->parse();
42
        $resultFWS = $foldingWS->parse();
Zeile 42... Zeile 43...
42
        $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings());
43
        $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings());
43
        return $resultFWS;
44
        return $resultFWS;
44
    }
45
    }
45
 
46
 
46
    protected function checkConsecutiveDots() : Result
47
    protected function checkConsecutiveDots(): Result
Zeile 47... Zeile 48...
47
    {
48
    {
48
        if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
49
        if ($this->lexer->current->isA(EmailLexer::S_DOT) && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
Zeile 49... Zeile 50...
49
            return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']);
50
            return new InvalidEmail(new ConsecutiveDot(), $this->lexer->current->value);
50
        }
51
        }
51
 
52
 
Zeile 52... Zeile 53...
52
        return new ValidEmail();
53
        return new ValidEmail();
53
    }
-
 
54
 
54
    }
55
    protected function escaped() : bool
55
 
56
    {
56
    protected function escaped(): bool