Completed
Push — master ( c39607...87b4fe )
by Jonathan
09:41
created

EncryptedValue::getMac()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Jsq\CacheEncryption\Password;
3
4
use Jsq\CacheEncryption\EncryptedValue as BaseEncryptedValue;
5
6
class EncryptedValue extends BaseEncryptedValue
7
{
8
    /** @var string */
9
    private $mac;
10
11
    /**
12
     * @param string $cipherText
13
     * @param string $method
14
     * @param string $iv
15
     * @param string $mac
16
     */
17 114
    public function __construct($cipherText, $method, $iv, $mac)
18
    {
19 114
        parent::__construct($cipherText, $method, $iv);
20 114
        $this->mac = $mac;
21 114
    }
22
23 3
    public function jsonSerialize()
24
    {
25 3
        return parent::jsonSerialize() + ['mac' => $this->mac];
26
    }
27
28 3
    public function unserialize($serialized)
29
    {
30 3
        parent::unserialize($serialized);
31
32 3
        $data = json_decode($serialized);
33 3
        $this->mac = $data->mac;
34 3
    }
35
36
    /**
37
     * @return string
38
     */
39 93
    public function getMac()
40
    {
41 93
        return $this->mac;
42
    }
43
}
44