Passed
Pull Request — master (#112)
by Robbie
02:17
created

BackupCode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCode() 0 3 1
A getHash() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace SilverStripe\MFA\State;
4
5
use SilverStripe\Core\Injector\Injectable;
6
7
/**
8
 * A container for a backup code and its hash, normally used during backup code generation
9
 */
10
class BackupCode
11
{
12
    use Injectable;
13
14
    /**
15
     * @var string
16
     */
17
    protected $code = '';
18
19
    /**
20
     * @var string
21
     */
22
    protected $hash = '';
23
24
    /**
25
     * @param string $code
26
     * @param string $hash
27
     */
28
    public function __construct(string $code, string $hash)
29
    {
30
        $this->code = $code;
31
        $this->hash = $hash;
32
    }
33
34
    public function getCode(): string
35
    {
36
        return $this->code;
37
    }
38
39
    public function getHash(): string
40
    {
41
        return $this->hash;
42
    }
43
}
44