Completed
Pull Request — master (#36)
by
unknown
08:41
created

Boards::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Trello\Api\Organization;
4
5
use Trello\Api\AbstractApi;
6
7
/**
8
 * Trello Organization Boards API
9
 * @link https://trello.com/docs/api/organization
10
 *
11
 * Fully implemented.
12
 */
13
class Boards extends AbstractApi
14
{
15
    protected $path = 'organization/#id#/boards';
16
17
    /**
18
     * Get boads related to a given organization
19
     * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name-boards
20
     *
21
     * @param string $id     the organization's id or username
22
     * @param array  $params optional parameters
23
     *
24
     * @return array
25
     */
26 1
    public function all($id, array $params = array())
27
    {
28 1
        return $this->get($this->getPath($id), $params);
29
    }
30
31
    /**
32
     * Filter boards related to a given organization
33
     * @link https://trello.com/docs/api/organization/#get-1-organizations-idorg-or-name-boards-filter
34
     *
35
     * @param string       $id     the board's id
36
     * @param string|array $filter array of / one of 'all', none', 'open', 'closed', 'all'
37
     *
38
     * @return array
39
     */
40 3 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...
41
    {
42 3
        $allowed = array('all', 'members', 'organization', 'public', 'open', 'closed', 'pinned', 'unpinned', 'starred');
43 3
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
44
45 3
        return $this->get($this->getPath($id).'/'.implode(',', $filters));
46
    }
47
}
48