Completed
Pull Request — release-2.x (#128)
by
unknown
02:00
created

SecondFactor::isGssf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * Copyright 2014 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\StepupGateway\GatewayBundle\Entity;
20
21
use Doctrine\ORM\Mapping as ORM;
22
use Surfnet\StepupBundle\Service\SecondFactorTypeService;
23
use Surfnet\StepupBundle\Value\Loa;
24
use Surfnet\StepupBundle\Value\SecondFactorType;
25
26
/**
27
 * @ORM\Entity(repositoryClass="Surfnet\StepupGateway\GatewayBundle\Entity\DoctrineSecondFactorRepository")
28
 * @ORM\Table
29
 */
30
class SecondFactor
31
{
32
    /**
33
     * @var string
34
     *
35
     * @ORM\Id
36
     * @ORM\Column(length=36)
37
     */
38
    public $identityId;
39
40
    /**
41
     * @var string
42
     *
43
     * @ORM\Column(length=200)
44
     */
45
    public $nameId;
46
47
    /**
48
     * @var string
49
     *
50
     * @ORM\Column(length=200)
51
     */
52
    public $institution;
53
54
    /**
55
     * @var string
56
     *
57
     * @ORM\Column(length=36)
58
     */
59
    public $secondFactorId;
60
61
    /**
62
     * @var string
63
     *
64
     * @ORM\Column(length=50)
65
     */
66
    public $secondFactorType;
67
68
    /**
69
     * @var string
70
     *
71
     * @ORM\Column(length=255)
72
     */
73
    public $secondFactorIdentifier;
74
75
    /**
76
     * In which language to display any second factor verification screens.
77
     *
78
     * @var string
79
     *
80
     * @ORM\Column
81
     */
82
    public $displayLocale;
83
84
    /**
85
     * No new second factors should be created by the gateway
86
     */
87
    final private function __construct()
0 ignored issues
show
introduced by
Instead of declaring the constructor as final, maybe you should declare the entire class as final.
Loading history...
88
    {
89
    }
90
91
    /**
92
     * @param Loa $loa
93
     * @param SecondFactorTypeService $service
94
     * @return bool
95
     */
96
    public function canSatisfy(Loa $loa, SecondFactorTypeService $service)
97
    {
98
        $secondFactorType = new SecondFactorType($this->secondFactorType);
99
        return $service->canSatisfy($secondFactorType, $loa);
100
    }
101
102
    /**
103
     * @param SecondFactorTypeService $service
104
     * @return int
105
     */
106
    public function getLoaLevel(SecondFactorTypeService $service)
107
    {
108
        $secondFactorType = new SecondFactorType($this->secondFactorType);
109
        return $service->getLevel($secondFactorType);
110
    }
111
}
112