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.

LegacyShaComposer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 45
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A compose() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the Marlon Ogone package.
5
 *
6
 * (c) Marlon BVBA <[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 Ogone\ShaComposer;
13
14
use Ogone\HashAlgorithm;
15
use Ogone\Passphrase;
16
17
/**
18
 * SHA string composition the "old way", using only the "main" parameters
19
 * @deprecated Use AllParametersShaComposer wherever possible
20
 */
21
class LegacyShaComposer implements ShaComposer
22
{
23
    /**
24
     * @var string Passphrase
25
     */
26
    private $passphrase;
27
28
    /**
29
     * @var HashAlgorithm
30
     */
31
    private $hashAlgorithm;
32
33
    /**
34
     * @param Passphrase $passphrase
35
     * @param HashAlgorithm $hashAlgorithm
36
     */
37
    public function __construct(Passphrase $passphrase, HashAlgorithm $hashAlgorithm = null)
38
    {
39
        $this->passphrase = $passphrase;
0 ignored issues
show
Documentation Bug introduced by
It seems like $passphrase of type object<Ogone\Passphrase> is incompatible with the declared type string of property $passphrase.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
40
        $this->hashAlgorithm = $hashAlgorithm ?: new HashAlgorithm(HashAlgorithm::HASH_SHA1);
41
    }
42
43
    /**
44
     * @param array $parameters
45
     * @return string
46
     */
47
    public function compose(array $parameters)
48
    {
49
        $parameters = array_change_key_case($parameters, CASE_LOWER);
50
51
        return strtoupper(hash($this->hashAlgorithm, implode('', array(
52
            $parameters['orderid'],
53
            $parameters['currency'],
54
            $parameters['amount'],
55
            $parameters['pm'],
56
            $parameters['acceptance'],
57
            $parameters['status'],
58
            $parameters['cardno'],
59
            $parameters['payid'],
60
            $parameters['ncerror'],
61
            $parameters['brand'],
62
            $this->passphrase
63
        ))));
64
    }
65
}
66