Completed
Push — master ( 141360...6dcb9d )
by Adam
03:25
created

Email::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php namespace BestServedCold\PhalueObjects\Internet;
2
3
use BestServedCold\PhalueObjects\Exception\InvalidRangeTypeException;
4
use BestServedCold\PhalueObjects\ValueObject;
5
use BestServedCold\PhalueObjects\Exception\InvalidTypeException;
6
7
final class Email extends ValueObject
8
{
9
    public function __construct($value)
10
    {
11
        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
12
            throw new InvalidTypeException($value, [ 'email' ]);
13
        }
14
15
        parent::__construct($value);
16
    }
17
18
    public function equals(Email $address)
0 ignored issues
show
Coding Style introduced by
function equals() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
19
    {
20
        return strtolower((string) $this) === strtolower((string) $address);
21
    }
22
}
23