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

IdToken   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

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