Failed Conditions
Push — master ( 1edcb4...1e22a0 )
by Florent
02:06
created

PrivateKey::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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