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

KeyPair::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * The asymmetric key-pair object.
5
 */
6
7
namespace CryptoManana\DataStructures;
8
9
use \CryptoManana\Core\Abstractions\DataStructures\AbstractBasicStructure as BasicDataStructure;
10
11
/**
12
 * Class KeyPair - The key-pair object.
13
 *
14
 * @package CryptoManana\DataStructures
15
 *
16
 * @property string $private The private key.
17
 * @property string $public The public key.
18
 */
19
class KeyPair extends BasicDataStructure
20
{
21
    /**
22
     * The private key property storage.
23
     *
24
     * @var string The private key.
25
     */
26
    protected $private = '';
27
28
    /**
29
     * The public key property storage.
30
     *
31
     * @var string The public key.
32
     */
33
    protected $public = '';
34
35
    /**
36
     * Key-pair constructor.
37
     *
38
     * @param string $privateKey The private key string.
39
     * @param string $publicKey The public key string.
40
     */
41 562
    public function __construct($privateKey = '', $publicKey = '')
42
    {
43 562
        if (is_string($privateKey)) {
1 ignored issue
show
introduced by
The condition is_string($privateKey) is always true.
Loading history...
44 562
            $this->private = $privateKey;
45
        }
46
47 562
        if (is_string($publicKey)) {
1 ignored issue
show
introduced by
The condition is_string($publicKey) is always true.
Loading history...
48 562
            $this->public = $publicKey;
49
        }
50 562
    }
51
52
    /**
53
     * Key-pair destructor
54
     */
55 562
    public function __destruct()
56
    {
57 562
    }
58
59
    /**
60
     * The key-pair string representation.
61
     *
62
     * @return string
63
     */
64
    public function __toString()
65
    {
66
        return 'private : ' . $this->private . ' | public : ' . $this->public;
67
    }
68
}
69