Test Setup Failed
Push — 3.0.0-dev ( 138fa6...61798f )
by Eduardo Gulias
08:15
created

InvalidEmail::reason()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Egulias\EmailValidator\Result;
4
5
use Egulias\EmailValidator\Result\Reason\Reason;
6
7
class InvalidEmail implements Result
8
{
9
    private  $token;
10
    /**
11
     * @var Reason
12
     */
13
    private $reason;
14
15
    public function __construct(Reason $reason, string $token)
16
    {
17
        $this->token = $token;
18
        $this->reason = $reason;
19
    }
20
21
    public function isValid(): bool
22
    {
23
        return false;
24
    }
25
26
    public function isInvalid(): bool
27
    {
28
        return true;
29
    }
30
31
    public function description(): string
32
    {
33
        return $this->reason->description() . " in char " . $this->token;
34
    }
35
36
    public function code(): int
37
    {
38
        return $this->reason->code();
39
    }
40
41
    public function reason() : Reason
42
    {
43
        return $this->reason;
44
    }
45
46
}