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

CompletePurchaseRequest::getData()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 9.4285
cc 3
eloc 7
nc 3
nop 0
crap 3
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