Completed
Pull Request — develop (#166)
by Daan van
22:27 queued 19:06
created

InstitutionConfigurationProvider::loadData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
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
     * @var InstitutionConfigurationOptionsService
33
     */
34
    private $institutionConfigurationOptionsService;
35
    /**
36
     * @var RaLocationService
37
     */
38
    private $raLocationService;
39
40
    /**
41
     * @param ConfiguredInstitutionService           $configuredInstitutionService
42
     * @param InstitutionConfigurationOptionsService $institutionConfigurationOptionsService
43
     * @param RaLocationService                      $raLocationService
44
     */
45
    public function __construct(
46
        ConfiguredInstitutionService $configuredInstitutionService,
47
        InstitutionConfigurationOptionsService $institutionConfigurationOptionsService,
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $institutionConfigurationOptionsService exceeds the maximum configured length of 30.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
48
        RaLocationService $raLocationService
49
    ) {
50
        $this->configuredInstitutionService = $configuredInstitutionService;
51
        $this->institutionConfigurationOptionsService = $institutionConfigurationOptionsService;
52
        $this->raLocationService = $raLocationService;
53
    }
54
55
    public function loadData()
56
    {
57
        $configuredInstitutions = $this->configuredInstitutionService->getAll();
58
        $institutionConfigurationOptions = $this->institutionConfigurationOptionsService
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $institutionConfigurationOptions exceeds the maximum configured length of 30.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
59
            ->findAllInstitutionConfigurationOptions();
60
        $raLocations = $this->raLocationService->getAllRaLocations();
61
62
        return InstitutionConfigurationState::load(
63
            $configuredInstitutions,
64
            $institutionConfigurationOptions,
65
            $raLocations
66
        );
67
    }
68
}
69