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

Token   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A jsonSerialize() 0 3 1
A get() 0 3 1
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