Code Duplication    Length = 43-57 lines in 2 locations

src/Resource/BankAccountList.php 1 location

@@ 7-63 (lines=57) @@
4
5
use stdClass;
6
7
class BankAccountList extends MoipResource
8
{
9
    /**
10
     * Path bank accounts API.
11
     *
12
     * @const string
13
     */
14
    const PATH = 'bankaccounts';
15
16
    /**
17
     * Path accounts API.
18
     *
19
     * @const string
20
     */
21
    const PATH_ACCOUNT = 'accounts';
22
23
    /**
24
     * Initialize a new instance.
25
     */
26
    public function initialize()
27
    {
28
        $this->data = new stdClass();
29
    }
30
31
    /**
32
     * Get bank accounts.
33
     *
34
     * @return array
35
     */
36
    public function getBankAccounts()
37
    {
38
        return $this->data->bankAccounts;
39
    }
40
41
    /**
42
     * Get a bank accounts list.
43
     *
44
     * @param string Account id.
45
     *
46
     * @return stdClass
47
     */
48
    public function get($account_id)
49
    {
50
        return $this->getByPath(sprintf('/%s/%s/%s/%s', MoipResource::VERSION, self::PATH_ACCOUNT, $account_id, self::PATH));
51
    }
52
53
    protected function populate(stdClass $response)
54
    {
55
        $bankAccountsList = clone $this;
56
57
        $bankAccountsList->data = new stdClass();
58
59
        $bankAccountsList->data->bankAccounts = $response;
60
61
        return $bankAccountsList;
62
    }
63
}
64

src/Resource/NotificationPreferencesList.php 1 location

@@ 7-49 (lines=43) @@
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