Member   A
last analyzed

Complexity

Total Complexity 18

Size/Duplication

Total Lines 258
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 10

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 18
lcom 2
cbo 10
dl 0
loc 258
ccs 36
cts 36
cp 1
rs 10
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 4 1
A update() 0 4 1
A getDeltas() 0 4 1
A setAvatarSource() 0 4 1
A setBio() 0 4 1
A setFullName() 0 4 1
A setInitials() 0 4 1
A setUsername() 0 4 1
A setAvatar() 0 4 1
A actions() 0 4 1
A boards() 0 4 1
A cards() 0 4 1
A notifications() 0 4 1
A organizations() 0 4 1
A customBackgrounds() 0 4 1
A customEmoji() 0 4 1
A customStickers() 0 4 1
A savedSearches() 0 4 1
1
<?php
2
3
namespace Trello\Api;
4
5
/**
6
 * Trello Member API
7
 * @link https://trello.com/docs/api/member
8
 *
9
 * Not implemented:
10
 * - Board backgrounds API @see Member\Board\Backgrounds
11
 * - Board stars API @see Member\Board\Stars
12
 * - Custom backgrounds API @see Member\CustomBackgrounds
13
 * - Saved Searches API @see Member\SavedSearches
14
 * - Custom Emoji API @see Member\CustomEmoji
15
 * - Custom Stickers API @see Member\CustomStickers
16
 * - https://trello.com/docs/api/member/#get-1-members-idmember-or-username-tokens
17
 * - https://trello.com/docs/api/member/#put-1-members-idmember-or-username-prefs-colorblind
18
 * - https://trello.com/docs/api/member/#put-1-members-idmember-or-username-prefs-minutesbetweensummaries
19
 * - https://trello.com/docs/api/member/#post-1-members-idmember-or-username-onetimemessagesdismissed
20
 * - https://trello.com/docs/api/member/#post-1-members-idmember-or-username-unpaidaccount
21
 */
