Passed
Push — master ( aad9e9...893d1e )
by Kirill
04:12
created

TestAuthHttpStorage::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Auth\Stub;
13
14
use Spiral\Auth\TokenInterface;
15
use Spiral\Auth\TokenStorageInterface;
16
17
class TestAuthHttpStorage implements TokenStorageInterface
18
{
19
    public function load(string $id): ?TokenInterface
20
    {
21
        if ($id === 'bad') {
22
            return null;
23
        }
24
25
        return new TestAuthHttpToken($id, ['id' => $id]);
26
    }
27
28
    public function create(array $payload, \DateTimeInterface $expiresAt = null): TokenInterface
29
    {
30
        return new TestAuthHttpToken(
31
            $payload['id'],
32
            $payload,
33
            $expiresAt
34
        );
35
    }
36
37
    public function delete(TokenInterface $token): void
38
    {
39
    }
40
}
41