Method::getThumbnail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace SilverStripe\MFA\Tests\Stub\BasicMath;
4
5
use SilverStripe\Control\Director;
6
use SilverStripe\Core\Manifest\ModuleLoader;
7
use SilverStripe\Dev\TestOnly;
8
use SilverStripe\MFA\Method\Handler\RegisterHandlerInterface;
9
use SilverStripe\MFA\Method\Handler\VerifyHandlerInterface;
10
use SilverStripe\MFA\Method\MethodInterface;
11
12
class Method implements MethodInterface, TestOnly
13
{
14
    /**
15
     * Get a URL segment for this method. This will be used in URL paths for performing authentication by this method
16
     *
17
     * @return string
18
     */
19
    public function getURLSegment(): string
20
    {
21
        return 'basic-math';
22
    }
23
24
    /**
25
     * Return the VerifyHandler that is used to start and check verification attempts with this method
26
     *
27
     * @return VerifyHandlerInterface
28
     */
29
    public function getVerifyHandler(): VerifyHandlerInterface
30
    {
31
        return new MethodVerifyHandler();
32
    }
33
34
    /**
35
     * Return the RegisterHandler that is used to perform registrations with this method
36
     *
37
     * @return RegisterHandlerInterface
38
     */
39
    public function getRegisterHandler(): RegisterHandlerInterface
40
    {
41
        return new MethodRegisterHandler();
42
    }
43
44
    public function getThumbnail(): string
45
    {
46
        return (string) ModuleLoader::getModule('silverstripe/mfa')
47
            ->getResource('client/dist/images/totp.svg')
48
            ->getURL();
49
    }
50
51
    public function applyRequirements(): void
52
    {
53
        // noop
54
    }
55
56
    public function isAvailable(): bool
57
    {
58
        return Director::isDev();
59
    }
60
61
    public function getUnavailableMessage(): string
62
    {
63
        return 'This is a test authenticator, only available in dev mode for tests.';
64
    }
65
66
    public function getName(): string
67
    {
68
        return 'Math problem';
69
    }
70
}
71