Email   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 7 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace PersonalGalaxy\Identity\Entity\Identity;
5
6
use PersonalGalaxy\Identity\Exception\DomainException;
7
8
final class Email
9
{
10
    private $value;
11
12 21
    public function __construct(string $value)
13
    {
14 21
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
15 1
            throw new DomainException;
16
        }
17
18 20
        $this->value = $value;
19 20
    }
20
21 4
    public function __toString(): string
22
    {
23 4
        return $this->value;
24
    }
25
}
26