1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Trello; |
4
|
|
|
|
5
|
|
|
class Manager |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @var ClientInterface |
9
|
|
|
*/ |
10
|
|
|
protected $client; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Constructor. |
14
|
|
|
* |
15
|
|
|
* @param ClientInterface $client |
16
|
|
|
*/ |
17
|
|
|
public function __construct(ClientInterface $client) |
18
|
|
|
{ |
19
|
|
|
$this->client = $client; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Get organization by id or create a new one |
24
|
|
|
* |
25
|
|
|
* @param string $id the organization's id |
26
|
|
|
* |
27
|
|
|
* @return Model\OrganizationInterface |
28
|
|
|
*/ |
29
|
|
|
public function getOrganization($id = null) |
30
|
|
|
{ |
31
|
|
|
return new Model\Organization($this->client, $id); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get board by id or create a new one |
36
|
|
|
* |
37
|
|
|
* @param string $id the board's id |
38
|
|
|
* |
39
|
|
|
* @return Model\BoardInterface |
40
|
|
|
*/ |
41
|
|
|
public function getBoard($id = null) |
42
|
|
|
{ |
43
|
|
|
return new Model\Board($this->client, $id); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get cardlist by id or create a new one |
48
|
|
|
* |
49
|
|
|
* @param string $id the cardlist's id |
50
|
|
|
* |
51
|
|
|
* @return Model\CardlistInterface |
52
|
|
|
*/ |
53
|
|
|
public function getList($id = null) |
54
|
|
|
{ |
55
|
|
|
return new Model\Cardlist($this->client, $id); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Get card by id or create a new one |
60
|
|
|
* |
61
|
|
|
* @param string $id the card's id |
62
|
|
|
* |
63
|
|
|
* @return Model\CardInterface |
64
|
|
|
*/ |
65
|
|
|
public function getCard($id = null) |
66
|
|
|
{ |
67
|
|
|
return new Model\Card($this->client, $id); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get label by id or create a new one |
72
|
|
|
* |
73
|
|
|
* @param string $id the label's id |
74
|
|
|
* |
75
|
|
|
* @return Model\LabelInterface |
76
|
|
|
*/ |
77
|
|
|
public function getLabel($id = null) |
78
|
|
|
{ |
79
|
|
|
return new Model\Label($this->client, $id); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get checklist by id or create a new one |
84
|
|
|
* |
85
|
|
|
* @param string $id the checklist's id |
86
|
|
|
* |
87
|
|
|
* @return Model\ChecklistInterface |
88
|
|
|
*/ |
89
|
|
|
public function getChecklist($id = null) |
90
|
|
|
{ |
91
|
|
|
return new Model\Checklist($this->client, $id); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Get member by id or create a new one |
96
|
|
|
* |
97
|
|
|
* @param string $id the member's id |
98
|
|
|
* |
99
|
|
|
* @return Model\MemberInterface |
100
|
|
|
*/ |
101
|
|
|
public function getMember($id = null) |
102
|
|
|
{ |
103
|
|
|
return new Model\Member($this->client, $id); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get action by id |
108
|
|
|
* |
109
|
|
|
* @param string $id the action's id |
110
|
|
|
* |
111
|
|
|
* @return Model\ActionInterface |
112
|
|
|
*/ |
113
|
|
|
public function getAction($id) |
114
|
|
|
{ |
115
|
|
|
return new Model\Action($this->client, $id); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Get token by id |
120
|
|
|
* |
121
|
|
|
* @param string $id the token's id |
122
|
|
|
* |
123
|
|
|
* @return Model\TokenInterface |
124
|
|
|
*/ |
125
|
|
|
public function getToken($id) |
126
|
|
|
{ |
127
|
|
|
return new Model\Token($this->client, $id); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get webhook by id |
132
|
|
|
* |
133
|
|
|
* @param string $id the webhook's id |
134
|
|
|
* |
135
|
|
|
* @return Model\WebhookInterface |
136
|
|
|
*/ |
137
|
|
|
public function getWebhook($id) |
138
|
|
|
{ |
139
|
|
|
return new Model\Webhook($this->client, $id); |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|