DefaultIdentityFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 3 1
1
<?php
2
3
/**
4
 * Copyright (c) Phauthentic (https://github.com/Phauthentic)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Phauthentic (https://github.com/Phauthentic)
11
 * @link          https://github.com/Phauthentic
12
 * @license       https://opensource.org/licenses/mit-license.php MIT License
13
 */
14
15
declare(strict_types=1);
16
17
namespace Phauthentic\Authentication\Identity;
18
19
use ArrayAccess;
20
21
class DefaultIdentityFactory implements IdentityFactoryInterface
22
{
23
    /**
24
     * @var array<string, mixed>
25
     */
26
    protected array $config = [];
27
28
    /**
29
     * Constructor.
30 36
     *
31
     * @param array<string, mixed> $config Config.
32 36
     */
33 36
    public function __construct(array $config = [])
34
    {
35
        $this->config = $config;
36
    }
37
38 12
    /**
39
     * {@inheritDoc}
40 12
     */
41
    public function create(ArrayAccess $data): IdentityInterface
42
    {
43
        return new Identity($data, $this->config);
44
    }
45
}
46