Passport   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 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\Credentials\PasswordCredentials;
15
use Slick\WebStack\Domain\Security\Http\Authenticator\Passport\Badge\CredentialsInterface;
16
use Slick\WebStack\Domain\Security\Http\Authenticator\Passport\Badge\UserBadge;
17
use Slick\WebStack\Domain\Security\Http\Authenticator\Passport\BadgeInterface;
18
use Slick\WebStack\Domain\Security\UserInterface;
19
20
/**
21
 * Passport
22
 *
23
 * @package Slick\WebStack\Domain\Security\Http\Authenticator
24
 * @template-covariant  TUser of UserInterface
25
 * @implements PassportInterface<TUser>
26
 */
27
class Passport implements PassportInterface
28
{
29
    use PassportMethodsTrait;
30
31
    /**
32
     * Creates a Passport
33
     *
34
     * @param UserBadge<TUser> $userBadge
35
     * @param CredentialsInterface $credentials
36
     * @param array<BadgeInterface> $badges
37
     */
38
    public function __construct(UserBadge $userBadge, CredentialsInterface $credentials, array $badges = [])
39
    {
40
        $this->addBadge($userBadge, UserBadge::class);
41
        $this->addBadge($credentials, get_class($credentials));
42
        foreach ($badges as $badge) {
43
            $this->addBadge($badge);
44
        }
45
    }
46
}
47