Completed
Push — master ( 1b6d66...884e6a )
by Adam
02:37
created

Email::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php namespace BestServedCold\PhalueObjects\Internet;
2
3
use BestServedCold\PhalueObjects\ValueObject;
4
use BestServedCold\PhalueObjects\Exception\InvalidTypeException;
5
6
final class Email extends ValueObject
7
{
8 1
    public function __construct($value)
9
    {
10 1
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
11 1
            throw new InvalidTypeException($value, [ 'email' ]);
12
        }
13
14 1
        parent::__construct($value);
15 1
    }
16
}
17