NoConfirmation::withLogger()   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 1
crap 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