Passed
Push — 3.x ( 4cccb8...037594 )
by Eduardo Gulias
02:37
created

InvalidEmail   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 37
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A code() 0 3 1
A reason() 0 3 1
A isValid() 0 3 1
A __construct() 0 4 1
A description() 0 3 1
A isInvalid() 0 3 1
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
    protected $reason;
14
15 151
    public function __construct(Reason $reason, string $token)
16
    {
17 151
        $this->token = $token;
18 151
        $this->reason = $reason;
19 151
    }
20
21 8
    public function isValid(): bool
22
    {
23 8
        return false;
24
    }
25
26 127
    public function isInvalid(): bool
27
    {
28 127
        return true;
29
    }
30
31 1
    public function description(): string
32
    {
33 1
        return $this->reason->description() . " in char " . $this->token;
34
    }
35
36 1
    public function code(): int
37
    {
38 1
        return $this->reason->code();
39
    }
40
41 8
    public function reason() : Reason
42
    {
43 8
        return $this->reason;
44
    }
45
46
}