Completed
Push — master ( 4517c4...dc88ca )
by
unknown
05:54
created

BankAccountList::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Moip\Resource;
4
5
use stdClass;
6
7 View Code Duplication
class BankAccountList extends MoipResource
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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