Completed
Push — develop ( 23fb07...aaf888 )
by Fabian
13s queued 11s
created

Token::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Redirect\Token;
6
7
/**
8
 * The implementation of the TokenInterface.
9
 *
10
 * @author Fabian Böttcher <[email protected]>
11
 * @since 1.0.0
12
 */
13
class Token implements TokenInterface
14
{
15
    /**
16
     * @var array The token data.
17
     */
18
    protected $data = [];
19
20
    /**
21
     * Constructs the token.
22
     *
23
     * @param array $data The token payload data.
24
     */
25
    public function __construct(array $data)
26
    {
27
        $this->data = $data;
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function get(string $name)
34
    {
35
        return $this->data[$name] ?? null;
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function jsonSerialize(): array
42
    {
43
        return $this->data;
44
    }
45
}
46