1 | <?php |
||
27 | class SecondFactorTypeService |
||
28 | { |
||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | private $loaLevelTypeMap = [ |
||
33 | 'sms' => Loa::LOA_2, |
||
34 | 'yubikey' => Loa::LOA_3, |
||
35 | 'u2f' => Loa::LOA_3, |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * @var GssfConfig |
||
40 | */ |
||
41 | private $gssfConfig; |
||
42 | |||
43 | /** |
||
44 | * @param array $gssfConfig |
||
45 | */ |
||
46 | public function __construct(array $gssfConfig) |
||
50 | |||
51 | /** |
||
52 | * @return string[] |
||
|
|||
53 | */ |
||
54 | public function getAvailableSecondFactorTypes() |
||
61 | |||
62 | /** |
||
63 | * @return string[] |
||
64 | */ |
||
65 | private function getAvailableGssfSecondFactorTypes() |
||
69 | |||
70 | /** |
||
71 | * @param SecondFactorType $secondFactorType |
||
72 | * @param Loa $loa |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function canSatisfy(SecondFactorType $secondFactorType, Loa $loa) |
||
79 | |||
80 | /** |
||
81 | * @param SecondFactorType $secondFactorType |
||
82 | * @param Loa $loa |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function isSatisfiedBy(SecondFactorType $secondFactorType, Loa $loa) |
||
89 | |||
90 | /** |
||
91 | * @param SecondFactorType $secondFactorType |
||
92 | * @param SecondFactorTypeService|SecondFactorType $other |
||
93 | * @return bool |
||
94 | */ |
||
95 | public function hasEqualOrHigherLoaComparedTo(SecondFactorType $secondFactorType, SecondFactorType $other) |
||
99 | |||
100 | /** |
||
101 | * @param SecondFactorType $secondFactorType |
||
102 | * @param SecondFactorTypeService|SecondFactorType $other |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function hasEqualOrLowerLoaComparedTo(SecondFactorType $secondFactorType, SecondFactorType $other) |
||
109 | |||
110 | /** |
||
111 | * @param SecondFactorType $secondFactorType |
||
112 | * @return int |
||
113 | */ |
||
114 | public function getLevel(SecondFactorType $secondFactorType) |
||
131 | |||
132 | public function isGssf(SecondFactorType $secondFactorType) |
||
136 | } |
||
137 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.