Email::__construct()   A
last analyzed

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
/**
7
 * Class Email
8
 *
9
 * @package BestServedCold\PhalueObjects\Internet
10
 */
11
final class Email extends ValueObject
12
{
13
    /**
14
     * Email constructor.
15
     *
16
     * @param $value
17
     */
18 1
    public function __construct($value)
19
    {
20 1
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
21 1
            throw new InvalidTypeException($value, [ 'email' ]);
22
        }
23
24 1
        parent::__construct($value);
25 1
    }
26
}
27