Completed
Push — master ( 8fe2d8...225854 )
by Andrii
20:54 queued 20:54
created

OldCompletePurchaseRequest::calculateSign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 9
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
cc 1
eloc 7
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * InterKassa driver for the Omnipay PHP payment processing library
5
 *
6
 * @link      https://github.com/hiqdev/omnipay-interkassa
7
 * @package   omnipay-interkassa
8
 * @license   MIT
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace Omnipay\InterKassa\Message;
13
14
/**
15
 * InterKassa Complete Purchase Request
16
 * Implements request for APIv1.
17
 */
18
class OldCompletePurchaseRequest extends CompletePurchaseRequest
19
{
20
    /**
21
     * Send the request with specified data.
22
     *
23
     * @param mixed $data The data to send
24
     *
25
     * @return OldCompletePurchaseResponse
26
     */
27 4
    public function sendData($data)
28
    {
29 4
        return $this->response = new OldCompletePurchaseResponse($this, $data);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 4 View Code Duplication
    public function calculateSign($data)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
    {
37 4
        unset($data['ik_sign_hash']);
38 4
        ksort($data, SORT_STRING);
39 4
        array_push($data, $this->getSecret());
40 4
        $signString = implode(':', $data);
41 4
        $sign = base64_encode(hash('sha256', $signString, true));
42 4
        return $sign;
43
    }
44
}
45