Token::getWebhooks()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace Trello\Model;
4
5
/**
6
 * @codeCoverageIgnore
7
 */
8
class Token extends AbstractObject implements TokenInterface
9
{
10
    protected $apiName = 'token';
11
12
    protected $loadParams = array(
13
        'fields' => 'all',
14
        'webhooks' => true,
15
    );
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getIdentifier()
21
    {
22
        return $this->data['identifier'];
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getMemberId()
29
    {
30
        return $this->data['idMember'];
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getMember()
37
    {
38
        return new Member($this->client, $this->data['idMember']);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getDateOfCreation()
45
    {
46
        return new \DateTime($this->data['dateCreated']);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getDateOfExpiry()
53
    {
54
        return new \DateTime($this->data['dateExpires']);
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getPermissions()
61
    {
62
        return $this->data['permissions'];
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getWebhooks()
69
    {
70
        $webhooks = array();
71
72
        foreach ($this->data['webhooks'] as $webhook) {
73
            $webhooks[] = new Webhook($this->client, $webhook['id']);
74
        }
75
76
        return $webhooks;
77
    }
78
}
79