Completed
Push — master ( f20e30...a2c18f )
by Jonathan
04:47
created

PasswordEncryptedValue::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

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
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 Jeskew\Cache;
3
4
class PasswordEncryptedValue extends EncryptedValue
5
{
6
    /** @var string */
7
    private $mac;
8
9
    /**
10
     * @param string $cipherText
11
     * @param string $method
12
     * @param string $iv
13
     * @param string $mac
14
     */
15 114
    public function __construct($cipherText, $method, $iv, $mac)
16
    {
17 114
        parent::__construct($cipherText, $method, $iv);
18 114
        $this->mac = $mac;
19 114
    }
20
21 3
    public function jsonSerialize()
22
    {
23 3
        return parent::jsonSerialize() + ['mac' => $this->mac];
24
    }
25
26 3
    public function unserialize($serialized)
27
    {
28 3
        parent::unserialize($serialized);
29
30 3
        $data = json_decode($serialized);
31 3
        $this->mac = $data->mac;
32 3
    }
33
34
    /**
35
     * @return string
36
     */
37 81
    public function getMac()
38
    {
39 81
        return $this->mac;
40
    }
41
}
42