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

InvalidEmail::code()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 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
    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
}