EncryptedValue   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 38
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A jsonSerialize() 0 4 1
A unserialize() 0 7 1
A getMac() 0 4 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 132
    public function __construct($cipherText, $method, $iv, $mac)
18
    {
19 132
        parent::__construct($cipherText, $method, $iv);
20 132
        $this->mac = $mac;
21 132
    }
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