Code Duplication    Length = 35-39 lines in 3 locations

lib/Trello/Api/Checklist/Cards.php 1 location

@@ 13-47 (lines=35) @@
10
 *
11
 * Fully implemented.
12
 */
13
class Cards extends AbstractApi
14
{
15
    protected $path = 'checklists/#id#/cards';
16
17
    /**
18
     * Get cards related to a given checklist
19
     * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-cards
20
     *
21
     * @param string $id     the checklist's id
22
     * @param array  $params optional parameters
23
     *
24
     * @return array
25
     */
26
    public function all($id, array $params = array())
27
    {
28
        return $this->get($this->getPath($id), $params);
29
    }
30
31
    /**
32
     * Filter cards related to a given checklist
33
     * @link https://trello.com/docs/api/checklist/#get-1-checklists-idchecklist-cards-filter
34
     *
35
     * @param string $id     the checklist's id
36
     * @param array  $filter one of 'none', 'open', 'closed', 'all'
37
     *
38
     * @return array
39
     */
40
    public function filter($id, $filter = 'all')
41
    {
42
        $allowed = array('none', 'open', 'closed', 'all');
43
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
44
45
        return $this->get($this->getPath($id).'/'.implode(',', $filters));
46
    }
47
}
48

lib/Trello/Api/Member/Cards.php 1 location

@@ 13-47 (lines=35) @@
10
 *
11
 * Fully implemented.
12
 */
13
class Cards extends AbstractApi
14
{
15
    protected $path = 'members/#id#/cards';
16
17
    /**
18
     * Get cards related to a given list
19
     * @link https://trello.com/docs/api/member/#get-1-members-idmember-or-username-cards
20
     *
21
     * @param string $id     the member's id or username
22
     * @param array  $params optional parameters
23
     *
24
     * @return array
25
     */
26
    public function all($id, array $params = array())
27
    {
28
        return $this->get($this->getPath($id), $params);
29
    }
30
31
    /**
32
     * Filter cards related to a given list
33
     * @link https://trello.com/docs/api/list/#get-1-lists-idlist-cards-filter
34
     *
35
     * @param string $id     the list's id
36
     * @param array  $filter one of 'none', 'visible', 'open', 'closed', 'all'
37
     *
38
     * @return array
39
     */
40
    public function filter($id, $filter = 'all')
41
    {
42
        $allowed = array('none', 'visible', 'open', 'closed', 'all');
43
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
44
45
        return $this->get($this->getPath($id).'/'.implode(',', $filters));
46
    }
47
}
48

lib/Trello/Api/Organization/Members.php 1 location

@@ 15-53 (lines=39) @@
12
 *
13
 * Fully implemented.
14
 */
15
class Members extends AbstractApi
16
{
17
    /**
18
     * Base path of board members api
19
     * @var string
20
     */
21
    protected $path = 'organizations/#id#/members';
22
23
    /**
24
     * Get a given board's members
25
     * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members
26
     *
27
     * @param string $id     the board's id
28
     * @param array  $params optional parameters
29
     *
30
     * @return array
31
     */
32
    public function all($id, array $params = array())
33
    {
34
        return $this->get($this->getPath($id), $params);
35
    }
36
37
    /**
38
     * Filter members related to a given board
39
     * @link https://trello.com/docs/api/board/#get-1-boards-board-id-members-filter
40
     *
41
     * @param string       $id     the board's id
42
     * @param string|array $filter array of / one of 'none', 'normal', 'admins', 'owners', 'all'
43
     *
44
     * @return array
45
     */
46
    public function filter($id, $filter = 'all')
47
    {
48
        $allowed = array('none', 'normal', 'admins', 'owners', 'all');
49
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
50
51
        return $this->get($this->getPath($id) . '/' . implode(',', $filters));
52
    }
53
}
54