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

NoConfirmation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A withSubject() 0 3 1
A getToken() 0 3 1
A from() 0 3 1
A withStorage() 0 3 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