Completed
Pull Request — develop (#9)
by Daan van
16:17 queued 13:29
created

EmailAddress::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace OpenConext\Value\Saml\Metadata\ContactPerson;
4
5
use OpenConext\Value\Assert\Assertion;
6
7
final class EmailAddress
8
{
9
    /**
10
     * @var string
11
     */
12
    private $emailAddress;
13
14
    /**
15
     * @param string $emailAddress RFC 822 compliant email address
16
     */
17
    public function __construct($emailAddress)
18
    {
19
        Assertion::email($emailAddress);
20
21
        $this->emailAddress = $emailAddress;
22
    }
23
24
    /**
25
     * @param EmailAddress $other
26
     * @return bool
27
     */
28
    public function equals(EmailAddress $other)
29
    {
30
        return $this->emailAddress === $other->emailAddress;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getEmailAddress()
37
    {
38
        return $this->emailAddress;
39
    }
40
41
    public function __toString()
42
    {
43
        return $this->emailAddress;
44
    }
45
}
46