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

UserBalanceMessage::getCoupon()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Xsolla\SDK\Webhook\Message;
4
5
class UserBalanceMessage extends Message
6
{
7
    const PAYMENT = 'payment';
8
    const IN_GAME_PURCHASE = 'inGamePurchase';
9
    const COUPON = 'coupon';
10
    const INTERNAL = 'internal';
11
    const CANCELLATION = 'cancellation';
12
13
    /**
14
     * @return array
15
     */
16 2
    public function getVirtualCurrencyBalance()
17
    {
18 2
        if (!array_key_exists('virtual_currency_balance', $this->request)) {
19 1
            return array();
20
        }
21
22 1
        return $this->request['virtual_currency_balance'];
23
    }
24
25
    /**
26
     * @return string
27
     */
28 1
    public function getOperationType()
29
    {
30 1
        return $this->request['operation_type'];
31
    }
32
33
    /**
34
     * @return int
35
     */
36 1
    public function getOperationId()
37
    {
38 1
        return $this->request['id_operation'];
39
    }
40
41
    /**
42
     * @return array
43
     */
44 2
    public function getCoupon()
45
    {
46 2
        if (!array_key_exists('coupon', $this->request)) {
47 1
            return array();
48
        }
49
50 1
        return $this->request['coupon'];
51
    }
52
53
    /**
54
     * @return string|null
55
     */
56 2
    public function getItemsOperationType()
57
    {
58 2
        if (array_key_exists('items_operation_type', $this->request)) {
59 1
            return $this->request['items_operation_type'];
60
        }
61
    }
62
}
63