Completed
Push — master ( 1cea30...381bb7 )
by Thijs
08:24
created

BaseID::getSPNameQualifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SAML2;
4
5
/**
6
 * Base class for BaseID element.
7
 */
8
abstract class BaseID
9
{
10
    /**
11
     * The security or administrative domain that qualifies the identifier.
12
     * This attribute provides a means to federate identifiers from disparate user stores without collision.
13
     *
14
     * @var string|null
15
     */
16
    private $nameQualifier;
17
18
    /**
19
     * Further qualifies an identifier with the name of a service provider or affiliation of providers.
20
     * This attribute provides an additional means to federate identifiers on the basis of the relying party or parties.
21
     *
22
     * @var string|null
23
     */
24
    private $spNameQualifier;
25
26
    /**
27
     * Represent an entity by a string-valued.
28
     *
29
     * @var string
30
     */
31
    private $entity;
32
33
    /**
34
     * Constructor for SAML 2 BaseID.
35
     *
36
     * @param string $entity The entity name
37
     */
38
    protected function __construct($entity)
39
    {
40
        $this->setEntity($entity);
41
    }
42
43
    /**
44
     * Retrieve the entity name.
45
     *
46
     * @return string The entity name
47
     */
48
    public function getEntity()
49
    {
50
        return $this->entity;
51
    }
52
53
    /**
54
     * Set the the entity name.
55
     *
56
     * @param string $entity The entity name
57
     */
58
    public function setEntity($entity)
59
    {
60
        assert('is_string($entity)');
61
62
        $this->entity = $entity;
63
    }
64
65
    /**
66
     * Retrieve the name qualifier.
67
     *
68
     * @return string The name qualifier
69
     */
70
    public function getNameQualifier()
71
    {
72
        return $this->nameQualifier;
73
    }
74
75
    /**
76
     * Set the name qualifier.
77
     *
78
     * @param string $namequalifier The name qualifier
79
     */
80
    public function setNameQualifier($namequalifier)
81
    {
82
        assert('is_string($namequalifier) || is_null($namequalifier)');
83
84
        $this->nameQualifier = $namequalifier;
85
    }
86
87
    /**
88
     * Retrieve the service provider name qualifier·.
89
     *
90
     * @return string The service provider name qualifier
91
     */
92
    public function getSPNameQualifier()
93
    {
94
        return $this->spNameQualifier;
95
    }
96
97
    /**
98
     * Set the service provider name qualifier.
99
     *
100
     * @param string $spnamequalifier The service provider name qualifier
101
     */
102
    public function setSPNameQualifier($spnamequalifier)
103
    {
104
        assert('is_string($spnamequalifier) || is_null($spnamequalifier)');
105
106
        $this->spNameQualifier = $spnamequalifier;
107
    }
108
109
    public function __toString()
110
    {
111
        return $this->entity;
112
    }
113
}
114