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.

HmacSha1::buildSignature()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 3
1
<?php
2
/**
3
 * The MIT License
4
 * Copyright (c) 2007 Andy Smith
5
 */
6
namespace Abraham\TwitterOAuth;
7
8
/**
9
 * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
10
 * where the Signature Base String is the text and the key is the concatenated values (each first
11
 * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
12
 * character (ASCII code 38) even if empty.
13
 *   - Chapter 9.2 ("HMAC-SHA1")
14
 */
15
class HmacSha1 extends SignatureMethod
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20
    public function getName()
21
    {
22
        return "HMAC-SHA1";
23
    }
24
25
    /**
26
     * {@inheritDoc}
27
     */
28
    public function buildSignature(Request $request, Consumer $consumer, Token $token = null)
29
    {
30
        $signatureBase = $request->getSignatureBaseString();
31
32
        $parts = [$consumer->secret, null !== $token ? $token->secret : ""];
33
34
        $parts = Util::urlencodeRfc3986($parts);
35
        $key = implode('&', $parts);
36
37
        return base64_encode(hash_hmac('sha1', $signatureBase, $key, true));
38
    }
39
}
40