|
1
|
|
|
<?php namespace Rossedman\Teamwork; |
|
2
|
|
|
|
|
3
|
|
|
use Rossedman\Teamwork\Traits\TimeTrait; |
|
4
|
|
|
use Rossedman\Teamwork\Traits\RestfulTrait; |
|
5
|
|
|
|
|
6
|
|
|
class Task extends AbstractObject { |
|
7
|
|
|
|
|
8
|
|
|
use RestfulTrait, TimeTrait; |
|
9
|
|
|
|
|
10
|
|
|
protected $wrapper = 'task'; |
|
11
|
|
|
|
|
12
|
|
|
protected $endpoint = 'tasks'; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Get All Tasks |
|
16
|
|
|
* GET /tasks.json |
|
17
|
|
|
* |
|
18
|
|
|
* @param null $args |
|
19
|
|
|
* |
|
20
|
|
|
* @return mixed |
|
21
|
|
|
*/ |
|
22
|
|
|
public function all($args = null) |
|
23
|
|
|
{ |
|
24
|
|
|
$this->areArgumentsValid($args, ['filter', 'page', 'pageSize', 'startdate', 'enddate', 'updatedAfterDate', 'completedAfterDate', 'completedBeforeDate', 'showDeleted', 'includeCompletedTasks', 'includeCompletedSubtasks', 'creator-ids', 'include', 'responsible-party-ids', 'sort', 'getSubTasks', 'nestSubTasks', 'getFiles', 'dataSet', 'includeToday', 'ignore-start-date']); |
|
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
return $this->client->get($this->endpoint, $args)->response(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Complete A Task |
|
31
|
|
|
* PUT tasks/{id}/complete.json |
|
32
|
|
|
* |
|
33
|
|
|
* @return mixed |
|
34
|
|
|
*/ |
|
35
|
|
|
public function complete() |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->client->put("$this->endpoint/$this->id/complete", [])->response(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Uncomplete A Task |
|
42
|
|
|
* PUT tasks/{id}/uncomplete.json |
|
43
|
|
|
* |
|
44
|
|
|
* @return mixed |
|
45
|
|
|
*/ |
|
46
|
|
|
public function uncomplete() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->client->put("$this->endpoint/$this->id/uncomplete", [])->response(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Time Totals |
|
53
|
|
|
* GET /projects/{id}/time/total.json |
|
54
|
|
|
* |
|
55
|
|
|
* @return mixed |
|
56
|
|
|
*/ |
|
57
|
|
|
public function timeTotal() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->client->get("$this->endpoint/$this->id/time/total")->response(); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Edit A Task |
|
64
|
|
|
* PUT tasks/{id}.json |
|
65
|
|
|
* |
|
66
|
|
|
* @return mixed |
|
67
|
|
|
*/ |
|
68
|
|
|
public function edit($args) |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->client->put("$this->endpoint/$this->id.json", ['todo-item' => $args])->response(); |
|
71
|
|
|
} |
|
72
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: