Cards::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Trello\Api\Checklist;
4
5
use Trello\Api\AbstractApi;
6
7
/**
8
 * Trello Checklist Cards API
9
 * @link https://trello.com/docs/api/checklist
10
 *
11
 * Fully implemented.
12
 */
13 View Code Duplication
class Cards 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...
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 1
    public function all($id, array $params = array())
27
    {
28 1
        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 3
    public function filter($id, $filter = 'all')
41
    {
42 3
        $allowed = array('none', 'open', 'closed', 'all');
43 3
        $filters = $this->validateAllowedParameters($allowed, $filter, 'filter');
44
45 3
        return $this->get($this->getPath($id).'/'.implode(',', $filters));
46
    }
47
}
48