AuthenticatedCipherData   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 45
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __destruct() 0 2 1
A __toString() 0 3 1
1
<?php
2
3
/**
4
 * The authentication encryption output data object.
5
 */
6
7
namespace CryptoManana\DataStructures;
8
9
use CryptoManana\Core\Abstractions\DataStructures\AbstractBasicStructure as BasicDataStructure;
10
11
/**
12
 * Class AuthenticatedCipherData - The authentication cipher data structure.
13
 *
14
 * @package CryptoManana\DataStructures
15
 *
16
 * @property string $cipherData The encrypted data information.
17
 * @property string $authenticationTag The message authentication code (tag).
18
 */
19
class AuthenticatedCipherData extends BasicDataStructure
20
{
21
    /**
22
     * The encrypted information property storage.
23
     *
24
     * @var string The encrypted data information.
25
     */
26
    protected $cipherData = '';
27
28
    /**
29
     * The message authentication code property storage.
30
     *
31
     * @var string The message authentication code (tag).
32
     */
33
    protected $authenticationTag = '';
34
35
    /**
36
     * Authenticated cipher data constructor.
37
     *
38
     * @param string $encryptedData The encrypted data information.
39
     * @param string $digestionTag The message authentication code (tag).
40
     *
41
     * @throws \Exception Validation errors.
42
     */
43 28
    public function __construct($encryptedData = '', $digestionTag = '')
44
    {
45 28
        $this->__set('cipherData', $encryptedData);
46 28
        $this->__set('authenticationTag', $digestionTag);
47
    }
48
49
    /**
50
     * Authenticated cipher data destructor
51
     */
52 28
    public function __destruct()
53
    {
54 28
    }
55
56
    /**
57
     * The authenticated cipher data string representation.
58
     *
59
     * @return string
60
     */
61 2
    public function __toString()
62
    {
63 2
        return 'encrypted : ' . $this->cipherData . ' |  tag : ' . $this->authenticationTag;
64
    }
65
}
66