Completed
Pull Request — master (#100)
by Eduardo Gulias
01:47
created

SpoofCheckValidation::getError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Egulias\EmailValidator\Validation;
4
5
use Egulias\EmailValidator\EmailLexer;
6
use Egulias\EmailValidator\Validation\Error\SpoofEmail;
7
use \Spoofchecker;
8
9
class SpoofCheckValidation implements EmailValidation
10
{
11
    /**
12
     * @var InvalidEmail
13
     */
14
    private $error;
15
16
    public function isValid($email, EmailLexer $emailLexer)
17
    {
18
        $checker = new Spoofchecker();
19
        $checker->setChecks(Spoofchecker::SINGLE_SCRIPT);
20
        
21
        if ($checker->isSuspicious($email)) {
22
            $this->error = new SpoofEmail();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Egulias\EmailValida...tion\Error\SpoofEmail() of type object<Egulias\EmailVali...ation\Error\SpoofEmail> is incompatible with the declared type object<Egulias\EmailVali...alidation\InvalidEmail> of property $error.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
            return false;
24
        }
25
        
26
        return true;
27
    }
28
29
    public function getError()
30
    {
31
        return $this->error;
32
    }
33
34
    public function getWarnings()
35
    {
36
        return [];
37
    }
38
}
39