@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param User $user |
67 | 67 | * @return $this |
68 | 68 | */ |
69 | - public function addMember (User $user) { |
|
69 | + public function addMember(User $user) { |
|
70 | 70 | return $this->addMembers([$user]); |
71 | 71 | } |
72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param User[] $users |
75 | 75 | * @return $this |
76 | 76 | */ |
77 | - public function addMembers (array $users) { |
|
77 | + public function addMembers(array $users) { |
|
78 | 78 | return $this->_addWithPost("{$this}/addMembers", [ |
79 | 79 | 'members' => array_column($users, 'gid') |
80 | 80 | ], 'members', $users); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param Project $project |
85 | 85 | * @return $this |
86 | 86 | */ |
87 | - public function addProject (Project $project) { |
|
87 | + public function addProject(Project $project) { |
|
88 | 88 | $this->api->post("{$this}/addItem", ['item' => $project->getGid()]); |
89 | 89 | return $this; |
90 | 90 | } |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return Traversable|Project[] |
96 | 96 | */ |
97 | - public function getIterator () { |
|
97 | + public function getIterator() { |
|
98 | 98 | return $this->api->loadEach($this, Project::class, "{$this}/items"); |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * @return Project[] |
103 | 103 | */ |
104 | - public function getProjects () { |
|
104 | + public function getProjects() { |
|
105 | 105 | return iterator_to_array($this); |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param User $user |
110 | 110 | * @return $this |
111 | 111 | */ |
112 | - public function removeMember (User $user) { |
|
112 | + public function removeMember(User $user) { |
|
113 | 113 | return $this->removeMembers([$user]); |
114 | 114 | } |
115 | 115 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param User[] $users |
118 | 118 | * @return $this |
119 | 119 | */ |
120 | - public function removeMembers (array $users) { |
|
120 | + public function removeMembers(array $users) { |
|
121 | 121 | return $this->_removeWithPost("{$this}/removeMembers", [ |
122 | 122 | 'members' => array_column($users, 'gid') |
123 | 123 | ], 'members', $users); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param Project $project |
128 | 128 | * @return $this |
129 | 129 | */ |
130 | - public function removeProject (Project $project) { |
|
130 | + public function removeProject(Project $project) { |
|
131 | 131 | $this->api->post("{$this}/removeItem", ['item' => $project->getGid()]); |
132 | 132 | return $this; |
133 | 133 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param callable $filter `fn( Project $project ): bool` |
137 | 137 | * @return Project[] |
138 | 138 | */ |
139 | - public function selectProjects (callable $filter) { |
|
139 | + public function selectProjects(callable $filter) { |
|
140 | 140 | return $this->_select($this, $filter); |
141 | 141 | } |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param User $user |
31 | 31 | * @return $this |
32 | 32 | */ |
33 | - public function addUser (User $user) { |
|
33 | + public function addUser(User $user) { |
|
34 | 34 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
35 | 35 | return $this; |
36 | 36 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @param array $filter |
44 | 44 | * @return Project[] |
45 | 45 | */ |
46 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
46 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
47 | 47 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - final public function getUrl (): string { |
|
53 | + final public function getUrl(): string { |
|
54 | 54 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
55 | 55 | } |
56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return User[] |
63 | 63 | */ |
64 | - public function getUsers () { |
|
64 | + public function getUsers() { |
|
65 | 65 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
66 | 66 | } |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return Project |
72 | 72 | */ |
73 | - public function newProject () { |
|
73 | + public function newProject() { |
|
74 | 74 | /** @var Project $project */ |
75 | 75 | $project = $this->api->factory($this, Project::class, [ |
76 | 76 | 'workspace' => $this->getOrganization() |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param User $user |
83 | 83 | * @return $this |
84 | 84 | */ |
85 | - public function removeUser (User $user) { |
|
85 | + public function removeUser(User $user) { |
|
86 | 86 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
87 | 87 | return $this; |
88 | 88 | } |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | 'target' => Task::class |
52 | 52 | ]; |
53 | 53 | |
54 | - public function __construct ($caller, array $data = []) { |
|
54 | + public function __construct($caller, array $data = []) { |
|
55 | 55 | parent::__construct($caller, $data); |
56 | 56 | $this->parent = $this->getTarget(); |
57 | 57 | } |
58 | 58 | |
59 | - protected function _setData (array $data): void { |
|
59 | + protected function _setData(array $data): void { |
|
60 | 60 | // hearts were deprecated for likes |
61 | 61 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
62 | 62 | |
@@ -66,70 +66,70 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * @return bool |
68 | 68 | */ |
69 | - final public function isAssignment (): bool { |
|
69 | + final public function isAssignment(): bool { |
|
70 | 70 | return $this->getResourceSubtype() === self::TYPE_ASSIGNED; |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - final public function isComment (): bool { |
|
76 | + final public function isComment(): bool { |
|
77 | 77 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @return bool |
82 | 82 | */ |
83 | - final public function isDueDate (): bool { |
|
83 | + final public function isDueDate(): bool { |
|
84 | 84 | return $this->getResourceSubtype() === self::TYPE_DUE_DATE_CHANGED; |
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - final public function isEdited (): bool { |
|
90 | + final public function isEdited(): bool { |
|
91 | 91 | return $this->_is('is_edited'); |
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @return bool |
96 | 96 | */ |
97 | - final public function isFromApi (): bool { |
|
97 | + final public function isFromApi(): bool { |
|
98 | 98 | return $this->getSource() === 'api'; |
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * @return bool |
103 | 103 | */ |
104 | - final public function isFromWeb (): bool { |
|
104 | + final public function isFromWeb(): bool { |
|
105 | 105 | return $this->getSource() === 'web'; |
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - final public function isLikedComment (): bool { |
|
111 | + final public function isLikedComment(): bool { |
|
112 | 112 | return $this->getResourceSubtype() === self::TYPE_COMMENT_LIKED; |
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @return bool |
117 | 117 | */ |
118 | - final public function isLikedTask (): bool { |
|
118 | + final public function isLikedTask(): bool { |
|
119 | 119 | return $this->getResourceSubtype() === self::TYPE_LIKED; |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - final public function isPinned (): bool { |
|
125 | + final public function isPinned(): bool { |
|
126 | 126 | return $this->_is('is_pinned'); |
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
130 | 130 | * @return bool |
131 | 131 | */ |
132 | - final public function isTag (): bool { |
|
132 | + final public function isTag(): bool { |
|
133 | 133 | return $this->getResourceSubtype() === self::TYPE_TAGGED; |
134 | 134 | } |
135 | 135 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param bool $pinned |
138 | 138 | * @return $this |
139 | 139 | */ |
140 | - final public function setPinned (bool $pinned) { |
|
140 | + final public function setPinned(bool $pinned) { |
|
141 | 141 | return $this->_set('is_pinned', $pinned); |
142 | 142 | } |
143 | 143 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param Section $section |
31 | 31 | * @return $this |
32 | 32 | */ |
33 | - final public function setSection (Section $section) { |
|
33 | + final public function setSection(Section $section) { |
|
34 | 34 | $this->_set('project', $section->getProject()); |
35 | 35 | $this->_set('section', $section); |
36 | 36 | return $this; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @param string $file |
44 | 44 | * @return $this |
45 | 45 | */ |
46 | - public function create (string $file) { |
|
46 | + public function create(string $file) { |
|
47 | 47 | assert(!$this->hasGid()); |
48 | 48 | // api returns compact version. reload. |
49 | 49 | $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param Task $task |
31 | 31 | * @param array $data |
32 | 32 | */ |
33 | - public function __construct (Task $task, array $data = []) { |
|
33 | + public function __construct(Task $task, array $data = []) { |
|
34 | 34 | $this->task = $task; |
35 | 35 | parent::__construct($task, $data); |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param mixed $value |
43 | 43 | * @return $this |
44 | 44 | */ |
45 | - protected function _set (string $field, $value) { |
|
45 | + protected function _set(string $field, $value) { |
|
46 | 46 | $this->task->diff['external'] = true; |
47 | 47 | return parent::_set($field, $value); |
48 | 48 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return mixed |
54 | 54 | */ |
55 | - public function getDataJsonDecoded () { |
|
55 | + public function getDataJsonDecoded() { |
|
56 | 56 | if (strlen($data = $this->getData())) { |
57 | - return json_decode($data, true, 512, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
57 | + return json_decode($data, true, 512, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
58 | 58 | } |
59 | 59 | return null; |
60 | 60 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @return Task |
64 | 64 | */ |
65 | - public function getTask () { |
|
65 | + public function getTask() { |
|
66 | 66 | return $this->task; |
67 | 67 | } |
68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param mixed $data |
74 | 74 | * @return $this |
75 | 75 | */ |
76 | - public function setDataJsonEncoded ($data) { |
|
76 | + public function setDataJsonEncoded($data) { |
|
77 | 77 | if (isset($data)) { |
78 | 78 | return $this->setData(json_encode($data, JSON_THROW_ON_ERROR)); |
79 | 79 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param Task $task |
54 | 54 | * @param array $data |
55 | 55 | */ |
56 | - public function __construct (Task $task, array $data = []) { |
|
56 | + public function __construct(Task $task, array $data = []) { |
|
57 | 57 | $this->task = $task; |
58 | 58 | parent::__construct($task, $data); |
59 | 59 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param mixed $unused |
64 | 64 | * @internal called by an entry |
65 | 65 | */ |
66 | - final public function __set (string $gid, $unused): void { |
|
66 | + final public function __set(string $gid, $unused): void { |
|
67 | 67 | $this->diff[$gid] = true; |
68 | 68 | $this->task->diff['custom_fields'] = true; |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param mixed $unused |
73 | 73 | * @internal called by the task |
74 | 74 | */ |
75 | - final public function __unset ($unused): void { |
|
75 | + final public function __unset($unused): void { |
|
76 | 76 | $this->diff = []; |
77 | 77 | foreach ($this->data as $entry) { |
78 | 78 | $entry->diff = []; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string $i |
84 | 84 | * @param array $data |
85 | 85 | */ |
86 | - protected function _setField (string $i, $data): void { |
|
86 | + protected function _setField(string $i, $data): void { |
|
87 | 87 | /** @var FieldEntry $entry */ |
88 | 88 | $entry = $this->api->factory($this, FieldEntry::class, $data); |
89 | 89 | $gid = $entry->getGid(); |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | * @param string $offset |
98 | 98 | * @return string |
99 | 99 | */ |
100 | - protected function _toGid (string $offset): string { |
|
100 | + protected function _toGid(string $offset): string { |
|
101 | 101 | return $this->gids[$offset] ?? $offset; |
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @return int |
106 | 106 | */ |
107 | - final public function count (): int { |
|
107 | + final public function count(): int { |
|
108 | 108 | return count($this->data); |
109 | 109 | } |
110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param $fieldGid |
113 | 113 | * @return FieldEntry |
114 | 114 | */ |
115 | - public function getField ($fieldGid) { |
|
115 | + public function getField($fieldGid) { |
|
116 | 116 | return $this->data[$fieldGid]; |
117 | 117 | } |
118 | 118 | |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @param string $name |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - final public function getGid (string $name): string { |
|
123 | + final public function getGid(string $name): string { |
|
124 | 124 | return $this->gids[$name]; |
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
128 | 128 | * @return string[] |
129 | 129 | */ |
130 | - final public function getGids () { |
|
130 | + final public function getGids() { |
|
131 | 131 | return $this->gids; |
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | 135 | * @return Generator |
136 | 136 | */ |
137 | - public function getIterator () { |
|
137 | + public function getIterator() { |
|
138 | 138 | foreach ($this->data as $gid => $field) { |
139 | 139 | yield $gid => $field->getValue(); |
140 | 140 | } |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | * @param string $fieldGid |
145 | 145 | * @return string |
146 | 146 | */ |
147 | - final public function getName (string $fieldGid): string { |
|
147 | + final public function getName(string $fieldGid): string { |
|
148 | 148 | return $this->names[$fieldGid]; |
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
152 | 152 | * @return string[] |
153 | 153 | */ |
154 | - final public function getNames () { |
|
154 | + final public function getNames() { |
|
155 | 155 | return $this->names; |
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @return array |
160 | 160 | */ |
161 | - final public function getValues (): array { |
|
161 | + final public function getValues(): array { |
|
162 | 162 | return iterator_to_array($this); |
163 | 163 | } |
164 | 164 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param string $offset |
167 | 167 | * @return bool |
168 | 168 | */ |
169 | - final public function offsetExists ($offset): bool { |
|
169 | + final public function offsetExists($offset): bool { |
|
170 | 170 | return isset($this->data[$this->_toGid($offset)]); |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $offset |
175 | 175 | * @return null|number|string |
176 | 176 | */ |
177 | - final public function offsetGet ($offset) { |
|
177 | + final public function offsetGet($offset) { |
|
178 | 178 | return $this->data[$this->_toGid($offset)]->getValue(); |
179 | 179 | } |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param string $offset |
183 | 183 | * @param null|number|string $value |
184 | 184 | */ |
185 | - final public function offsetSet ($offset, $value): void { |
|
185 | + final public function offsetSet($offset, $value): void { |
|
186 | 186 | $this->data[$this->_toGid($offset)]->setValue($value); |
187 | 187 | } |
188 | 188 | |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param string $offset |
193 | 193 | */ |
194 | - final public function offsetUnset ($offset): void { |
|
194 | + final public function offsetUnset($offset): void { |
|
195 | 195 | $this->offsetSet($offset, null); |
196 | 196 | } |
197 | 197 | |
198 | - public function toArray (bool $diff = false): array { |
|
198 | + public function toArray(bool $diff = false): array { |
|
199 | 199 | if ($diff) { |
200 | 200 | return array_map(function(FieldEntry $entry) { |
201 | 201 | return $entry->getValue(); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'memberships' => 'memberships.(project|section)' |
122 | 122 | ]; |
123 | 123 | |
124 | - private function _onSave (): void { |
|
124 | + private function _onSave(): void { |
|
125 | 125 | /** @var FieldEntries $fields */ |
126 | 126 | if ($fields = $this->data['custom_fields'] ?? null) { |
127 | 127 | $fields->__unset(true); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - protected function _setData (array $data): void { |
|
135 | + protected function _setData(array $data): void { |
|
136 | 136 | // hearts were deprecated for likes. |
137 | 137 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
138 | 138 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param string $file |
152 | 152 | * @return Attachment |
153 | 153 | */ |
154 | - public function addAttachment (string $file) { |
|
154 | + public function addAttachment(string $file) { |
|
155 | 155 | /** @var Attachment $attachment */ |
156 | 156 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
157 | 157 | return $attachment->create($file); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param Task[] $tasks |
164 | 164 | * @return $this |
165 | 165 | */ |
166 | - public function addDependencies (array $tasks) { |
|
166 | + public function addDependencies(array $tasks) { |
|
167 | 167 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
168 | 168 | return $this; |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param Task $task |
175 | 175 | * @return $this |
176 | 176 | */ |
177 | - public function addDependency (Task $task) { |
|
177 | + public function addDependency(Task $task) { |
|
178 | 178 | return $this->addDependencies([$task]); |
179 | 179 | } |
180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @param Task $task |
185 | 185 | * @return $this |
186 | 186 | */ |
187 | - public function addDependent (Task $task) { |
|
187 | + public function addDependent(Task $task) { |
|
188 | 188 | return $this->addDependents([$task]); |
189 | 189 | } |
190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param Task[] $tasks |
195 | 195 | * @return $this |
196 | 196 | */ |
197 | - public function addDependents (array $tasks) { |
|
197 | + public function addDependents(array $tasks) { |
|
198 | 198 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
199 | 199 | return $this; |
200 | 200 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param User $user |
206 | 206 | * @return $this |
207 | 207 | */ |
208 | - public function addFollower (User $user) { |
|
208 | + public function addFollower(User $user) { |
|
209 | 209 | return $this->addFollowers([$user]); |
210 | 210 | } |
211 | 211 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param User[] $users |
218 | 218 | * @return $this |
219 | 219 | */ |
220 | - public function addFollowers (array $users) { |
|
220 | + public function addFollowers(array $users) { |
|
221 | 221 | return $this->_addWithPost("{$this}/addFollowers", [ |
222 | 222 | 'followers' => array_column($users, 'gid') |
223 | 223 | ], 'followers', $users); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param Tag $tag |
232 | 232 | * @return $this |
233 | 233 | */ |
234 | - public function addTag (Tag $tag) { |
|
234 | + public function addTag(Tag $tag) { |
|
235 | 235 | assert($tag->hasGid()); |
236 | 236 | return $this->_addWithPost("{$this}/addTag", [ |
237 | 237 | 'tag' => $tag->getGid() |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param Project|Section $target |
250 | 250 | * @return $this |
251 | 251 | */ |
252 | - public function addToProject ($target) { |
|
252 | + public function addToProject($target) { |
|
253 | 253 | assert($target->hasGid()); |
254 | 254 | if ($target instanceof Project) { |
255 | 255 | $target = $target->getDefaultSection(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * @return $this |
265 | 265 | */ |
266 | - public function create () { |
|
266 | + public function create() { |
|
267 | 267 | $this->_create(); |
268 | 268 | $this->_onSave(); |
269 | 269 | return $this; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @param string[] $include |
279 | 279 | * @return Job |
280 | 280 | */ |
281 | - public function duplicate (string $name, array $include) { |
|
281 | + public function duplicate(string $name, array $include) { |
|
282 | 282 | /** @var array $remote */ |
283 | 283 | $remote = $this->api->post("{$this}/duplicate", [ |
284 | 284 | 'name' => $name, |
@@ -292,14 +292,14 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @return Attachment[] |
294 | 294 | */ |
295 | - public function getAttachments () { |
|
295 | + public function getAttachments() { |
|
296 | 296 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
300 | 300 | * @return Story[] |
301 | 301 | */ |
302 | - public function getComments () { |
|
302 | + public function getComments() { |
|
303 | 303 | return $this->selectStories(function(Story $story) { |
304 | 304 | return $story->isComment(); |
305 | 305 | }); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * |
311 | 311 | * @return Task[] |
312 | 312 | */ |
313 | - public function getDependencies () { |
|
313 | + public function getDependencies() { |
|
314 | 314 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
315 | 315 | } |
316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * |
320 | 320 | * @return Task[] |
321 | 321 | */ |
322 | - public function getDependents () { |
|
322 | + public function getDependents() { |
|
323 | 323 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
324 | 324 | } |
325 | 325 | |
@@ -334,49 +334,49 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @return ExternalData |
336 | 336 | */ |
337 | - public function getExternal () { |
|
337 | + public function getExternal() { |
|
338 | 338 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, ExternalData::class); |
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | 342 | * @return Project[] |
343 | 343 | */ |
344 | - public function getProjects () { |
|
344 | + public function getProjects() { |
|
345 | 345 | return array_column($this->getMemberships(), 'project'); |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * @return Section[] |
350 | 350 | */ |
351 | - public function getSections () { |
|
351 | + public function getSections() { |
|
352 | 352 | return array_column($this->getMemberships(), 'section'); |
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
356 | 356 | * @return Story[] |
357 | 357 | */ |
358 | - public function getStories () { |
|
358 | + public function getStories() { |
|
359 | 359 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
363 | 363 | * @return Task[] |
364 | 364 | */ |
365 | - public function getSubTasks () { |
|
365 | + public function getSubTasks() { |
|
366 | 366 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | 370 | * @return string |
371 | 371 | */ |
372 | - final public function getUrl (): string { |
|
372 | + final public function getUrl(): string { |
|
373 | 373 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
377 | 377 | * @return TaskWebhook[] |
378 | 378 | */ |
379 | - public function getWebhooks () { |
|
379 | + public function getWebhooks() { |
|
380 | 380 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
381 | 381 | 'workspace' => $this->getWorkspace()->getGid(), |
382 | 382 | 'resource' => $this->getGid() |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @return Story |
390 | 390 | */ |
391 | - public function newComment () { |
|
391 | + public function newComment() { |
|
392 | 392 | return $this->api->factory($this, Story::class, [ |
393 | 393 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
394 | 394 | 'target' => $this |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return Task |
402 | 402 | */ |
403 | - public function newSubTask () { |
|
403 | + public function newSubTask() { |
|
404 | 404 | /** @var Task $sub */ |
405 | 405 | $sub = $this->api->factory($this, self::class); |
406 | 406 | return $sub->setParent($this); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @return TaskWebhook |
413 | 413 | */ |
414 | - public function newWebhook () { |
|
414 | + public function newWebhook() { |
|
415 | 415 | /** @var TaskWebhook $webhook */ |
416 | 416 | $webhook = $this->api->factory($this, TaskWebhook::class); |
417 | 417 | return $webhook->setResource($this); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * @param Task[] $tasks |
424 | 424 | * @return $this |
425 | 425 | */ |
426 | - public function removeDependencies (array $tasks) { |
|
426 | + public function removeDependencies(array $tasks) { |
|
427 | 427 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
428 | 428 | return $this; |
429 | 429 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @param Task $task |
435 | 435 | * @return $this |
436 | 436 | */ |
437 | - public function removeDependency (Task $task) { |
|
437 | + public function removeDependency(Task $task) { |
|
438 | 438 | return $this->removeDependencies([$task]); |
439 | 439 | } |
440 | 440 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @param Task $task |
445 | 445 | * @return $this |
446 | 446 | */ |
447 | - public function removeDependent (Task $task) { |
|
447 | + public function removeDependent(Task $task) { |
|
448 | 448 | return $this->removeDependents([$task]); |
449 | 449 | } |
450 | 450 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * @param Task[] $tasks |
455 | 455 | * @return $this |
456 | 456 | */ |
457 | - public function removeDependents (array $tasks) { |
|
457 | + public function removeDependents(array $tasks) { |
|
458 | 458 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
459 | 459 | return $this; |
460 | 460 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @param User $user |
466 | 466 | * @return $this |
467 | 467 | */ |
468 | - public function removeFollower (User $user) { |
|
468 | + public function removeFollower(User $user) { |
|
469 | 469 | return $this->removeFollowers([$user]); |
470 | 470 | } |
471 | 471 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param User[] $users |
478 | 478 | * @return $this |
479 | 479 | */ |
480 | - public function removeFollowers (array $users) { |
|
480 | + public function removeFollowers(array $users) { |
|
481 | 481 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
482 | 482 | 'followers' => array_column($users, 'gid') |
483 | 483 | ], 'followers', $users); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param Project $project |
492 | 492 | * @return $this |
493 | 493 | */ |
494 | - public function removeFromProject (Project $project) { |
|
494 | + public function removeFromProject(Project $project) { |
|
495 | 495 | return $this->_removeWithPost("{$this}/removeProject", [ |
496 | 496 | 'project' => $project->getGid() |
497 | 497 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @param Tag $tag |
508 | 508 | * @return $this |
509 | 509 | */ |
510 | - public function removeTag (Tag $tag) { |
|
510 | + public function removeTag(Tag $tag) { |
|
511 | 511 | return $this->_removeWithPost("{$this}/removeTag", [ |
512 | 512 | 'tag' => $tag->getGid() |
513 | 513 | ], 'tags', [$tag]); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * @param null|Task $parent |
521 | 521 | * @return $this |
522 | 522 | */ |
523 | - final public function setParent (?Task $parent) { |
|
523 | + final public function setParent(?Task $parent) { |
|
524 | 524 | assert(!$parent or $parent->hasGid()); |
525 | 525 | return $this->_setWithPost("{$this}/setParent", [ |
526 | 526 | 'parent' => $parent |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | /** |
531 | 531 | * @return $this |
532 | 532 | */ |
533 | - public function update () { |
|
533 | + public function update() { |
|
534 | 534 | $this->_update(); |
535 | 535 | $this->_onSave(); |
536 | 536 | return $this; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return OrganizationExport |
42 | 42 | */ |
43 | - public function export () { |
|
43 | + public function export() { |
|
44 | 44 | /** @var OrganizationExport $export */ |
45 | 45 | $export = $this->api->factory($this, OrganizationExport::class); |
46 | 46 | return $export->create($this); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param int $limit 1-100 |
65 | 65 | * @return array|AbstractEntity[] |
66 | 66 | */ |
67 | - protected function find (string $class, string $text = '*', int $limit = 20) { |
|
67 | + protected function find(string $class, string $text = '*', int $limit = 20) { |
|
68 | 68 | return $this->api->loadAll($this, $class, "{$this}/typeahead", [ |
69 | 69 | 'resource_type' => $class::TYPE, |
70 | 70 | 'query' => $text, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param int $limit 1-100 |
80 | 80 | * @return CustomField[] |
81 | 81 | */ |
82 | - public function findCustomFields (string $text = '*', int $limit = 20) { |
|
82 | + public function findCustomFields(string $text = '*', int $limit = 20) { |
|
83 | 83 | return $this->find(CustomField::class, $text, $limit); |
84 | 84 | } |
85 | 85 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param int $limit 1-100 |
91 | 91 | * @return Portfolio[] |
92 | 92 | */ |
93 | - public function findPortfolios (string $text = '*', int $limit = 20) { |
|
93 | + public function findPortfolios(string $text = '*', int $limit = 20) { |
|
94 | 94 | return $this->find(Portfolio::class, $text, $limit); |
95 | 95 | } |
96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param int $limit 1-100 |
102 | 102 | * @return Project[] |
103 | 103 | */ |
104 | - public function findProjects (string $text = '*', int $limit = 20) { |
|
104 | + public function findProjects(string $text = '*', int $limit = 20) { |
|
105 | 105 | return $this->find(Project::class, $text, $limit); |
106 | 106 | } |
107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param int $limit 1-100 |
116 | 116 | * @return Tag[] |
117 | 117 | */ |
118 | - public function findTags (string $text = '*', int $limit = 20) { |
|
118 | + public function findTags(string $text = '*', int $limit = 20) { |
|
119 | 119 | return $this->find(Tag::class, $text, $limit); |
120 | 120 | } |
121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param int $limit 1-100 |
127 | 127 | * @return Task[] |
128 | 128 | */ |
129 | - public function findTasks (string $text = '*', int $limit = 20) { |
|
129 | + public function findTasks(string $text = '*', int $limit = 20) { |
|
130 | 130 | return $this->find(Task::class, $text, $limit); |
131 | 131 | } |
132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return CustomField[] |
139 | 139 | */ |
140 | - public function getCustomFields () { |
|
140 | + public function getCustomFields() { |
|
141 | 141 | return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields"); |
142 | 142 | } |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return Portfolio[] |
150 | 150 | */ |
151 | - public function getPortfolios () { |
|
151 | + public function getPortfolios() { |
|
152 | 152 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
153 | 153 | 'workspace' => $this->getGid(), |
154 | 154 | 'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required. |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param array $filter |
164 | 164 | * @return Project[] |
165 | 165 | */ |
166 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
166 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
167 | 167 | $filter['workspace'] = $this->getGid(); |
168 | 168 | return $this->api->loadAll($this, Project::class, 'projects', $filter); |
169 | 169 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return Tag[] |
180 | 180 | */ |
181 | - public function getTags () { |
|
181 | + public function getTags() { |
|
182 | 182 | return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]); |
183 | 183 | } |
184 | 184 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return Team[] |
191 | 191 | */ |
192 | - public function getTeams () { |
|
192 | + public function getTeams() { |
|
193 | 193 | return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams"); |
194 | 194 | } |
195 | 195 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @param string $email |
200 | 200 | * @return null|User |
201 | 201 | */ |
202 | - public function getUserByEmail (string $email) { |
|
202 | + public function getUserByEmail(string $email) { |
|
203 | 203 | return $this->api->getPool()->get("users/{$email}", $this, function() use ($email) { |
204 | 204 | return $this->selectUsers(function(User $user) use ($email) { |
205 | 205 | return $user->getEmail() === $email; |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * @return User[] |
212 | 212 | */ |
213 | - public function getUsers () { |
|
213 | + public function getUsers() { |
|
214 | 214 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | 218 | * @return ProjectWebhook[]|TaskWebhook[] |
219 | 219 | */ |
220 | - public function getWebhooks () { |
|
220 | + public function getWebhooks() { |
|
221 | 221 | return array_map(function(array $each) { |
222 | 222 | return $this->api->getPool()->get($each['gid'], $this, function() use ($each) { |
223 | 223 | return $this->api->factory($this, [ |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | /** |
235 | 235 | * @return bool |
236 | 236 | */ |
237 | - final public function isOrganization (): bool { |
|
237 | + final public function isOrganization(): bool { |
|
238 | 238 | return $this->_is('is_organization'); |
239 | 239 | } |
240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return CustomField |
245 | 245 | */ |
246 | - public function newCustomField () { |
|
246 | + public function newCustomField() { |
|
247 | 247 | /** @var CustomField $field */ |
248 | 248 | $field = $this->api->factory($this, CustomField::class); |
249 | 249 | return $field->setWorkspace($this); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return Portfolio |
256 | 256 | */ |
257 | - public function newPortfolio () { |
|
257 | + public function newPortfolio() { |
|
258 | 258 | /** @var Portfolio $portfolio */ |
259 | 259 | $portfolio = $this->api->factory($this, Portfolio::class); |
260 | 260 | return $portfolio->setWorkspace($this); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return Project |
267 | 267 | */ |
268 | - public function newProject () { |
|
268 | + public function newProject() { |
|
269 | 269 | /** @var Project $project */ |
270 | 270 | $project = $this->api->factory($this, Project::class); |
271 | 271 | return $project->setWorkspace($this); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return Tag |
278 | 278 | */ |
279 | - public function newTag () { |
|
279 | + public function newTag() { |
|
280 | 280 | /** @var Tag $tag */ |
281 | 281 | $tag = $this->api->factory($this, Tag::class); |
282 | 282 | return $tag->setWorkspace($this); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return Task |
289 | 289 | */ |
290 | - public function newTask () { |
|
290 | + public function newTask() { |
|
291 | 291 | /** @var Task $task */ |
292 | 292 | $task = $this->api->factory($this, Task::class); |
293 | 293 | return $task->setWorkspace($this); |