NullJwt::decode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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 Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Valkyrja\Jwt\Contract\Jwt as Contract;
19
use Valkyrja\Type\BuiltIn\Support\Arr;
20
21
/**
22
 * Class NullJwt.
23
 *
24
 * @author Melech Mizrachi
25
 */
26
class NullJwt implements Contract
27
{
28
    /**
29
     * @inheritDoc
30
     *
31
     * @throws JsonException
32
     */
33
    #[Override]
34
    public function encode(array $payload): string
35
    {
36
        return Arr::toString($payload);
37
    }
38
39
    /**
40
     * @inheritDoc
41
     *
42
     * @throws JsonException
43
     */
44
    #[Override]
45
    public function decode(string $jwt): array
46
    {
47
        return Arr::fromString($jwt);
48
    }
49
}
50