1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2016 SURFnet B.V. |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\Stepup\Configuration\Event; |
20
|
|
|
|
21
|
|
|
use Broadway\Serializer\SerializableInterface; |
22
|
|
|
use Surfnet\Stepup\Configuration\Value\Institution; |
23
|
|
|
use Surfnet\Stepup\Configuration\Value\InstitutionConfigurationId; |
24
|
|
|
use Surfnet\Stepup\Configuration\Value\InstitutionRole; |
25
|
|
|
use Surfnet\Stepup\Configuration\Value\InstitutionSet; |
26
|
|
|
use Surfnet\Stepup\Configuration\Value\NumberOfTokensPerIdentityOption; |
27
|
|
|
use Surfnet\Stepup\Configuration\Value\SelectRaaOption; |
28
|
|
|
use Surfnet\Stepup\Configuration\Value\ShowRaaContactInformationOption; |
29
|
|
|
use Surfnet\Stepup\Configuration\Value\UseRaaOption; |
30
|
|
|
use Surfnet\Stepup\Configuration\Value\UseRaLocationsOption; |
31
|
|
|
use Surfnet\Stepup\Configuration\Value\InstitutionOption; |
32
|
|
|
use Surfnet\Stepup\Configuration\Value\VerifyEmailOption; |
33
|
|
|
|
34
|
|
|
class NewInstitutionConfigurationCreatedEvent implements SerializableInterface |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* @var InstitutionConfigurationId |
38
|
|
|
*/ |
39
|
|
|
public $institutionConfigurationId; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var Institution |
43
|
|
|
*/ |
44
|
|
|
public $institution; |
45
|
|
|
/** |
46
|
|
|
* @var UseRaLocationsOption |
47
|
|
|
*/ |
48
|
|
|
public $useRaLocationsOption; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var ShowRaaContactInformationOption |
52
|
|
|
*/ |
53
|
|
|
public $showRaaContactInformationOption; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var VerifyEmailOption |
57
|
|
|
*/ |
58
|
|
|
public $verifyEmailOption; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var NumberOfTokensPerIdentityOption |
62
|
|
|
*/ |
63
|
|
|
public $numberOfTokensPerIdentityOption; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @var InstitutionOption |
67
|
|
|
*/ |
68
|
|
|
public $useRaOption; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @var InstitutionOption |
72
|
|
|
*/ |
73
|
|
|
public $useRaaOption; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var InstitutionOption |
77
|
|
|
*/ |
78
|
|
|
public $selectRaaOption; |
79
|
|
|
|
80
|
|
|
public function __construct( |
81
|
|
|
InstitutionConfigurationId $institutionConfigurationId, |
82
|
|
|
Institution $institution, |
83
|
|
|
UseRaLocationsOption $useRaLocationsOption, |
84
|
|
|
ShowRaaContactInformationOption $showRaaContactInformationOption, |
85
|
|
|
VerifyEmailOption $verifyEmailOption, |
86
|
|
|
NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption, |
87
|
|
|
InstitutionOption $useRaOption, |
88
|
|
|
InstitutionOption $useRaaOption, |
89
|
|
|
InstitutionOption $selectRaaOption |
90
|
|
|
) { |
91
|
|
|
$this->institutionConfigurationId = $institutionConfigurationId; |
92
|
|
|
$this->institution = $institution; |
93
|
|
|
$this->useRaLocationsOption = $useRaLocationsOption; |
94
|
|
|
$this->showRaaContactInformationOption = $showRaaContactInformationOption; |
95
|
|
|
$this->verifyEmailOption = $verifyEmailOption; |
96
|
|
|
$this->numberOfTokensPerIdentityOption = $numberOfTokensPerIdentityOption; |
97
|
|
|
$this->useRaOption = $useRaOption; |
98
|
|
|
$this->useRaaOption = $useRaaOption; |
99
|
|
|
$this->selectRaaOption = $selectRaaOption; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public static function deserialize(array $data) |
103
|
|
|
{ |
104
|
|
|
if (!isset($data['verify_email_option'])) { |
105
|
|
|
$data['verify_email_option'] = true; |
106
|
|
|
} |
107
|
|
|
if (!isset($data['number_of_tokens_per_identity_option'])) { |
108
|
|
|
$data['number_of_tokens_per_identity_option'] = NumberOfTokensPerIdentityOption::DISABLED; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
// Support FGA options on PRE FGA events |
112
|
|
|
if (!isset($data['use_ra_option'])) { |
113
|
|
|
$data['use_ra_option'] = InstitutionOption::blank(); |
|
|
|
|
114
|
|
|
} |
115
|
|
|
if (!isset($data['use_raa_option'])) { |
116
|
|
|
$data['use_raa_option'] = InstitutionOption::blank(); |
|
|
|
|
117
|
|
|
} |
118
|
|
|
if (!isset($data['select_raa_option'])) { |
119
|
|
|
$data['select_raa_option'] = InstitutionOption::blank(); |
|
|
|
|
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
$institution = new Institution($data['institution']); |
123
|
|
|
|
124
|
|
|
return new self( |
125
|
|
|
new InstitutionConfigurationId($data['institution_configuration_id']), |
126
|
|
|
new Institution($data['institution']), |
127
|
|
|
new UseRaLocationsOption($data['use_ra_locations_option']), |
128
|
|
|
new ShowRaaContactInformationOption($data['show_raa_contact_information_option']), |
129
|
|
|
new VerifyEmailOption($data['verify_email_option']), |
130
|
|
|
new NumberOfTokensPerIdentityOption($data['number_of_tokens_per_identity_option']), |
131
|
|
|
InstitutionOption::fromInstitutionConfig(InstitutionRole::useRa(), $institution, $data['use_ra_option']), |
132
|
|
|
InstitutionOption::fromInstitutionConfig(InstitutionRole::useRaa(), $institution, $data['use_raa_option']), |
133
|
|
|
InstitutionOption::fromInstitutionConfig(InstitutionRole::selectRaa(), $institution, $data['select_raa_option']) |
134
|
|
|
); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function serialize() |
138
|
|
|
{ |
139
|
|
|
return [ |
140
|
|
|
'institution_configuration_id' => $this->institutionConfigurationId->getInstitutionConfigurationId(), |
141
|
|
|
'institution' => $this->institution->getInstitution(), |
142
|
|
|
'use_ra_locations_option' => $this->useRaLocationsOption->isEnabled(), |
143
|
|
|
'show_raa_contact_information_option' => $this->showRaaContactInformationOption->isEnabled(), |
144
|
|
|
'verify_email_option' => $this->verifyEmailOption->isEnabled(), |
145
|
|
|
'number_of_tokens_per_identity_option' => $this->numberOfTokensPerIdentityOption->getNumberOfTokensPerIdentity(), |
146
|
|
|
'use_ra_option' => $this->useRaOption->getInstitutionSet()->toScalarArray(), |
147
|
|
|
'use_raa_option' => $this->useRaaOption->getInstitutionSet()->toScalarArray(), |
148
|
|
|
'select_raa_option' => $this->selectRaaOption->getInstitutionSet()->toScalarArray(), |
149
|
|
|
]; |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.