Value   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 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 38
ccs 13
cts 13
cp 1
rs 10

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\Cache\PasswordEncryption;
3
4
use Jsq\Cache\EncryptedValue;
5
6
class Value extends EncryptedValue
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 36
    public function __construct($cipherText, $method, $iv, $mac)
18
    {
19 36
        parent::__construct($cipherText, $method, $iv);
20 36
        $this->mac = $mac;
21 36
    }
22
23 18
    public function jsonSerialize()
24
    {
25 18
        return parent::jsonSerialize() + ['mac' => $this->mac];
26
    }
27
28 18
    public function unserialize($serialized)
29
    {
30 18
        parent::unserialize($serialized);
31
32 18
        $data = json_decode($serialized);
33 18
        $this->mac = $data->mac;
34 18
    }
35
36
    /**
37
     * @return string
38
     */
39 18
    public function getMac()
40
    {
41 18
        return $this->mac;
42
    }
43
}
44