GivenName::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 GivenName implements Serializable
9
{
10
    /**
11
     * @var string
12
     */
13
    private $givenName;
14
15
    /**
16
     * @param string $givenName
17
     */
18
    public function __construct($givenName)
19
    {
20
        Assertion::nonEmptyString($givenName, 'givenName');
21
22
        $this->givenName = $givenName;
23
    }
24
25
    /**
26
     * @param GivenName $other
27
     * @return bool
28
     */
29
    public function equals(GivenName $other)
30
    {
31
        return $this->givenName === $other->givenName;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getGivenName()
38
    {
39
        return $this->givenName;
40
    }
41
42
    public static function deserialize($data)
43
    {
44
        return new self($data);
45
    }
46
47
    public function serialize()
48
    {
49
        return $this->givenName;
50
    }
51
52
    public function __toString()
53
    {
54
        return $this->givenName;
55
    }
56
}
57