Completed
Pull Request — master (#16)
by
unknown
10:04
created

Actions::getCheckItem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 2
1
<?php
2
3
namespace Trello\Api\Card;
4
5
use Trello\Api\AbstractApi;
6
7
/**
8
 * Trello Card Actions API
9
 * @link https://trello.com/docs/api/card
10
 *
11
 * Fully implemented.
12
 */
13
class Actions extends AbstractApi
14
{
15
    protected $path = 'cards/#id#/actions';
16
17
    /**
18
     * Get actions related to a given card
19
     * @link https://trello.com/docs/api/card/#get-1-cards-card-id-or-shortlink-actions
20
     *
21
     * @param string $id     the card's id or short link
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
     * Add comment to a given card
33
     * @link https://trello.com/docs/api/card/#post-1-cards-card-id-or-shortlink-actions-comments
34
     *
35
     * @param string $id   the card's id or short link
36
     * @param string $text comment message
37
     *
38
     * @return array
39
     */
40 1
    public function addComment($id, $text)
41
    {
42 1
        return $this->post($this->getPath($id).'/comments', array('text' => $text));
43
    }
44
45
    /**
46
     * Remove comment to a given card
47
     * @link https://trello.com/docs/api/card/#delete-1-cards-card-id-or-shortlink-actions-idaction-comments
48
     *
49
     * @param string $id        the card's id or short link
50
     * @param string $commentId the comment's id
51
     *
52
     * @return array
53
     */
54 1
    public function removeComment($id, $commentId)
55
    {
56 1
        return $this->delete($this->getPath($id).'/'.rawurlencode($commentId).'/comments');
57
    }
58
    
59
    /**
60
     * Update comment to a given card
61
     * @link https://trello.com/docs/api/card/index.html#put-1-cards-card-id-or-shortlink-actions-idaction-comments
62
     *
63
     * @param string $id        the card's id or short link
64
     * @param string $commentId the comment's id
65
     * @param string $text the new comment text
66
     * @return array
67
     */
68
    public function updateComment($id, $commentId, $text)
69
    {
70
        return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', array('text' => $text));
71
    }
72
    
73
    /**
74
     * Get checkitem from a given card
75
     * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2
76
     *
77
     * @param string $id        the card's id or short link
78
     * @param string $checkItemId the check item id
79
     * @param array $params the parameter array to retrieve, default is to retrieve all fields
80
     *
81
     * @return array
82
     */
83
    public function getCheckItem($id, $checkItemId, array $params = array('fields'=> 'all'))
84
    {
85
        return $this->get($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId), $params);
86
    }
87
88
    /**
89
     * Update checkItem for  a given card
90
     * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-1
91
     *
92
     * @param string $id        the card's id or short link
93
     * @param string $checkItemId the check item id
0 ignored issues
show
Bug introduced by
There is no parameter named $checkItemId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
94
     * @param array $updateFields the fields that should be updated
95
     * @return array
96
     */
97
    public function updateComment($id, $commentId, array $updateFields = array())
98
    {
99
        return $this->put($this->getPath($id).'/'.rawurlencode($commentId).'/comments', $updateFields);
100
    }
101
    
102
    /**
103
     * Remove checkitem from a given card
104
     * @link https://trello.readme.io/v1.0/reference#cardsidcheckitemidcheckitem-2
105
     *
106
     * @param string $id        the card's id or short link
107
     * @param string $checkItemId the checklist item id
108
     *
109
     * @return array
110
     */
111
    public function removeCheckItem($id, $checkItemId)
112
    {
113
        return $this->delete($this->getPath($id).'/checkItem/'.rawurlencode($checkItemId));
114
    }
115
}
116