Completed
Push — feature/fine-grained-authoriza... ( 5fbefa )
by
unknown
02:52
created

InstitutionAuthorization   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 0
dl 0
loc 46
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 13 1
1
<?php
2
3
/**
4
 * Copyright 2018 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\StepupMiddleware\ApiBundle\Configuration\Entity;
20
21
use Doctrine\ORM\Mapping as ORM;
22
use Surfnet\Stepup\Configuration\Value\Institution;
23
use Surfnet\Stepup\Configuration\Value\InstitutionRole;
24
25
/**
26
 * @ORM\Entity(
27
 *      repositoryClass="Surfnet\StepupMiddleware\ApiBundle\Configuration\Repository\InstitutionAuthorizationRepository"
28
 * )
29
 */
30
class InstitutionAuthorization
31
{
32
    /**
33
     * @ORM\Id
34
     * @ORM\Column(type="stepup_configuration_institution")
35
     *
36
     * @var Institution
37
     */
38
    public $institution;
39
40
    /**
41
     * @ORM\Id
42
     * @ORM\Column(type="stepup_configuration_institution")
43
     *
44
     * @var Institution
45
     */
46
    public $institutionRelation;
47
48
    /**
49
     * @ORM\Id
50
     * @ORM\Column(type="stepup_institution_role", length=10)
51
     *
52
     * @var InstitutionRole
53
     */
54
    public $institutionRole;
55
56
    /**
57
     * @param Institution $institution
58
     * @param Institution $institutionRelation
59
     * @param InstitutionRole $institutionRole
60
     * @return InstitutionAuthorization
61
     */
62
    public static function create(
63
        Institution $institution,
64
        Institution $institutionRelation,
65
        InstitutionRole $institutionRole
66
    ) {
67
        $options = new self;
68
69
        $options->institution = $institution;
70
        $options->institutionRelation = $institutionRelation;
71
        $options->institutionRole = $institutionRole;
72
73
        return $options;
74
    }
75
}
76