This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace OpenConext\Value\Saml\Metadata; |
||
4 | |||
5 | use OpenConext\Value\Assert\Assertion; |
||
6 | use OpenConext\Value\Saml\Metadata\ContactPerson\Company; |
||
7 | use OpenConext\Value\Saml\Metadata\ContactPerson\ContactType; |
||
8 | use OpenConext\Value\Saml\Metadata\ContactPerson\EmailAddressList; |
||
9 | use OpenConext\Value\Saml\Metadata\ContactPerson\GivenName; |
||
10 | use OpenConext\Value\Saml\Metadata\ContactPerson\Surname; |
||
11 | use OpenConext\Value\Saml\Metadata\ContactPerson\TelephoneNumberList; |
||
12 | use OpenConext\Value\Serializable; |
||
13 | |||
14 | final class ContactPerson implements Serializable |
||
15 | { |
||
16 | /** |
||
17 | * @var ContactType |
||
18 | */ |
||
19 | private $contactType; |
||
20 | |||
21 | /** |
||
22 | * @var EmailAddressList |
||
23 | */ |
||
24 | private $emailAddressList; |
||
25 | |||
26 | /** |
||
27 | * @var TelephoneNumberList |
||
28 | */ |
||
29 | private $telephoneNumberList; |
||
30 | |||
31 | /** |
||
32 | * @var GivenName|null |
||
33 | */ |
||
34 | private $givenName; |
||
35 | |||
36 | /** |
||
37 | * @var Surname|null |
||
38 | */ |
||
39 | private $surname; |
||
40 | |||
41 | /** |
||
42 | * @var Company|null |
||
43 | */ |
||
44 | private $company; |
||
45 | |||
46 | public function __construct( |
||
47 | ContactType $contactType, |
||
48 | EmailAddressList $emailAddressList, |
||
49 | TelephoneNumberList $telephoneNumberList, |
||
50 | GivenName $givenName = null, |
||
51 | Surname $surname = null, |
||
52 | Company $company = null |
||
53 | ) { |
||
54 | $this->contactType = $contactType; |
||
55 | $this->emailAddressList = $emailAddressList; |
||
56 | $this->telephoneNumberList = $telephoneNumberList; |
||
57 | $this->givenName = $givenName; |
||
58 | $this->surname = $surname; |
||
59 | $this->company = $company; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param ContactPerson $other |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function equals(ContactPerson $other) |
||
67 | { |
||
68 | if (!$this->contactType->equals($other->contactType)) { |
||
69 | return false; |
||
70 | } |
||
71 | |||
72 | if (!$this->emailAddressList->equals($other->emailAddressList)) { |
||
73 | return false; |
||
74 | } |
||
75 | |||
76 | if (!$this->telephoneNumberList->equals($other->telephoneNumberList)) { |
||
77 | return false; |
||
78 | } |
||
79 | |||
80 | if ($this->givenName != $other->givenName) { |
||
81 | return false; |
||
82 | } |
||
83 | |||
84 | if ($this->surname != $other->surname) { |
||
85 | return false; |
||
86 | } |
||
87 | |||
88 | if ($this->company != $other->company) { |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
89 | return false; |
||
90 | } |
||
91 | |||
92 | return true; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return ContactType |
||
97 | */ |
||
98 | public function getContactType() |
||
99 | { |
||
100 | return $this->contactType; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @return EmailAddressList |
||
105 | */ |
||
106 | public function getEmailAddressList() |
||
107 | { |
||
108 | return $this->emailAddressList; |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * @return TelephoneNumberList |
||
113 | */ |
||
114 | public function getTelephoneNumberList() |
||
115 | { |
||
116 | return $this->telephoneNumberList; |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * @return null|GivenName |
||
121 | */ |
||
122 | public function getGivenName() |
||
123 | { |
||
124 | return $this->givenName; |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * @return null|Surname |
||
129 | */ |
||
130 | public function getSurname() |
||
131 | { |
||
132 | return $this->surname; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @return null|Company |
||
137 | */ |
||
138 | public function getCompany() |
||
139 | { |
||
140 | return $this->company; |
||
141 | } |
||
142 | |||
143 | public static function deserialize($data) |
||
144 | { |
||
145 | Assertion::isArray($data); |
||
146 | Assertion::keysExist( |
||
147 | $data, |
||
148 | array('contact_type', 'email_address_list', 'telephone_number_list', 'given_name', 'surname', 'company') |
||
149 | ); |
||
150 | |||
151 | $contact = new self( |
||
152 | ContactType::deserialize($data['contact_type']), |
||
153 | EmailAddressList::deserialize($data['email_address_list']), |
||
154 | TelephoneNumberList::deserialize($data['telephone_number_list']) |
||
155 | ); |
||
156 | |||
157 | if ($data['given_name']) { |
||
158 | $contact->givenName = GivenName::deserialize($data['given_name']); |
||
159 | } |
||
160 | |||
161 | if ($data['surname']) { |
||
162 | $contact->surname = Surname::deserialize($data['surname']); |
||
163 | } |
||
164 | |||
165 | if ($data['company']) { |
||
166 | $contact->company = Company::deserialize($data['company']); |
||
167 | } |
||
168 | |||
169 | return $contact; |
||
170 | } |
||
171 | |||
172 | public function serialize() |
||
173 | { |
||
174 | return array( |
||
175 | 'contact_type' => $this->contactType->serialize(), |
||
176 | 'email_address_list' => $this->emailAddressList->serialize(), |
||
177 | 'telephone_number_list' => $this->telephoneNumberList->serialize(), |
||
178 | 'given_name' => ($this->givenName ? $this->givenName->serialize() : null), |
||
179 | 'surname' => ($this->surname ? $this->surname->serialize() : null), |
||
180 | 'company' => ($this->company ? $this->company->serialize() : null) |
||
181 | ); |
||
182 | } |
||
183 | |||
184 | public function __toString() |
||
185 | { |
||
186 | return sprintf( |
||
187 | 'ContactPerson(%s, =%s, %s%s%s%s)', |
||
188 | 'ContactType=' . $this->contactType, |
||
189 | 'EmailAddressList=' . $this->emailAddressList, |
||
190 | 'TelephoneNumberList=' . $this->telephoneNumberList, |
||
191 | ($this->givenName ? ', GivenName=' . $this->givenName : ''), |
||
192 | ($this->surname ? ', Surname=' . $this->surname : ''), |
||
193 | ($this->company ? ', Company=' . $this->company : '') |
||
194 | ); |
||
195 | } |
||
196 | } |
||
197 |