SelfValidatingPassport   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
c 0
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
3
/**
4
 * This file is part of web-stack
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Slick\WebStack\Domain\Security\Http\Authenticator;
13
14
use Slick\WebStack\Domain\Security\Http\Authenticator\Passport\Badge\UserBadge;
15
use Slick\WebStack\Domain\Security\Http\Authenticator\Passport\BadgeInterface;
16
use Slick\WebStack\Domain\Security\UserInterface;
17
18
/**
19
 * SelfValidatingPassport
20
 *
21
 * @package Slick\WebStack\Domain\Security\Http\Authenticator
22
 *
23
 * @template-covariant  TUser of UserInterface
24
 * @implements PassportInterface<TUser>
25
 */
26
final class SelfValidatingPassport implements PassportInterface
27
{
28
    use PassportMethodsTrait;
29
30
    /**
31
     * An implementation used when there are no credentials to be checked (e.g.
32
     *  API token authentication).
33
     *
34
     * @param UserBadge<TUser> $userBadge The main user badge.
35
     * @param array<BadgeInterface> $badges An array of additional badges.
36
     */
37
    public function __construct(UserBadge $userBadge, array $badges = [])
38
    {
39
        $this->addBadge($userBadge, UserBadge::class);
40
        foreach ($badges as $badge) {
41
            $this->addBadge($badge);
42
        }
43
    }
44
}
45