PartiallyLoggedIn::requiresMfa()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\Auth\User;
6
7
use Jasny\Auth\ContextInterface;
8
use Jasny\Auth\UserInterface;
9
10
/**
11
 * Wrapper for user that is partially logged in.
12
 */
13
final class PartiallyLoggedIn implements UserInterface
14
{
15
    protected UserInterface $user;
16
17
    /**
18
     * Class constructor.
19
     *
20
     * @param UserInterface $user
21
     */
22 6
    public function __construct(UserInterface $user)
23
    {
24 6
        $this->user = $user;
25
    }
26
27
    /**
28
     * Get wrapper user.
29
     *
30
     * @return UserInterface
31
     */
32 1
    public function getUser(): UserInterface
33
    {
34 1
        return $this->user;
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 1
    public function getAuthId(): string
41
    {
42 1
        return '#partial:' . $this->user->getAuthId();
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48 1
    public function verifyPassword(string $password): bool
49
    {
50 1
        return $this->user->verifyPassword($password);
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 1
    public function getAuthChecksum(): string
57
    {
58 1
        return $this->user->getAuthChecksum();
59
    }
60
61
    /**
62
     * @inheritDoc
63
     */
64 1
    public function getAuthRole(?ContextInterface $context = null): int|array|string
65
    {
66 1
        return $this->user->getAuthRole($context);
67
    }
68
69
    /**
70
     * @inheritDoc
71
     */
72 1
    public function requiresMfa(): bool
73
    {
74 1
        return true;
75
    }
76
}
77