Completed
Push — master ( 1f0278...22c246 )
by
unknown
12s
created

NotificationPreferencesList::populate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 9.4285
1
<?php
2
3
namespace Moip\Resource;
4
5
use stdClass;
6
7
class NotificationPreferencesList extends MoipResource
8
{
9
    /**
10
     * @const string
11
     */
12
    const PATH = 'preferences';
13
14
    public function initialize()
15
    {
16
        $this->data = new stdClass();
17
    }
18
19
    /**
20
     * Get notifications.
21
     *
22
     * @return array
23
     */
24
    public function getNotifications()
25
    {
26
        return $this->data->notifications;
27
    }
28
29
    /**
30
     * Get a notification list.
31
     *
32
     * @return stdClass
33
     */
34
    public function get()
35
    {
36
        return $this->getByPath(sprintf('/%s/%s/%s', MoipResource::VERSION, self::PATH, 'notifications'));
37
    }
38
39
    protected function populate(stdClass $response)
40
    {
41
        $notificationsList = clone $this;
42
43
        $notificationsList->data = new stdClass();
44
45
        $notificationsList->data->notifications = $response;
46
47
        return $notificationsList;
48
    }
49
}
50