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

CompletePurchaseRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 1
Metric Value
wmc 4
c 4
b 1
f 1
lcom 2
cbo 4
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 13 3
A sendData() 0 4 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
use Omnipay\Common\Exception\InvalidResponseException;
15
16
/**
17
 * InterKassa Complete Purchase Request.
18
 */
19
class CompletePurchaseRequest extends AbstractRequest
20
{
21
    /**
22
     * Get the data for this request.
23
     * @throws InvalidResponseException
24
     * @throws \Omnipay\Common\Exception\InvalidRequestException
25
     * @return array request data
26
     */
27 10
    public function getData()
28
    {
29 10
        $this->validate('secret');
30
31 10
        $result = [];
32 10
        foreach ($this->httpRequest->request->all() as $key => $parameter) {
33 10
            if (strpos($key, 'ik_') === 0) {
34 10
                $result[$key] = $parameter;
35 10
            }
36 10
        }
37
38 10
        return $result;
39
    }
40
41
    /**
42
     * Send the request with specified data.
43
     *
44
     * @param mixed $data The data to send
45
     *
46
     * @return CompletePurchaseResponse
47
     */
48 4
    public function sendData($data)
49
    {
50 4
        return $this->response = new CompletePurchaseResponse($this, $data);
51
    }
52
}
53