SamlSpInfo   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 117
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 61.29%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 12
c 5
b 0
f 1
lcom 1
cbo 0
dl 0
loc 117
ccs 19
cts 31
cp 0.6129
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A getAttributes() 0 4 1
A addAttribute() 0 5 1
A setNameID() 0 4 1
A getNameID() 0 4 1
A setAuthnStatement() 0 4 1
A getAuthnStatement() 0 4 1
A setAuthenticationServiceID() 0 4 1
A getAuthenticationServiceID() 0 4 1
A serialize() 0 4 1
A unserialize() 0 4 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