Completed
Pull Request — master (#18)
by Sam
02:22
created

Algorithms   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 64
ccs 0
cts 2
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMnemonic() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Badcow DNS Library.
5
 *
6
 * (c) Samuel Williams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Badcow\DNS\Rdata\DNSSEC;
13
14
/**
15
 * Algorithms listed in {@link https://tools.ietf.org/html/rfc4034#appendix-A.1}
16
 */
17
class Algorithms
18
{
19
    /**
20
     * RSA/MD5
21
     */
22
    const RSAMD5 = 1;
23
24
    /**
25
     * Diffie-Hellman
26
     */
27
    const DH = 2;
28
29
    /**
30
     * DSA/SHA-1
31
     */
32
    const DSA = 3;
33
34
    /**
35
     * Elliptic Curve
36
     */
37
    const ECC = 4;
38
39
    /**
40
     * RSA/SHA-1
41
     */
42
    const RSASHA1 = 5;
43
44
    /**
45
     * Indirect
46
     */
47
    const INDIRECT = 252;
48
49
    /**
50
     * Private
51
     */
52
    const PRIVATEDNS = 253;
53
54
    /**
55
     * Private
56
     */
57
    const PRIVATEOID = 254;
58
59
    private static $mnemonic = [
60
        self::RSAMD5 => 'RSAMD5',
61
        self::DH => 'DH',
62
        self::DSA => 'DSA',
63
        self::ECC => 'ECC',
64
        self::RSASHA1 => 'RSASHA1',
65
        self::INDIRECT => 'INDIRECT',
66
        self::PRIVATEDNS => 'PRIVATEDNS',
67
        self::PRIVATEOID => 'PRIVATEOID',
68
    ];
69
70
    /**
71
     * Get the associated mnemonic of an algorithm.
72
     *
73
     * @param int $algorithmId
74
     * @return string
75
     */
76
    public static function getMnemonic($algorithmId)
77
    {
78
        return self::$mnemonic[$algorithmId];
79
    }
80
}