EmailAddress   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 49
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A deserialize() 0 4 1
A serialize() 0 4 1
A __construct() 0 6 1
A equals() 0 4 1
A getEmailAddress() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace OpenConext\Value\Saml\Metadata\ContactPerson;
4
5
use OpenConext\Value\Assert\Assertion;
6
use OpenConext\Value\Serializable;
7
8
final class EmailAddress implements Serializable
9
{
10
    /**
11
     * @var string
12
     */
13
    private $emailAddress;
14
15
    /**
16
     * @param string $emailAddress RFC 822 compliant email address
17
     */
18
    public function __construct($emailAddress)
19
    {
20
        Assertion::email($emailAddress);
21
22
        $this->emailAddress = $emailAddress;
23
    }
24
25
    /**
26
     * @param EmailAddress $other
27
     * @return bool
28
     */
29
    public function equals(EmailAddress $other)
30
    {
31
        return $this->emailAddress === $other->emailAddress;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getEmailAddress()
38
    {
39
        return $this->emailAddress;
40
    }
41
42
    public static function deserialize($data)
43
    {
44
        return new self($data);
45
    }
46
47
    public function serialize()
48
    {
49
        return $this->emailAddress;
50
    }
51
52
    public function __toString()
53
    {
54
        return $this->emailAddress;
55
    }
56
}
57