NotificationRequest::sendData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-vtcpay
4
 *
5
 * @copyright (c) PHP Viet
6
 * @license [MIT](https://opensource.org/licenses/MIT)
7
 */
8
9
namespace Omnipay\VTCPay\Message;
10
11
/**
12
 * @author Vuong Minh <[email protected]>
13
 * @since 1.0.0
14
 */
15
class NotificationRequest extends AbstractIncomingRequest
16
{
17
    /**
18
     * {@inheritdoc}
19
     * @throws \Omnipay\Common\Exception\InvalidRequestException
20
     */
21
    public function getData(): array
22
    {
23
        $this->validate('data');
24
25
        return parent::getData();
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function sendData($data): IncomingResponse
32
    {
33
        $signature = $data['signature'];
34
        $dataNormalized = explode('|', $data['data']);
35
        [$amount, $message, $payment_type, $reference_number, $status, $trans_ref_no, $website_id] = $dataNormalized;
0 ignored issues
show
Bug introduced by
The variable $amount does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $message does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $payment_type does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $reference_number does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $status does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $trans_ref_no does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $website_id does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
36
        $data = compact(
37
            'amount', 'message', 'payment_type', 'reference_number', 'status', 'trans_ref_no', 'website_id'
38
        );
39
        $data['signature'] = $signature;
40
41
        return parent::sendData($data);
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    protected function getIncomingParameters(): array
48
    {
49
        return $this->httpRequest->request->all();
50
    }
51
}
52