Passed
Push — master ( 696cbf...968eef )
by Melech
05:53 queued 01:56
created

NullJwt   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A encode() 0 3 1
A decode() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Valkyrja\Jwt;
15
16
use JsonException;
17
use Valkyrja\Jwt\Contract\Jwt as Contract;
18
use Valkyrja\Type\BuiltIn\Support\Arr;
19
20
/**
21
 * Class NullJwt.
22
 *
23
 * @author Melech Mizrachi
24
 */
25
class NullJwt implements Contract
26
{
27
    /**
28
     * @inheritDoc
29
     *
30
     * @throws JsonException
31
     */
32
    public function encode(array $payload): string
33
    {
34
        return Arr::toString($payload);
35
    }
36
37
    /**
38
     * @inheritDoc
39
     *
40
     * @throws JsonException
41
     */
42
    public function decode(string $jwt): array
43
    {
44
        return Arr::fromString($jwt);
45
    }
46
}
47