Response::id()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace UAPAY\Reports\Client;
4
5
use UAPAY\Log as Log;
6
use UAPAY\Exception;
7
8
class Response extends \UAPAY\Response
9
{
10
    /**
11
     *      @var string
12
     */
13
    protected $id;
14
15
    /**
16
     *      @var string
17
     */
18
    protected $paymentPageUrl;
19
20
    /**
21
     *      Handle decoded JSON
22
     *
23
     *      @throws Exception\JSON
24
     */
25
    protected function json_handle()
26
    {
27
        parent::json_handle();
28
29
        if (!isset($this->json['data']['id']))
30
        {
31
            throw new Exception\JSON('data does not contain the id field!');
32
        }
33
34
        $this->id = $this->json['data']['id'];
35
36
        if (!isset($this->json['data']['paymentPageUrl']))
37
        {
38
            throw new Exception\JSON('data does not contain the paymentPageUrl field!');
39
        }
40
41
        $this->paymentPageUrl = $this->json['data']['paymentPageUrl'];
42
    }
43
44
    /**
45
     *      Get order id
46
     *
47
     *      @return string id order
48
     */
49
    public function id()
50
    {
51
        return $this->id;
52
    }
53
54
    /**
55
     *      Get paymentPageUrl to go to the payment page
56
     *
57
     *      @return string paymentPageUrl
58
     */
59
    public function paymentPageUrl()
60
    {
61
        return $this->paymentPageUrl;
62
    }
63
}
64