InvalidEmail::isValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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