22
class Member extends AbstractApi
23
{
24
    /**
25
     * Base path of members api
26
     * @var string
27
     */
28
    protected $path = 'members';
29
30
    /**
31
     * Member fields
32
     * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-field
33
     * @var array
34
     */
35
    public static $fields = array(
36
        'avatarHash',
37
        'bio',
38
        'bioData',
39
        'confirmed',
40
        'fullName',
41
        'idPremOrgsAdmin',
42
        'initials',
43
        'memberType',
44
        'products',
45
        'status',
46
        'url',
47
        'username',
48
        'avatarSource',
49
        'email',
50
        'gravatarHash',
51
        'idBoards',
52
        'idBoardsPinned',
53
        'idOrganizations',
54
        'loginTypes',
55
        'newEmail',
56
        'oneTimeMessagesDismissed',
57
        'prefs',
58
        'status',
59
        'trophies',
60
        'uploadedAvatarHash',
61
        'premiumFeatures'
62
    );
63
64
    /**
65
     * Find a member by id or username
66
     * @link https://trello.com/docs/api/member/index.html#get-1-members-idmember-or-username
67
     *
68
     * @param string $id     the member's id or username
69
     * @param array  $params optional attributes
70
     *
71
     * @return array list info
72
     */
73 1
    public function show($id, array $params = array())
74
    {
75 1
        return $this->get($this->getPath().'/'.rawurlencode($id), $params);
76
    }
77
78
    /**
79
     * Update a member
80
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username
81
     *
82
     * @param string $id     the member's id or username
83
     * @param array  $params attributes to update: 'fullName', 'initials', 'username', 'bio',
84
     *                       'avatarSource', 'prefs/colorBlind', 'prefs/minutesBetweenSummaries'
85
     *
86
     * @return array list info
87
     */
88 1
    public function update($id, array $params = array())
89
    {
90 1
        return $this->put($this->getPath().'/'.rawurlencode($id), $params);
91
    }
92
93
    /**
94
     * Get a given member's deltas
95
     * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-deltas
96
     *
97
     * @param string $id     the member's id or username
98
     * @param array  $params optional parameters
99
     *
100
     * @return array
101
     */
102 1
    public function getDeltas($id, array $params = array())
103
    {
104 1
        return $this->get($this->path.'/'.rawurlencode($id).'/deltas', $params);
105
    }
106
107
    /**
108
     * Set a given member's avatarSource
109
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-avatarSource
110
     *
111
     * @param string $id           the member's id or username
112
     * @param string $avatarSource the avatarSource, one of 'none', 'upload', 'gravatar'
113
     *
114
     * @return array
115
     */
116 1
    public function setAvatarSource($id, $avatarSource)
117
    {
118 1
        return $this->put($this->getPath().'/'.rawurlencode($id).'/avatarSource', array('value' => $avatarSource));
119
    }
120
121
    /**
122
     * Set a given member's bio
123
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-bio
124
     *
125
     * @param string $id  the member's id or username
126
     * @param string $bio the bio
127
     *
128
     * @return array
129
     */
130 1
    public function setBio($id, $bio)
131
    {
132 1
        return $this->put($this->getPath().'/'.rawurlencode($id).'/bio', array('value' => $bio));
133
    }
134
135
    /**
136
     * Set a given member's full name
137
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-fullname
138
     *
139
     * @param string $id       the member's id or username
140
     * @param string $fullName the full name
141
     *
142
     * @return array
143
     */
144 1
    public function setFullName($id, $fullName)
145
    {
146 1
        return $this->put($this->getPath().'/'.rawurlencode($id).'/fullName', array('value' => $fullName));
147
    }
148
149
    /**
150
     * Set a given member's initials
151
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-initials
152
     *
153
     * @param string $id       the member's id or username
154
     * @param string $initials the initials
155
     *
156
     * @return array
157
     */
158 1
    public function setInitials($id, $initials)
159
    {
160 1
        return $this->put($this->getPath().'/'.rawurlencode($id).'/initials', array('value' => $initials));
161
    }
162
163
    /**
164
     * Set a given member's username
165
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-username-username
166
     *
167
     * @param string $id       the member's id or username
168
     * @param string $username the username
169
     *
170
     * @return array
171
     */
172 1
    public function setUsername($id, $username)
173
    {
174 1
        return $this->put($this->getPath().'/'.rawurlencode($id).'/username', array('value' => $username));
175
    }
176
177
    /**
178
     * Set a given member's avatar
179
     * @link https://trello.com/docs/api/member/#put-1-members-idmember-or-avatar-avatar
180
     *
181
     * @param string $id     the member's id or avatar
182
     *
183
     * @return array
184
     */
185 1
    public function setAvatar($id, $file)
186
    {
187 1
        return $this->post($this->getPath().'/'.rawurlencode($id).'/avatar', array('file' => $file));
188
    }
189
190
    /**
191
     * Actions API
192
     *
193
     * @return Member\Actions
194
     */
195 1
    public function actions()
196
    {
197 1
        return new Member\Actions($this->client);
198
    }
199
200
    /**
201
     * Boards API
202
     *
203
     * @return Member\Boards
204
     */
205 3
    public function boards()
206
    {
207 3
        return new Member\Boards($this->client);
208
    }
209
210
    /**
211
     * Cards API
212
     *
213
     * @return Member\Cards
214
     */
215 1
    public function cards()
216
    {
217 1
        return new Member\Cards($this->client);
218
    }
219
220
    /**
221
     * Notifications API
222
     *
223
     * @return Member\Notifications
224
     */
225 1
    public function notifications()
226
    {
227 1
        return new Member\Notifications($this->client);
228
    }
229
230
    /**
231
     * Organizations API
232
     *
233
     * @return Member\Organizations
234
     */
235 1
    public function organizations()
236
    {
237 1
        return new Member\Organizations($this->client);
238
    }
239
240
    /**
241
     * Custom Backgrounds API
242
     *
243
     * @return Member\CustomBackgrounds
244
     */
245 1
    public function customBackgrounds()
246
    {
247 1
        return new Member\CustomBackgrounds($this->client);
248
    }
249
250
    /**
251
     * Custom Emoji API
252
     *
253
     * @return Member\CustomEmoji
254
     */
255 1
    public function customEmoji()
256
    {
257 1
        return new Member\CustomEmoji($this->client);
258
    }
259
260
    /**
261
     * Custom Stickers API
262
     *
263
     * @return Member\CustomStickers
264
     */
265 1
    public function customStickers()
266
    {
267 1
        return new Member\CustomStickers($this->client);
268
    }
269
270
    /**
271
     * Saved Searches API
272
     *
273
     * @return Member\SavedSearches
274
     */
275 1
    public function savedSearches()
276
    {
277 1
        return new Member\SavedSearches($this->client);
278
    }
279
}
280