Response   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 54
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A paymentPageUrl() 0 3 1
A json_handle() 0 17 3
A id() 0 3 1
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