Completed
Pull Request — master (#2)
by Artem
03:00
created

JwtPayload   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 73
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getSubject() 0 4 1
A getExpirationTime() 0 4 1
A getInfo() 0 4 1
A getBase64Info() 0 4 1
A getChannels() 0 4 1
1
<?php
2
/*
3
 * This file is part of the FreshCentrifugoBundle.
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\CentrifugoBundle\Token;
14
15
/**
16
 * JwtPayload.
17
 *
18
 * @see https://centrifugal.github.io/centrifugo/server/authentication/#claims
19
 *
20
 * @author Artem Henvald <[email protected]>
21
 */
22
final class JwtPayload
23
{
24
    /** @var string */
25
    private $subject;
26
27
    /** @var int|null */
28
    private $expirationTime;
29
30
    /** @var array */
31
    private $info;
32
33
    /** @var string|null */
34
    private $base64info;
35
36
    /** @var string[] */
37
    private $channels;
38
39
    /**
40
     * @param string      $subject
41
     * @param array       $info
42
     * @param int|null    $expirationTime
43
     * @param string|null $base64info
44
     * @param string[]    $channels
45
     */
46
    public function __construct(string $subject, array $info = [], ?int $expirationTime = null, ?string $base64info = null, array $channels = [])
47
    {
48
        $this->subject = $subject;
49
        $this->info = $info;
50
        $this->expirationTime = $expirationTime;
51
        $this->base64info = $base64info;
52
        $this->channels = $channels;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getSubject(): string
59
    {
60
        return $this->subject;
61
    }
62
63
    /**
64
     * @return int|null
65
     */
66
    public function getExpirationTime(): ?int
67
    {
68
        return $this->expirationTime;
69
    }
70
71
    /**
72
     * @return array
73
     */
74
    public function getInfo(): array
75
    {
76
        return $this->info;
77
    }
78
79
    /**
80
     * @return string|null
81
     */
82
    public function getBase64Info(): ?string
83
    {
84
        return $this->base64info;
85
    }
86
87
    /**
88
     * @return array
89
     */
90
    public function getChannels(): array
91
    {
92
        return $this->channels;
93
    }
94
}
95