| Total Complexity | 4 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | class RegisteredMethod extends DataObject |
||
| 23 | { |
||
| 24 | private static $table_name = 'MFARegisteredMethod'; |
||
|
|
|||
| 25 | |||
| 26 | private static $db = [ |
||
| 27 | // The class name of the MethodInterface that this record refers to |
||
| 28 | 'MethodClassName' => 'Varchar', |
||
| 29 | // Data stored as a JSON blob that may contain detail specific to this registration of the authenticator |
||
| 30 | 'Data' => 'Text', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | private static $has_one = [ |
||
| 34 | 'Member' => Member::class, |
||
| 35 | ]; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var MethodInterface |
||
| 39 | */ |
||
| 40 | protected $method; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return MethodInterface |
||
| 44 | */ |
||
| 45 | public function getMethod(): MethodInterface |
||
| 46 | { |
||
| 47 | if (!$this->method) { |
||
| 48 | $this->method = Injector::inst()->create($this->MethodClassName); |
||
| 49 | } |
||
| 50 | return $this->method; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return VerifyHandlerInterface |
||
| 55 | */ |
||
| 56 | public function getVerifyHandler(): VerifyHandlerInterface |
||
| 57 | { |
||
| 58 | return $this->getMethod()->getVerifyHandler(); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return RegisterHandlerInterface |
||
| 63 | */ |
||
| 64 | public function getRegisterHandler(): RegisterHandlerInterface |
||
| 67 | } |
||
| 68 | } |
||
| 69 |