Completed
Push — feature/more-metadata-values ( 2453e1...150bb6 )
by Daan van
03:33
created

OrganizationDisplayName::getLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace OpenConext\Value\Saml\Metadata\Organization;
4
5
use OpenConext\Value\Assert\Assertion;
6
use OpenConext\Value\Exception\InvalidArgumentException;
7
8
final class OrganizationDisplayName
9
{
10
    /**
11
     * @var string
12
     */
13
    private $displayName;
14
15
    /**
16
     * @var string
17
     */
18
    private $language;
19
20
    /**
21
     * @param string $displayName
22
     * @param string $language
23
     */
24
    public function __construct($displayName, $language)
25
    {
26
        Assertion::nonEmptyString($displayName, 'displayName');
27
        Assertion::nonEmptyString($language, 'language');
28
29
        $this->displayName = $displayName;
30
        $this->language = $language;
31
    }
32
33
    /**
34
     * @param OrganizationDisplayName $other
35
     * @return bool
36
     */
37
    public function equals(OrganizationDisplayName $other)
38
    {
39
        return ($this->displayName === $other->displayName && $this->language === $other->language);
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getDisplayName()
46
    {
47
        return $this->displayName;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getLanguage()
54
    {
55
        return $this->language;
56
    }
57
58
    public function __toString()
59
    {
60
        return sprintf('[%s] %s', $this->language, $this->displayName);
61
    }
62
}
63