AbstractIncomingRequest::getIncomingParameters()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-momo
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace Omnipay\MoMo\Message\AllInOne;
9
10
use Symfony\Component\HttpFoundation\ParameterBag;
11
use Omnipay\MoMo\Message\AbstractIncomingRequest as BaseAbstractIncomingRequest;
12
13
/**
14
 * @author Vuong Minh <[email protected]>
15
 * @since 1.0.0
16
 */
17
abstract class AbstractIncomingRequest extends BaseAbstractIncomingRequest
18
{
19
    /**
20
     * {@inheritdoc}
21
     * @throws \Omnipay\Common\Exception\InvalidResponseException
22
     */
23
    public function sendData($data): IncomingResponse
24
    {
25
        return $this->response = new IncomingResponse($this, $data);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function getIncomingParameters(): array
32
    {
33
        $data = [];
34
        $params = [
35
            'partnerCode', 'accessKey', 'requestId', 'amount', 'orderId', 'orderInfo', 'orderType', 'transId',
36
            'message', 'localMessage', 'responseTime', 'errorCode', 'extraData', 'signature', 'payType',
37
        ];
38
        $bag = $this->getIncomingParametersBag();
39
40
        foreach ($params as $param) {
41
            $data[$param] = $bag->get($param);
42
        }
43
44
        return $data;
45
    }
46
47
    /**
48
     * Trả về request parameter bag.
49
     *
50
     * @return \Symfony\Component\HttpFoundation\ParameterBag
51
     */
52
    abstract protected function getIncomingParametersBag(): ParameterBag;
53
}
54