1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ciromattia\Teamwork; |
4
|
|
|
|
5
|
|
|
use Ciromattia\Teamwork\Traits\TimeTrait; |
6
|
|
|
use Ciromattia\Teamwork\Traits\RestfulTrait; |
7
|
|
|
|
8
|
|
|
class Task extends TeamworkObject |
9
|
|
|
{ |
10
|
|
|
use RestfulTrait, TimeTrait; |
11
|
|
|
|
12
|
|
|
protected $wrapper = 'task'; |
13
|
|
|
protected $endpoint = 'tasks'; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Get All Tasks |
17
|
|
|
* GET /tasks.json |
18
|
|
|
* |
19
|
|
|
* @param null $args |
20
|
|
|
* |
21
|
|
|
* @return mixed |
22
|
|
|
*/ |
23
|
|
|
public function all($args = null) |
24
|
|
|
{ |
25
|
|
|
$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']); |
|
|
|
|
26
|
|
|
|
27
|
|
|
return $this->client->get($this->endpoint, $args)->response(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Complete A Task |
32
|
|
|
* PUT tasks/{id}/complete.json |
33
|
|
|
* |
34
|
|
|
* @return mixed |
35
|
|
|
*/ |
36
|
|
|
public function complete() |
37
|
|
|
{ |
38
|
|
|
return $this->client->put("$this->endpoint/$this->id/complete", [])->response(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Uncomplete A Task |
43
|
|
|
* PUT tasks/{id}/uncomplete.json |
44
|
|
|
* |
45
|
|
|
* @return mixed |
46
|
|
|
*/ |
47
|
|
|
public function uncomplete() |
48
|
|
|
{ |
49
|
|
|
return $this->client->put("$this->endpoint/$this->id/uncomplete", [])->response(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Time Totals |
54
|
|
|
* GET /projects/{id}/time/total.json |
55
|
|
|
* |
56
|
|
|
* @return mixed |
57
|
|
|
*/ |
58
|
|
|
public function timeTotal() |
59
|
|
|
{ |
60
|
|
|
return $this->client->get("$this->endpoint/$this->id/time/total")->response(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Create Time Entry |
65
|
|
|
* POST /tasks/{id}/time_entries.json |
66
|
|
|
* |
67
|
|
|
* @param $data |
68
|
|
|
* |
69
|
|
|
* @return mixed |
70
|
|
|
*/ |
71
|
|
|
public function createTime($data) |
72
|
|
|
{ |
73
|
|
|
return $this->client->post("$this->endpoint/$this->id/time_entries", ['time-entry' => $data])->response(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Edit A Task |
78
|
|
|
* PUT tasks/{id}.json |
79
|
|
|
* |
80
|
|
|
* @return mixed |
81
|
|
|
*/ |
82
|
|
|
public function edit($args) |
83
|
|
|
{ |
84
|
|
|
return $this->client->put("$this->endpoint/$this->id.json", ['todo-item' => $args])->response(); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
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: