GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Algorithm   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 49
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 3 1
A validate() 0 5 1
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Security\Encryptions;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class Algorithm
20
 * @package O2System\Security\Encryptions
21
 */
22
class Algorithm
23
{
24
    public static $supported = [
25
        'HS1'         => ['hash_hmac', 'sha1'],
26
        'HS256'       => ['hash_hmac', 'sha256'],
27
        'HS512'       => ['hash_hmac', 'sha512'],
28
        'HS384'       => ['hash_hmac', 'sha384'],
29
        'HMAC-SHA1'   => ['HMAC', 'sha1'],
30
        'HMAC-SHA256' => ['HMAC', 'sha256'],
31
        'HMAC-SHA512' => ['HMAC', 'sha512'],
32
        'HMAC-SHA384' => ['HMAC', 'sha384'],
33
        'RS1'         => ['openssl', OPENSSL_ALGO_SHA1],
34
        'RS256'       => ['openssl', OPENSSL_ALGO_SHA256],
35
        'RS384'       => ['openssl', OPENSSL_ALGO_SHA384],
36
        'RS512'       => ['openssl', OPENSSL_ALGO_SHA512],
37
    ];
38
39
    // ------------------------------------------------------------------------
40
41
    /**
42
     * Algorithm::validate
43
     *
44
     * Validate algorithm
45
     *
46
     * @param string $algorithm
47
     *
48
     * @return bool
49
     */
50
    public static function validate($algorithm)
51
    {
52
        $algorithm = strtoupper($algorithm);
53
54
        return (bool)array_key_exists($algorithm, static::$supported);
55
    }
56
57
    // ------------------------------------------------------------------------
58
59
    /**
60
     * Algorithm::map
61
     *
62
     * Gets algorithm map.
63
     *
64
     * @param string $algorithm
65
     *
66
     * @return array
67
     */
68
    public static function map($algorithm)
69
    {
70
        return static::$supported[ $algorithm ];
71
    }
72
}