Passed
Push — master ( 617e52...ff4e9f )
by Arthur
35:51
created

RsaKeyPair   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 37
ccs 8
cts 11
cp 0.7272
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPrivateKey() 0 3 1
A toArray() 0 5 1
A getPublicKey() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 26/10/17
6
 * Time: 14:43
7
 */
8
9
namespace Modules\Script\Support;
10
11
12
class RsaKeyPair
13
{
14
    private $public_key;
15
    private $private_key;
16
17
    /**
18
     * Rsa constructor.
19
     * @param $public_key
20
     * @param $private_key
21
     */
22 11
    public function __construct($public_key, $private_key)
23
    {
24 11
        $this->public_key = $public_key;
25 11
        $this->private_key = $private_key;
26 11
    }
27
28
    /**
29
     * @return mixed
30
     */
31 11
    public function getPublicKey()
32
    {
33 11
        return $this->public_key;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39 11
    public function getPrivateKey()
40
    {
41 11
        return $this->private_key;
42
    }
43
44
    public function toArray()
45
    {
46
        return [
47
            "public_key" => $this->getPublicKey(),
48
            "private_key" => $this->getPrivateKey()
49
        ];
50
    }
51
52
53
}
54