1
|
|
|
<?php namespace Rossedman\Teamwork; |
2
|
|
|
|
3
|
|
|
use Rossedman\Teamwork\Traits\TimeTrait; |
4
|
|
|
use Rossedman\Teamwork\Traits\RestfulTrait; |
5
|
|
|
|
6
|
|
|
class Project extends AbstractObject { |
7
|
|
|
|
8
|
|
|
use RestfulTrait, TimeTrait; |
9
|
|
|
|
10
|
|
|
protected $wrapper = 'project'; |
11
|
|
|
|
12
|
|
|
protected $endpoint = 'projects'; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Get Project Activity |
16
|
|
|
* GET /projects/{project_id}/activity.json |
17
|
|
|
* |
18
|
|
|
* @return mixed |
19
|
|
|
*/ |
20
|
|
|
public function activity($args = null) |
21
|
|
|
{ |
22
|
|
|
$this->areArgumentsValid($args, ['maxItems']); |
23
|
|
|
|
24
|
|
|
return $this->client->get("$this->endpoint/$this->id/latestActivity", $args)->response(); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Get Companies In Project |
29
|
|
|
* GET /projects/{project_id}/companies.json |
30
|
|
|
* |
31
|
|
|
* @retun mixed |
32
|
|
|
*/ |
33
|
|
|
public function companies() |
34
|
|
|
{ |
35
|
|
|
return $this->client->get("$this->endpoint/$this->id/companies")->response(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Get People On Project |
40
|
|
|
* GET /projects/{project_id}/people.json |
41
|
|
|
* |
42
|
|
|
* @return mixed |
43
|
|
|
*/ |
44
|
|
|
public function people() |
45
|
|
|
{ |
46
|
|
|
return $this->client->get("$this->endpoint/$this->id/people")->response(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Get Starred Projects |
51
|
|
|
* GET /projects/starred.json |
52
|
|
|
* |
53
|
|
|
* @return mixed |
54
|
|
|
*/ |
55
|
|
|
public function starred() |
56
|
|
|
{ |
57
|
|
|
return $this->client->get("$this->endpoint/starred")->response(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Star A Project |
62
|
|
|
* PUT /projects/{$id}/star.json |
63
|
|
|
* |
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
|
|
public function star() |
67
|
|
|
{ |
68
|
|
|
return $this->client->put("$this->endpoint/$this->id/star", [])->response(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Unstar A Project |
73
|
|
|
* PUT /projects/{$id}/unstar.json |
74
|
|
|
* |
75
|
|
|
* @return mixed |
76
|
|
|
*/ |
77
|
|
|
public function unstar() |
78
|
|
|
{ |
79
|
|
|
return $this->client->put("$this->endpoint/$this->id/unstar", [])->response(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* All Project Links |
84
|
|
|
* GET /projects/{id}/links.json |
85
|
|
|
* |
86
|
|
|
* @return mixed |
87
|
|
|
*/ |
88
|
|
|
public function links() |
89
|
|
|
{ |
90
|
|
|
return $this->client->get("$this->endpoint/$this->id/links")->response(); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Time Totals |
95
|
|
|
* GET /projects/{id}/time/total.json |
96
|
|
|
* |
97
|
|
|
* @return mixed |
98
|
|
|
*/ |
99
|
|
|
public function timeTotal() |
100
|
|
|
{ |
101
|
|
|
return $this->client->get("$this->endpoint/$this->id/time/total")->response(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Latest Messages |
106
|
|
|
* GET /projects/{project_id}/posts.json |
107
|
|
|
* |
108
|
|
|
* @return mixed |
109
|
|
|
*/ |
110
|
|
|
public function latestMessages() |
111
|
|
|
{ |
112
|
|
|
return $this->client->get("$this->endpoint/$this->id/posts")->response(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Archived Messages |
117
|
|
|
* GET /projects/{project_id}/posts/archive.json |
118
|
|
|
* |
119
|
|
|
* @return mixed |
120
|
|
|
*/ |
121
|
|
|
public function archivedMessages() |
122
|
|
|
{ |
123
|
|
|
return $this->client->get("$this->endpoint/$this->id/posts/archive")->response(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* List Milestones |
128
|
|
|
* GET /projects/{project_id}/milestones.json |
129
|
|
|
* |
130
|
|
|
* @param null $args |
131
|
|
|
* |
132
|
|
|
* @return mixed |
133
|
|
|
*/ |
134
|
|
|
public function milestones($args = null) |
135
|
|
|
{ |
136
|
|
|
$this->areArgumentsValid($args, ['getProgress']); |
|
|
|
|
137
|
|
|
|
138
|
|
|
return $this->client->get("$this->endpoint/$this->id/milestones", $args)->response(); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Create milestone associated with this project |
143
|
|
|
* POST /projects/{project_id}/milestones.json |
144
|
|
|
* |
145
|
|
|
* @param $args |
146
|
|
|
* |
147
|
|
|
* @return mixed |
148
|
|
|
*/ |
149
|
|
|
public function createMilestone($args) { |
150
|
|
|
return $this->client->post("$this->endpoint/$this->id/milestones", ['milestone' => $args])->response(); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* Create tasklist associated with this project |
155
|
|
|
* POST /projects/{project_id}/tasklists.json |
156
|
|
|
* |
157
|
|
|
* @param $args |
158
|
|
|
* |
159
|
|
|
* @return mixed |
160
|
|
|
*/ |
161
|
|
|
public function createTasklist($args) { |
162
|
|
|
return $this->client->post("$this->endpoint/$this->id/tasklists", ['todo-list' => $args])->response(); |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Tasklists |
167
|
|
|
* GET /projects/{project_id}/tasklists.json |
168
|
|
|
* |
169
|
|
|
* @return [type] [description] |
|
|
|
|
170
|
|
|
*/ |
171
|
|
|
public function tasklists($args = null) |
172
|
|
|
{ |
173
|
|
|
return $this->client->get("$this->endpoint/$this->id/tasklists", $args)->response(); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Emailaddresses |
178
|
|
|
* GET /projects/{project_id}/emailaddress.json |
179
|
|
|
* |
180
|
|
|
* @return [type] [description] |
|
|
|
|
181
|
|
|
*/ |
182
|
|
|
public function emailAddress($args = null) |
183
|
|
|
{ |
184
|
|
|
return $this->client->get("$this->endpoint/$this->id/emailaddress", $args)->response(); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
|
188
|
|
|
} |
189
|
|
|
|
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: