• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

podio-community / podio-php / 5637863962

pending completion
5637863962

push

github

daniel-sc
feat: remove PodioClient instance field from models and make all model operations static

resolves #234

94 of 94 new or added lines in 64 files covered. (100.0%)

916 of 2104 relevant lines covered (43.54%)

24.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/models/PodioTask.php
1
<?php
2
/**
3
 * @see https://developers.podio.com/doc/tasks
4
 */
5
class PodioTask extends PodioObject
6
{
7
    public function __construct($attributes = array())
8
    {
9
        parent::__construct();
×
10
        $this->property('task_id', 'integer', array('id' => true));
×
11
        $this->property('status', 'string');
×
12
        $this->property('group', 'string');
×
13
        $this->property('text', 'string');
×
14
        $this->property('description', 'string');
×
15
        $this->property('private', 'boolean');
×
16
        $this->property('due_on', 'datetime');
×
17
        $this->property('due_date', 'string');
×
18
        $this->property('due_time', 'string');
×
19
        $this->property('space_id', 'integer');
×
20
        $this->property('link', 'string');
×
21
        $this->property('created_on', 'datetime');
×
22
        $this->property('completed_on', 'datetime');
×
23
        $this->property('external_id', 'string');
×
24

25
        $this->has_one('ref', 'Reference');
×
26
        $this->has_one('created_by', 'ByLine');
×
27
        $this->has_one('completed_by', 'ByLine');
×
28
        $this->has_one('created_via', 'Via');
×
29
        $this->has_one('deleted_via', 'Via');
×
30
        $this->has_one('completed_via', 'Via');
×
31
        $this->has_one('responsible', 'User', array('json_value' => 'user_id'));
×
32
        $this->has_one('reminder', 'Reminder');
×
33
        $this->has_one('recurrence', 'Recurrence');
×
34
        $this->has_many('labels', 'TaskLabel', array('json_value' => 'label_id', 'json_target' => 'label_ids'));
×
35
        $this->has_many('files', 'File', array('json_value' => 'file_id', 'json_target' => 'file_ids'));
×
36
        $this->has_many('comments', 'Comment');
×
37

38
        $this->init($attributes);
×
39
    }
40

41
    /**
42
     * Creates or updates a task
43
     */
44
    public static function save(PodioClient $podio_client, PodioTask $task)
45
    {
46
        if ($task->id) {
×
47
            return self::update($podio_client, $task->id, $task);
×
48
        } else {
49
            $new = self::create($podio_client, $task);
×
50
            $task->task_id = $new->task_id;
×
51
            return $task;
×
52
        }
53
    }
54

55
    /**
56
     * @see https://developers.podio.com/doc/tasks/create-task-22419
57
     */
58
    public static function create(PodioClient $podio_client, $attributes = array(), $options = array())
59
    {
60
        $url = $podio_client->url_with_options("/task/", $options);
×
61
        return self::member($podio_client, $podio_client->post($url, $attributes));
×
62
    }
63

64
    /**
65
     * @see https://developers.podio.com/doc/tasks/create-task-with-reference-22420
66
     */
67
    public static function create_for(PodioClient $podio_client, $ref_type, $ref_id, $attributes = array(), $options = array())
68
    {
69
        $url = $podio_client->url_with_options("/task/{$ref_type}/{$ref_id}/", $options);
×
70
        return self::member($podio_client, $podio_client->post($url, $attributes));
×
71
    }
72

73
    /**
74
     * @see https://developers.podio.com/doc/tasks/get-task-22413
75
     */
76
    public static function get(PodioClient $podio_client, $task_id)
77
    {
78
        return self::member($podio_client, $podio_client->get("/task/{$task_id}"));
×
79
    }
80

81
    /**
82
     * @see https://developers.podio.com/doc/tasks/get-tasks-77949
83
     */
84
    public static function get_all(PodioClient $podio_client, $attributes = array())
85
    {
86
        return self::listing($podio_client, $podio_client->get("/task/", $attributes));
×
87
    }
88

89
    /**
90
     * @see https://developers.podio.com/doc/tasks/delete-task-77179
91
     */
92
    public static function delete(PodioClient $podio_client, $task_id)
93
    {
94
        return $podio_client->delete("/task/{$task_id}");
×
95
    }
96

97
    /**
98
     * @see https://developers.podio.com/doc/tasks/remove-task-reference-6146114
99
     */
100
    public static function delete_ref(PodioClient $podio_client, $task_id)
101
    {
102
        return $podio_client->delete("/task/{$task_id}/ref");
×
103
    }
104

105
    /**
106
     * @see https://developers.podio.com/doc/tasks/update-task-10583674
107
     */
108
    public static function update(PodioClient $podio_client, $task_id, $attributes = array(), $options = array())
109
    {
110
        $url = $podio_client->url_with_options("/task/{$task_id}", $options);
×
111
        return self::member($podio_client, $podio_client->put($url, $attributes));
×
112
    }
113

114
    /**
115
     * @see https://developers.podio.com/doc/tasks/assign-task-22412
116
     */
117
    public static function assign(PodioClient $podio_client, $task_id, $attributes = array())
118
    {
119
        return $podio_client->post("/task/{$task_id}/assign", $attributes);
×
120
    }
121

122
    /**
123
     * @see https://developers.podio.com/doc/tasks/complete-task-22432
124
     */
125
    public static function complete(PodioClient $podio_client, $task_id)
126
    {
127
        return $podio_client->post("/task/{$task_id}/complete");
×
128
    }
129

130
    /**
131
     * @see https://developers.podio.com/doc/tasks/incomplete-task-22433
132
     */
133
    public static function incomplete(PodioClient $podio_client, $task_id)
134
    {
135
        return $podio_client->post("/task/{$task_id}/incomplete");
×
136
    }
137

138
    /**
139
     * @see https://developers.podio.com/doc/tasks/rank-task-81015
140
     */
141
    public static function rank(PodioClient $podio_client, $task_id, $attributes = array())
142
    {
143
        return $podio_client->post("/task/{$task_id}/rank", $attributes);
×
144
    }
145

146
    /**
147
     * @see https://developers.podio.com/doc/calendar/get-task-calendar-as-ical-10195650
148
     */
149
    public static function ical(PodioClient $podio_client, $task_id)
150
    {
151
        return $podio_client->get("/calendar/task/{$task_id}/ics/")->body;
×
152
    }
153

154
    /**
155
     * @see https://developers.podio.com/doc/tasks/get-task-summary-1612017
156
     */
157
    public static function get_summary(PodioClient $podio_client, $attributes = array())
158
    {
159
        $result = $podio_client->get("/task/summary", $attributes)->json_body();
×
160
        $result['overdue']['tasks'] = self::listing($podio_client, $result['overdue']['tasks']);
×
161
        $result['today']['tasks'] = self::listing($podio_client, $result['today']['tasks']);
×
162
        $result['other']['tasks'] = self::listing($podio_client, $result['other']['tasks']);
×
163
        return $result;
×
164
    }
165

166
    /**
167
     * @see https://developers.podio.com/doc/tasks/get-task-summary-for-personal-1657217
168
     */
169
    public static function get_summary_personal(PodioClient $podio_client, $attributes = array())
170
    {
171
        $result = $podio_client->get("/task/personal/summary", $attributes)->json_body();
×
172
        $result['overdue']['tasks'] = self::listing($podio_client, $result['overdue']['tasks']);
×
173
        $result['today']['tasks'] = self::listing($podio_client, $result['today']['tasks']);
×
174
        $result['other']['tasks'] = self::listing($podio_client, $result['other']['tasks']);
×
175
        return $result;
×
176
    }
177

178
    /**
179
     * @see https://developers.podio.com/doc/tasks/get-task-summary-for-organization-1612063
180
     */
181
    public static function get_summary_for_org(PodioClient $podio_client, $org_id, $attributes = array())
182
    {
183
        $result = $podio_client->get("/task/org/{$org_id}/summary", $attributes)->json_body();
×
184
        $result['overdue']['tasks'] = self::listing($podio_client, $result['overdue']['tasks']);
×
185
        $result['today']['tasks'] = self::listing($podio_client, $result['today']['tasks']);
×
186
        $result['other']['tasks'] = self::listing($podio_client, $result['other']['tasks']);
×
187
        return $result;
×
188
    }
189

190
    /**
191
     * @see https://developers.podio.com/doc/tasks/get-task-summary-for-space-1612130
192
     */
193
    public static function get_summary_for_space(PodioClient $podio_client, $space_id, $attributes = array())
194
    {
195
        $result = $podio_client->get("/task/space/{$space_id}/summary", $attributes)->json_body();
×
196
        $result['overdue']['tasks'] = self::listing($podio_client, $result['overdue']['tasks']);
×
197
        $result['today']['tasks'] = self::listing($podio_client, $result['today']['tasks']);
×
198
        $result['other']['tasks'] = self::listing($podio_client, $result['other']['tasks']);
×
199
        return $result;
×
200
    }
201

202
    /**
203
     * @see https://developers.podio.com/doc/tasks/get-task-summary-for-reference-1657980
204
     */
205
    public static function get_summary_for(PodioClient $podio_client, $ref_type, $ref_id, $attributes = array())
206
    {
207
        $result = $podio_client->get("/task/{$ref_type}/{$ref_id}/summary", $attributes)->json_body();
×
208
        $result['overdue']['tasks'] = self::listing($podio_client, $result['overdue']['tasks']);
×
209
        $result['today']['tasks'] = self::listing($podio_client, $result['today']['tasks']);
×
210
        $result['other']['tasks'] = self::listing($podio_client, $result['other']['tasks']);
×
211
        return $result;
×
212
    }
213

214
    /**
215
     * @see https://developers.podio.com/doc/tasks/update-task-reference-170733
216
     */
217
    public static function update_reference(PodioClient $podio_client, $task_id, $attributes = array())
218
    {
219
        return $podio_client->put("/task/{$task_id}/ref", $attributes)->body;
×
220
    }
221

222
    /**
223
     * @see https://developers.podio.com/doc/tasks/get-task-count-38316458
224
     */
225
    public static function count(PodioClient $podio_client, $ref_type, $ref_id)
226
    {
227
        return $podio_client->get("/task/{$ref_type}/{$ref_id}/count")->json_body();
×
228
    }
229

230
    /**
231
     * @see https://developers.podio.com/doc/tasks/update-task-private-22434
232
     */
233
    public static function update_private(PodioClient $podio_client, PodioTask $task, $private_flag, $options = array())
234
    {
235
        $url = $podio_client->url_with_options("/task/{$task->id}/private", $options);
×
236
        return $podio_client->put($url, array('private' => $private_flag))->body;
×
237
    }
238
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc