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

Boards::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
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\Board;
7
use Trello\Api\Member\Board\Backgrounds;
8
use Trello\Api\Member\Board\Stars;
9
use Trello\Exception\InvalidArgumentException;
10
11
/**
12
 * Trello Organization Boards API
13
 * @link https://trello.com/docs/api/organization
14
 *
15
 * Fully implemented.
16
 */
17
class Boards extends AbstractApi
18
{
19
    protected $path = 'organizations/#id#/boards';
20
21
    /**
22
     * Get boads related to a given organization
23
     * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name-boards
24
     *
25
     * @param string $id     the organization's id or username
26
     * @param array  $params optional parameters
27
     *
28
     * @return array
29
     */
30
    public function all($id, array $params = array())
31
    {
32
        return $this->get($this->getPath($id), $params);
33
    }
34
35
    /**
36
     * Filter boards related to a given organization
37
     * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name-boards-filter
38
     *
39
     * @param string       $id     the board's id
40
     * @param string|array $filter array of / one of 'all', none', 'open', 'closed', 'all'
41
     *
42
     * @return array
43
     */
44 View Code Duplication
    public function filter($id, $filter = 'all')
0 ignored issues
show
Duplication introduced by
This method 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...
45
    {
46
        $allowed = array('all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred');
47
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
48
49
        return $this->get($this->getPath($id) . '/' . implode(',', $filters));
50
    }
51
}
52