SamlSpInfo::getAuthenticationServiceID()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace AerialShip\SamlSPBundle\Bridge;
4
5
use AerialShip\LightSaml\Model\Assertion\Attribute;
6
use AerialShip\LightSaml\Model\Assertion\AuthnStatement;
7
use AerialShip\LightSaml\Model\Assertion\NameID;
8
9
class SamlSpInfo implements \Serializable
10
{
11
    /** @var  string */
12
    protected $authenticationServiceID;
13
14
    /** @var NameID */
15
    protected $nameID;
16
17
    /** @var Attribute[] */
18
    protected $attributes;
19
20
    /** @var  AuthnStatement */
21
    protected $authnStatement;
22
23
24
    /**
25
     * @param string $authenticationServiceID
26
     * @param NameID|null $nameID
27
     * @param Attribute[] $attributes
28
     * @param \AerialShip\LightSaml\Model\Assertion\AuthnStatement $authnStatement
29
     */
30 26
    public function __construct($authenticationServiceID, NameID $nameID = null, array $attributes = null, AuthnStatement $authnStatement = null)
31
    {
32 26
        $this->authenticationServiceID = $authenticationServiceID;
33 26
        $this->nameID = $nameID;
34 26
        $this->attributes = $attributes === null ? array() : $attributes;
35 26
        $this->authnStatement = $authnStatement;
36 26
    }
37
38
39
    /**
40
     * @return \AerialShip\LightSaml\Model\Assertion\Attribute[]
41
     */
42 18
    public function getAttributes()
43
    {
44 18
        return $this->attributes;
45
    }
46
47
    /**
48
     * @param Attribute $attr
49
     * @return SamlSpInfo
50
     */
51
    public function addAttribute(Attribute $attr)
52
    {
53
        $this->attributes[] = $attr;
54
        return $this;
55
    }
56
57
    /**
58
     * @param \AerialShip\LightSaml\Model\Assertion\NameID $nameID
59
     */
60
    public function setNameID($nameID)
61
    {
62
        $this->nameID = $nameID;
63
    }
64
65
    /**
66
     * @return \AerialShip\LightSaml\Model\Assertion\NameID
67
     */
68 17
    public function getNameID()
69
    {
70 17
        return $this->nameID;
71
    }
72
73
    /**
74
     * @param \AerialShip\LightSaml\Model\Assertion\AuthnStatement $authnStatement
75
     */
76
    public function setAuthnStatement($authnStatement)
77
    {
78
        $this->authnStatement = $authnStatement;
79
    }
80
81
    /**
82
     * @return \AerialShip\LightSaml\Model\Assertion\AuthnStatement
83
     */
84 17
    public function getAuthnStatement()
85
    {
86 17
        return $this->authnStatement;
87
    }
88
89
    /**
90
     * @param string $authenticationServiceID
91
     */
92
    public function setAuthenticationServiceID($authenticationServiceID)
93
    {
94
        $this->authenticationServiceID = $authenticationServiceID;
95
    }
96
97
    /**
98
     * @return string
99
     */
100 1
    public function getAuthenticationServiceID()
101
    {
102 1
        return $this->authenticationServiceID;
103
    }
104
105
106
107
108
109
110
    /**
111
     * {@inheritdoc}
112
     */
113 2
    public function serialize()
114
    {
115 2
        return serialize(array($this->authenticationServiceID, $this->nameID, $this->attributes, $this->authnStatement));
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121 2
    public function unserialize($serialized)
122
    {
123 2
        list($this->authenticationServiceID, $this->nameID, $this->attributes, $this->authnStatement) = unserialize($serialized);
124 2
    }
125
}
126