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.

KeyVerifier::verifyKeys()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Gbowo\Adapter\Amplifypay\Traits;
4
5
use Gbowo\Adapter\Amplifypay\Exception\KeyMismatchException;
6
7
/**
8
 * An Amplifypay best practice is to verify if the returned `ApiKey` in a response (HTTP 200) matches what was passed
9
 * to them.
10
 * @see https://amplifypay.com/developers Verifying transactions
11
 * @author Lanre Adelowo <[email protected]>
12
 * Class KeyVerifier
13
 * @package Gbowo\Adapter\Amplifypay\Traits
14
 */
15
trait KeyVerifier
16
{
17
18
    /**
19
     * @param string $returnedKey
20
     * @param string $userKey
21
     * @throws \Gbowo\Adapter\Amplifypay\Exception\KeyMismatchException if the keys don't match
22
     */
23 5
    protected function verifyKeys(string $returnedKey, string $userKey)
24
    {
25 5
        if (strcmp($returnedKey, $userKey) !== 0) {
26 1
            throw new KeyMismatchException("Api keys don't match");
27
        }
28
29 4
        return;
30
    }
31
}
32