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

CompletePurchaseRequest::sendData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
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
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