OrganizationClaims::resolve()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 13
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Jwt\Claims;
6
7
use Damax\Bundle\ApiAuthBundle\Jwt\Claims;
8
use Symfony\Component\Security\Core\User\UserInterface;
9
10
final class OrganizationClaims implements Claims
11
{
12
    private $issuer;
13
    private $audience;
14
15
    public function __construct(string $issuer = null, string $audience = null)
16
    {
17
        $this->issuer = $issuer;
18
        $this->audience = $audience;
19
    }
20
21
    public function resolve(UserInterface $user): array
22
    {
23
        $data = [];
24
25
        if ($this->issuer) {
26
            $data[self::ISSUER] = $this->issuer;
27
        }
28
29
        if ($this->audience) {
30
            $data[self::AUDIENCE] = $this->audience;
31
        }
32
33
        return $data;
34
    }
35
}
36