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

Email   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A equals() 0 4 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