Token   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 3 1
A fromClaims() 0 3 1
A has() 0 3 1
A __construct() 0 3 1
A get() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Jwt;
6
7
final class Token
8
{
9
    private $data;
10
11
    public static function fromClaims(array $claims): self
12
    {
13
        return new self($claims);
14
    }
15
16
    private function __construct(array $data)
17
    {
18
        $this->data = $data;
19
    }
20
21
    public function has(string $name): bool
22
    {
23
        return array_key_exists($name, $this->data);
24
    }
25
26
    public function get(string $name, $default = null)
27
    {
28
        return $this->data[$name] ?? $default;
29
    }
30
31
    public function all(): array
32
    {
33
        return $this->data;
34
    }
35
}
36