Completed
Push — master ( 11f8f0...b6346a )
by
unknown
04:00
created

PaymentMessage::getPurchase()   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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Xsolla\SDK\Webhook\Message;
4
5
class PaymentMessage extends Message
6
{
7
    /**
8
     * @return array
9
     */
10 2
    public function getPurchase()
11
    {
12 2
        return $this->request['purchase'];
13
    }
14
15
    /**
16
     * @return array
17
     */
18 2
    public function getTransaction()
19
    {
20 2
        return $this->request['transaction'];
21
    }
22
23
    /**
24
     * @return int
25
     */
26 2
    public function getPaymentId()
27
    {
28 2
        return $this->request['transaction']['id'];
29
    }
30
31
    /**
32
     * @return string|null
33
     */
34 4
    public function getExternalPaymentId()
35
    {
36 4
        if (array_key_exists('external_id', $this->request['transaction'])) {
37 2
            return $this->request['transaction']['external_id'];
38
        }
39
    }
40
41
    /**
42
     * @return array
43
     */
44 2
    public function getPaymentDetails()
45
    {
46 2
        return $this->request['payment_details'];
47
    }
48
49
    /**
50
     * @return array
51
     */
52 4
    public function getCustomParameters()
53
    {
54 4
        if (!array_key_exists('custom_parameters', $this->request)) {
55 2
            return array();
56
        }
57
58 2
        return $this->request['custom_parameters'];
59
    }
60
61
    /**
62
     * @return bool
63
     */
64 4
    public function isDryRun()
65
    {
66 4
        if (!array_key_exists('dry_run', $this->request['transaction'])) {
67 2
            return false;
68
        }
69
70 2
        return (bool) $this->request['transaction']['dry_run'];
71
    }
72
}
73