Failed Conditions
Push — v7 ( d5cb12...d36fb1 )
by Florent
02:58
created

PrivateKey   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 4 1
A getSecret() 0 4 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2017 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\Component\Core\Util\Ecc;
13
14
/**
15
 * *********************************************************************
16
 * Copyright (C) 2012 Matyas Danter.
17
 *
18
 * Permission is hereby granted, free of charge, to any person obtaining
19
 * a copy of this software and associated documentation files (the "Software"),
20
 * to deal in the Software without restriction, including without limitation
21
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
22
 * and/or sell copies of the Software, and to permit persons to whom the
23
 * Software is furnished to do so, subject to the following conditions:
24
 *
25
 * The above copyright notice and this permission notice shall be included
26
 * in all copies or substantial portions of the Software.
27
 *
28
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
31
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
32
 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34
 * OTHER DEALINGS IN THE SOFTWARE.
35
 * ***********************************************************************
36
 */
37
38
/**
39
 * This class serves as public - private key exchange for signature verification.
40
 */
41
final class PrivateKey
42
{
43
    /**
44
     * @var \GMP
45
     */
46
    private $secret;
47
48
    /**
49
     * @param \GMP $secret
50
     */
51
    private function __construct(\GMP $secret)
52
    {
53
        $this->secret = $secret;
54
    }
55
56
    /**
57
     * @param \GMP $secret
58
     *
59
     * @return PrivateKey
60
     */
61
    public static function create(\GMP $secret): PrivateKey
62
    {
63
        return new self($secret);
64
    }
65
66
    /**
67
     * @return \GMP
68
     */
69
    public function getSecret(): \GMP
70
    {
71
        return $this->secret;
72
    }
73
}
74