AvailableMethodDetails   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A jsonSerialize() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SilverStripe\MFA\State;
6
7
use SilverStripe\MFA\Method\MethodInterface;
8
9
class AvailableMethodDetails implements AvailableMethodDetailsInterface
10
{
11
    /**
12
     * @var MethodInterface
13
     */
14
    private $method;
15
16
    /**
17
     * @param MethodInterface $method
18
     */
19
    public function __construct(MethodInterface $method)
20
    {
21
        $this->method = $method;
22
    }
23
24
    public function jsonSerialize(): array
25
    {
26
        return [
27
            'urlSegment' => $this->method->getURLSegment(),
28
            'name' => $this->method->getName(),
29
            'description' => $this->method->getRegisterHandler()->getDescription(),
30
            'supportLink' => $this->method->getRegisterHandler()->getSupportLink(),
31
            'supportText' => $this->method->getRegisterHandler()->getSupportText(),
32
            'thumbnail' => $this->method->getThumbnail(),
33
            'component' => $this->method->getRegisterHandler()->getComponent(),
34
            'isAvailable' => $this->method->isAvailable(),
35
            'unavailableMessage' => $this->method->getUnavailableMessage(),
36
        ];
37
    }
38
}
39