Completed
Pull Request — master (#11)
by Arnold
03:10
created

NoConfirmation::getToken()   A

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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\Auth\Confirmation;
6
7
use Jasny\Auth\StorageInterface as Storage;
8
use Jasny\Auth\UserInterface as User;
9
10
/**
11
 * No support for confirmation tokens.
12
 */
13
class NoConfirmation implements ConfirmationInterface
14
{
15
    /**
16
     * Get copy with storage service.
17
     *
18
     * @param Storage $storage
19
     * @return static
20
     */
21 1
    public function withStorage(Storage $storage)
22
    {
23 1
        return $this;
24
    }
25
26
    /**
27
     * Create a copy of this service with a specific subject.
28
     *
29
     * @param string $subject
30
     * @return static
31
     */
32 1
    public function withSubject(string $subject)
33
    {
34 1
        return $this;
35
    }
36
37
    /**
38
     * Generate a confirmation token.
39
     *
40
     * @throws \LogicException
41
     */
42 1
    public function getToken(User $user, \DateTimeInterface $expire): string
43
    {
44 1
        throw new \LogicException("Confirmation tokens are not supported");
45
    }
46
47
    /**
48
     * Get user by confirmation token.
49
     *
50
     * @param string $token Confirmation token
51
     * @return User
52
     * @throws \LogicException
53
     */
54 1
    public function from(string $token): User
55
    {
56 1
        throw new \LogicException("Confirmation tokens are not supported");
57
    }
58
}
59