Skip to content

Commit 683bad4

Browse files
lebedyncrssiroga
authored andcommitted
simplify building of http parameters and use default workspace id in getCustomFields method
1 parent d4ba549 commit 683bad4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Asana.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ public function removeProjectToTask($taskId, $projectId = null)
276276
public function getTasksByFilter($filter = ["assignee" => "", "project" => "", "workspace" => ""])
277277
{
278278
$filter = array_filter(array_merge(["assignee" => "", "project" => "", "workspace" => ""], $filter));
279-
$url = '?' . join('&', array_map(function ($k, $v) {
280-
return "{$k}={$v}";
281-
}, array_keys($filter), $filter));
279+
$url = '?' . http_build_query($filter);
282280

283281
return $this->curl->get("tasks{$url}");
284282
}
@@ -667,8 +665,12 @@ public function getErrors()
667665
* @author Olly Warren https://github.com/ollywarren
668666
* @version 1.0
669667
*/
670-
public function getCustomFields($workspaceId)
668+
public function getCustomFields($workspaceId = null)
671669
{
670+
if (is_null($workspaceId)) {
671+
$workspaceId = $this->defaultWorkspaceId;
672+
}
673+
672674
return $this->curl->get("workspaces/{$workspaceId}/custom_fields");
673675
}
674676

0 commit comments

Comments
 (0)