Passed
Push — master ( 7e81b0...7eb007 )
by Robbie
12:39 queued 11s
created

Method::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace SilverStripe\MFA\Tests\Stub\Null;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\MFA\Method\Handler\RegisterHandlerInterface;
7
use SilverStripe\MFA\Method\Handler\VerifyHandlerInterface;
8
use SilverStripe\MFA\Method\MethodInterface;
9
10
class Method implements MethodInterface, TestOnly
11
{
12
    /**
13
     * Provide a localised name for this MFA Method.
14
     *
15
     * eg. "Authenticator app"
16
     *
17
     * @return string
18
     */
19
    public function getName(): string
20
    {
21
        // TODO: Implement getName() method.
22
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
23
24
    /**
25
     * Get a URL segment for this method. This will be used in URL paths for performing authentication by this method
26
     *
27
     * @return string
28
     */
29
    public function getURLSegment(): string
30
    {
31
        return 'null';
32
    }
33
34
    /**
35
     * Return the VerifyHandler that is used to start and check verification attempts with this method
36
     *
37
     * @return VerifyHandlerInterface
38
     */
39
    public function getVerifyHandler(): VerifyHandlerInterface
40
    {
41
        return new VerifyHandler();
42
    }
43
44
    /**
45
     * Return the RegisterHandler that is used to perform registrations with this method
46
     *
47
     * @return RegisterHandlerInterface
48
     */
49
    public function getRegisterHandler(): RegisterHandlerInterface
50
    {
51
        return new RegisterHandler();
52
    }
53
54
    /**
55
     * Return a URL to an image to be used as a thumbnail in the MFA login/registration grid for all MFA methods
56
     *
57
     * @return string
58
     */
59
    public function getThumbnail(): string
60
    {
61
        // TODO: Implement getThumbnail() method.
62
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
63
64
    /**
65
     * Leverage the Requirements API to ensure client requirements are included. This is called just after the base
66
     * module requirements are specified
67
     *
68
     * @return void
69
     */
70
    public function applyRequirements(): void
71
    {
72
        // TODO: Implement applyRequirements() method.
73
    }
74
75
    /**
76
     * Returns whether the method is available to be used from a backend perspective.
77
     *
78
     * @return bool
79
     */
80
    public function isAvailable(): bool
81
    {
82
        return true;
83
    }
84
85
    /**
86
     * If not available to be used, provide a message to display on the frontend to explain why.
87
     *
88
     * @return string
89
     */
90
    public function getUnavailableMessage(): string
91
    {
92
        // TODO: Implement getUnavailableMessage() method.
93
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
94
}
95