Test Setup Failed
Push — master ( 009624...c15db0 )
by Chris
48s
created

Key::getIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Carnage\EncryptedColumn\ValueObject;
4
5
use ParagonIE\Halite\Util;
6
7
final class Key
8
{
9
    /**
10
     * @var KeyIdentity
11
     */
12
    private $identifier;
13
14
    /**
15
     * @var string
16
     */
17
    private $keyInfo;
18
19
    public function __construct(string $keyInfo)
20
    {
21
        $this->identifier = new KeyIdentity(Util::safeSubstr(hash('sha256', $keyInfo), 0, 8));
22
        $this->keyInfo = $keyInfo;
23
    }
24
25
    public function getIdentifier(): KeyIdentity
26
    {
27
        return $this->identifier;
28
    }
29
30
    public function getKeyInfo(): string
31
    {
32
        return $this->keyInfo;
33
    }
34
}
35