Passed
Pull Request — master (#62)
by Robbie
01:49
created

AvailableMethodDetails   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getName() 0 3 1
A getURLSegment() 0 3 1
A getSupportLink() 0 3 1
A getDescription() 0 3 1
A getThumbnail() 0 3 1
A getComponent() 0 3 1
A jsonSerialize() 0 9 1
1
<?php
2
3
namespace SilverStripe\MFA\State;
4
5
use SilverStripe\Core\Injector\Injectable;
6
use SilverStripe\MFA\Method\MethodInterface;
7
8
class AvailableMethodDetails implements AvailableMethodDetailsInterface
9
{
10
    use Injectable;
11
12
    /**
13
     * @var MethodInterface
14
     */
15
    private $method;
16
17
    /**
18
     * @param MethodInterface $method
19
     */
20
    public function __construct(MethodInterface $method)
21
    {
22
        $this->method = $method;
23
    }
24
25
    public function getURLSegment()
26
    {
27
        return $this->method->getURLSegment();
28
    }
29
30
    public function getName()
31
    {
32
        return $this->method->getRegisterHandler()->getName();
33
    }
34
35
    public function getDescription()
36
    {
37
        return $this->method->getRegisterHandler()->getDescription();
38
    }
39
40
    public function getSupportLink()
41
    {
42
        return $this->method->getRegisterHandler()->getSupportLink();
43
    }
44
45
    public function getThumbnail()
46
    {
47
        return $this->method->getThumbnail();
48
    }
49
50
    public function getComponent()
51
    {
52
        return $this->method->getRegisterHandler()->getComponent();
53
    }
54
55
    public function jsonSerialize()
56
    {
57
        return [
58
            'urlSegment' => $this->getURLSegment(),
59
            'name' => $this->getName(),
60
            'description' => $this->getDescription(),
61
            'supportLink' => $this->getSupportLink(),
62
            'thumbnail' => $this->getThumbnail(),
63
            'component' => $this->getComponent(),
64
        ];
65
    }
66
}
67