Completed
Push — master ( 4a5840...1f0278 )
by
unknown
11s
created

Webhook::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Moip\Resource;
4
5
use stdClass;
6
7
class Webhook extends MoipResource
8
{
9
    /**
10
     * Initialize a new instance.
11
     */
12
    public function initialize()
13
    {
14
        $this->data = new stdClass();
15
    }
16
17
    /**
18
     * Get webhook id.
19
     *
20
     * @return string The webhook id.
21
     */
22
    public function getId()
23
    {
24
        return $this->getIfSet('id');
25
    }
26
27
    /**
28
     * Get resource id.
29
     *
30
     * @return string The webhook id.
31
     */
32
    public function getResourceId()
33
    {
34
        return $this->getIfSet('resourceId');
35
    }
36
37
    /**
38
     * Get event.
39
     *
40
     * @return string event.
41
     */
42
    public function getEvent()
43
    {
44
        return $this->getIfSet('event');
45
    }
46
47
    /**
48
     * Get url.
49
     *
50
     * @return string url.
51
     */
52
    public function getUrl()
53
    {
54
        return $this->getIfSet('url');
55
    }
56
57
    /**
58
     * Get webhook status.
59
     *
60
     * @return string webhook status.
61
     */
62
    public function getStatus()
63
    {
64
        return $this->getIfSet('status');
65
    }
66
67
    /**
68
     * Mount structure of Webhook.
69
     *
70
     * @param \stdClass $response
71
     *
72
     * @return \Moip\Resource\Webhook Webhook
73
     */
74
    protected function populate(stdClass $response)
75
    {
76
        $webhook = clone $this;
77
        $webhook->data = new stdClass();
78
79
        $webhook->data->id = $response->id;
80
        $webhook->data->event = $response->event;
81
        $webhook->data->url = $response->url;
82
        $webhook->data->resourceId = $response->resourceId;
83
        $webhook->data->status = $response->status;
84
85
        return $webhook;
86
    }
87
}
88