Completed
Push — master ( 6e52f0...d9a404 )
by Alexandre
02:29
created

IdToken::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 18/02/2018
6
 * Time: 17:51
7
 */
8
9
namespace OAuth2;
10
11
12
use Firebase\JWT\JWT;
13
14
class IdToken implements IdTokenInterface
15
{
16
    /**
17
     * @var array
18
     */
19
    private $claims;
20
21
    public function __construct(array $claims)
22
    {
23
        $this->claims = $claims;
24
    }
25
26
    function getClaims() : array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28
       return $this->claims;
29
    }
30
31
    /**
32
     * Specify data which should be serialized to JSON
33
     * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
34
     * @return mixed data which can be serialized by <b>json_encode</b>,
35
     * which is a value of any type other than a resource.
36
     * @since 5.4.0
37
     */
38
    public function jsonSerialize()
39
    {
40
        return JWT::encode($this->getClaims(), 'key');
41
    }
42
}