NoConfirmation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 6
c 1
b 0
f 0
dl 0
loc 46
ccs 10
cts 10
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A withStorage() 0 3 1
A withSubject() 0 3 1
A getToken() 0 3 1
A withLogger() 0 3 1
A from() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\Auth\Confirmation;
6
7
use DateTimeInterface;
8
use Jasny\Auth\StorageInterface as Storage;
9
use Jasny\Auth\UserInterface as User;
10
use LogicException;
11
use Psr\Log\LoggerInterface as Logger;
12
13
/**
14
 * No support for confirmation tokens.
15
 */
16
class NoConfirmation implements ConfirmationInterface
17
{
18
    /**
19
     * @inheritDoc
20
     */
21 1
    public function withStorage(Storage $storage): static
22
    {
23 1
        return $this;
24
    }
25
26
    /**
27
     * @inheritDoc
28
     */
29 1
    public function withLogger(Logger $logger): static
30
    {
31 1
        return $this;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 1
    public function withSubject(string $subject): static
38
    {
39 1
        return $this;
40
    }
41
42
    /**
43
     * Generate a confirmation token.
44
     *
45
     * @throws LogicException
46
     */
47 1
    public function getToken(User $user, DateTimeInterface $expire): string
48
    {
49 1
        throw new LogicException("Confirmation tokens are not supported");
50
    }
51
52
    /**
53
     * Get user by confirmation token.
54
     *
55
     * @param string $token Confirmation token
56
     * @return User
57
     * @throws LogicException
58
     */
59 1
    public function from(string $token): User
60
    {
61 1
        throw new LogicException("Confirmation tokens are not supported");
62
    }
63
}
64