Completed
Pull Request — master (#37)
by Vitaliy
30:07 queued 26:47
created

UserBalanceMessage   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 8
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 58
ccs 0
cts 28
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getVirtualCurrencyBalance() 0 8 2
A getOperationType() 0 4 1
A getOperationId() 0 4 1
A getCoupon() 0 8 2
A getItemsOperationType() 0 6 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
    public function getVirtualCurrencyBalance()
17
    {
18
        if (!array_key_exists('virtual_currency_balance', $this->request)) {
19
            return array();
20
        }
21
22
        return $this->request['virtual_currency_balance'];
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getOperationType()
29
    {
30
        return $this->request['operation_type'];
31
    }
32
33
    /**
34
     * @return int
35
     */
36
    public function getOperationId()
37
    {
38
        return $this->request['id_operation'];
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public function getCoupon()
45
    {
46
        if (!array_key_exists('coupon', $this->request)) {
47
            return array();
48
        }
49
50
        return $this->request['coupon'];
51
    }
52
53
    /**
54
     * @return string|null
55
     */
56
    public function getItemsOperationType()
57
    {
58
        if (array_key_exists('items_operation_type', $this->request)) {
59
            return $this->request['items_operation_type'];
60
        }
61
    }
62
}
63