Completed
Pull Request — master (#36)
by
unknown
09:03
created

Members::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Trello\Api\Organization;
4
5
use Trello\Api\AbstractApi;
6
use Trello\Api\Member;
7
use Trello\Exception\InvalidArgumentException;
8
9
/**
10
 * Trello Board Members API
11
 * @link https://trello.com/docs/api/board
12
 *
13
 * Fully implemented.
14
 */
15 View Code Duplication
class Members extends AbstractApi
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...
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