1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2017 SURFnet bv |
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\StepupMiddleware\MiddlewareBundle\Migrations\InstitutionConfiguration; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Service\ConfiguredInstitutionService; |
22
|
|
|
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Service\InstitutionConfigurationOptionsService; |
23
|
|
|
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Service\RaLocationService; |
24
|
|
|
|
25
|
|
|
final class InstitutionConfigurationProvider |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @var ConfiguredInstitutionService |
29
|
|
|
*/ |
30
|
|
|
private $configuredInstitutionService; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var InstitutionConfigurationOptionsService |
34
|
|
|
*/ |
35
|
|
|
private $institutionConfigurationOptionsService; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var RaLocationService |
39
|
|
|
*/ |
40
|
|
|
private $raLocationService; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param ConfiguredInstitutionService $configuredInstitutionService |
44
|
|
|
* @param InstitutionConfigurationOptionsService $institutionConfigurationOptionsService |
45
|
|
|
* @param RaLocationService $raLocationService |
46
|
|
|
*/ |
47
|
|
|
public function __construct( |
48
|
|
|
ConfiguredInstitutionService $configuredInstitutionService, |
49
|
|
|
InstitutionConfigurationOptionsService $institutionConfigurationOptionsService, |
|
|
|
|
50
|
|
|
RaLocationService $raLocationService |
51
|
|
|
) { |
52
|
|
|
$this->configuredInstitutionService = $configuredInstitutionService; |
53
|
|
|
$this->institutionConfigurationOptionsService = $institutionConfigurationOptionsService; |
54
|
|
|
$this->raLocationService = $raLocationService; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function loadData() |
58
|
|
|
{ |
59
|
|
|
$configuredInstitutions = $this->configuredInstitutionService->getAll(); |
60
|
|
|
$institutionConfigurationOptions = $this->institutionConfigurationOptionsService |
|
|
|
|
61
|
|
|
->findAllInstitutionConfigurationOptions(); |
62
|
|
|
$raLocations = $this->raLocationService->getAllRaLocations(); |
63
|
|
|
|
64
|
|
|
return InstitutionConfigurationState::load( |
65
|
|
|
$configuredInstitutions, |
66
|
|
|
$institutionConfigurationOptions, |
67
|
|
|
$raLocations |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.