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') |
|
|
|
|
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
|
|
|
|
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.