Identity::getIdentifier()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Micro
7
 *
8
 * @copyright   Copryright (c) 2015-2018 gyselroth GmbH (https://gyselroth.com)
9
 * @license     MIT https://opensource.org/licenses/MIT
10
 */
11
12
namespace Micro\Auth;
13
14
use Micro\Auth\Adapter\AdapterInterface;
15
use Psr\Log\LoggerInterface as Logger;
16
17
class Identity implements IdentityInterface
18
{
19
    /**
20
     * Logger.
21
     *
22
     * @var Logger
23
     */
24
    protected $logger;
25
26
    /**
27
     * Attribute map.
28
     *
29
     * @var AttributeMap
30
     */
31
    protected $attribute_map;
32
33
    /**
34
     * Auth adapter.
35
     *
36
     * @var AdapterInterface
37
     */
38
    protected $adapter;
39
40
    /**
41
     * Initialize.
42
     *
43
     * @param AdapterInterface $adapter
44
     * @param AttributeMap     $map
45
     * @param Logger           $logger
46
     */
47
    public function __construct(AdapterInterface $adapter, AttributeMap $map, Logger $logger)
48
    {
49
        $this->attribute_map = $map;
50
        $this->logger = $logger;
51
        $this->adapter = $adapter;
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getAttributeMap(): AttributeMapInterface
58
    {
59
        return $this->attribute_map;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getAdapter(): AdapterInterface
66
    {
67
        return $this->adapter;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getIdentifier(): string
74
    {
75
        return $this->adapter->getIdentifier();
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function getAttributes(): array
82
    {
83
        return $this->attribute_map->map($this->adapter->getAttributes());
84
    }
85
}
86