Completed
Push — master ( 604a9a...cf79ad )
by Tony Karavasilev (Тони
18:44
created

AuthenticationToken   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 48
ccs 0
cts 15
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __destruct() 0 2 1
A __construct() 0 8 3
1
<?php
2
3
/**
4
 * The authentication token object.
5
 */
6
7
namespace CryptoManana\DataStructures;
8
9
use \CryptoManana\Core\Abstractions\DataStructures\AbstractBasicStructure as BasicDataStructure;
10
11
/**
12
 * Class AuthenticationToken - The authentication token structure.
13
 *
14
 * @package CryptoManana\DataStructures
15
 *
16
 * @property string $tokenData The raw/plain token.
17
 * @property string $cipherData The encrypted token.
18
 */
19
class AuthenticationToken extends BasicDataStructure
20
{
21
    /**
22
     * The raw token data property storage.
23
     *
24
     * @var string The raw/plain token.
25
     */
26
    protected $tokenData = '';
27
28
    /**
29
     * The encrypted token property storage.
30
     *
31
     * @var string The encrypted token.
32
     */
33
    protected $cipherData = '';
34
35
    /**
36
     * Authentication token constructor.
37
     *
38
     * @param string $rawToken The raw token string.
39
     * @param string $encryptedToken The encrypted token string.
40
     */
41
    public function __construct($rawToken = '', $encryptedToken = '')
42
    {
43
        if (is_string($rawToken)) {
1 ignored issue
show
introduced by
The condition is_string($rawToken) is always true.
Loading history...
44
            $this->tokenData = $rawToken;
45
        }
46
47
        if (is_string($encryptedToken)) {
1 ignored issue
show
introduced by
The condition is_string($encryptedToken) is always true.
Loading history...
48
            $this->cipherData = $encryptedToken;
49
        }
50
    }
51
52
    /**
53
     * Authentication token destructor
54
     */
55
    public function __destruct()
56
    {
57
    }
58
59
    /**
60
     * The authentication token string representation.
61
     *
62
     * @return string
63
     */
64
    public function __toString()
65
    {
66
        return 'token : ' . $this->tokenData . ' | encrypted : ' . $this->cipherData;
67
    }
68
}
69