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.
Test Setup Failed
Push — master ( 500279...2f8c13 )
by
unknown
02:35
created

Hmac   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A hash() 0 12 4
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 Hmac
20
 * @package O2System\Security\Encryptions
21
 */
22
class Hmac
23
{
24
    /**
25
     * Hmac::hash
26
     *
27
     * Generate a keyed hash value using the HMAC method.
28
     *
29
     * @param string              $algo
30
     * @param string|array|object $data
31
     * @param string              $key
32
     * @param bool                $rawOutput
33
     *
34
     * @return string
35
     */
36
    public static function hash($algo, $data, $key, $rawOutput = false)
37
    {
38
        if (is_array($data) || is_object($data)) {
39
            $data = serialize($data);
40
        }
41
42
        if (strpos($algo, 'HMAC-') !== false) {
43
            $algo = str_replace('HMAC-', '', $algo);
44
            $algo = strtolower($algo);
45
        }
46
47
        return hash_hmac($algo, $data, $key, $rawOutput);
48
    }
49
}