Total Complexity | 5 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class Team extends AbstractEntity implements ImmutableInterface { |
||
21 | |||
22 | const DIR = 'teams'; |
||
23 | const TYPE = 'team'; |
||
24 | |||
25 | protected const MAP = [ |
||
26 | 'organization' => Workspace::class |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * @param User $user |
||
31 | * @return $this |
||
32 | */ |
||
33 | public function addUser (User $user) { |
||
34 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * The team's projects. |
||
40 | * |
||
41 | * @see https://developers.asana.com/docs/get-a-teams-projects |
||
42 | * |
||
43 | * @param array $filter |
||
44 | * @return Project[] |
||
45 | */ |
||
46 | public function getProjects (array $filter = Project::GET_ACTIVE) { |
||
47 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
||
48 | } |
||
49 | |||
50 | public function getUrl (): string { |
||
51 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * The team's users. |
||
56 | * |
||
57 | * @see https://developers.asana.com/docs/get-users-in-a-team |
||
58 | * |
||
59 | * @return User[] |
||
60 | */ |
||
61 | public function getUsers () { |
||
62 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @param User $user |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function removeUser (User $user) { |
||
72 | } |
||
73 | } |