Completed
Push — master ( ae6388...60bf23 )
by
unknown
19s queued 18s
created

AbstractResponse::getAcknowledgementState()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ReceiptValidator\GooglePlay;
4
5
/**
6
 * Class AbstractResponse.
7
 */
8
abstract class AbstractResponse
9
{
10
    const CONSUMPTION_STATE_YET_TO_BE_CONSUMED = 0;
11
    const CONSUMPTION_STATE_CONSUMED = 1;
12
    const PURCHASE_STATE_PURCHASED = 0;
13
    const PURCHASE_STATE_CANCELED = 1;
14
    const ACKNOWLEDGEMENT_STATE_YET_TO_BE = 0;
15
    const ACKNOWLEDGEMENT_STATE_DONE = 1;
16
17
    /**
18
     * @var \Google_Service_AndroidPublisher_ProductPurchase|\Google_Service_AndroidPublisher_SubscriptionPurchase
19
     */
20
    protected $response;
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param \Google_Service_AndroidPublisher_ProductPurchase|\Google_Service_AndroidPublisher_SubscriptionPurchase $response
26
     */
27 3
    public function __construct($response)
28
    {
29 3
        $this->response = $response;
30 3
    }
31
32
    /**
33
     * @return array|string
34
     */
35 1
    public function getDeveloperPayload()
36
    {
37 1
        return $this->response->getDeveloperPayload();
38
    }
39
40
    /**
41
     * @return int
42
     */
43
    public function getAcknowledgementState()
44
    {
45
        return $this->response->acknowledgementState;
46
    }
47
48
    /**
49
     * @return bool
50
     */
51
    public function isAcknowledged()
52
    {
53
        return $this->response->acknowledgementState === static::ACKNOWLEDGEMENT_STATE_DONE;
54
    }
55
56
    /**
57
     * @return string
58
     */
59 1
    public function getKind()
60
    {
61 1
        return $this->response->kind;
62
    }
63
64
    /**
65
     * @return \Google_Service_AndroidPublisher_ProductPurchase|\Google_Service_AndroidPublisher_SubscriptionPurchase
66
     */
67 1
    public function getRawResponse()
68
    {
69 1
        return $this->response;
70
    }
71
}
72