@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | private $defaultSection; |
| 79 | 79 | |
| 80 | - final public function __toString (): string { |
|
| 80 | + final public function __toString(): string { |
|
| 81 | 81 | return "projects/{$this->getGid()}"; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - final protected function _getDir (): string { |
|
| 84 | + final protected function _getDir(): string { |
|
| 85 | 85 | return 'projects'; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - protected function _setData (array $data): void { |
|
| 88 | + protected function _setData(array $data): void { |
|
| 89 | 89 | // this is always empty. fields are in the settings, values are in tasks. |
| 90 | 90 | unset($data['custom_fields']); |
| 91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param User $user |
| 101 | 101 | * @return $this |
| 102 | 102 | */ |
| 103 | - public function addMember (User $user) { |
|
| 103 | + public function addMember(User $user) { |
|
| 104 | 104 | return $this->addMembers([$user]); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param User[] $users |
| 110 | 110 | * @return $this |
| 111 | 111 | */ |
| 112 | - public function addMembers (array $users) { |
|
| 112 | + public function addMembers(array $users) { |
|
| 113 | 113 | return $this->_addWithPost("{$this}/addMembers", [ |
| 114 | 114 | 'members' => array_column($users, 'gid') |
| 115 | 115 | ], 'members', $users); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param string $target |
| 121 | 121 | * @return ProjectWebhook |
| 122 | 122 | */ |
| 123 | - public function addWebhook (string $target) { |
|
| 123 | + public function addWebhook(string $target) { |
|
| 124 | 124 | /** @var ProjectWebhook $webhook */ |
| 125 | 125 | $webhook = $this->_factory(ProjectWebhook::class); |
| 126 | 126 | return $webhook->create($this, $target); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param array $schedule |
| 146 | 146 | * @return Job |
| 147 | 147 | */ |
| 148 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 148 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 149 | 149 | $data = ['name' => $name]; |
| 150 | 150 | if ($team) { |
| 151 | 151 | $data['team'] = $team->getGid(); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @depends after-create |
| 165 | 165 | * @return Section |
| 166 | 166 | */ |
| 167 | - public function getDefaultSection () { |
|
| 167 | + public function getDefaultSection() { |
|
| 168 | 168 | return $this->defaultSection ?? |
| 169 | 169 | $this->defaultSection = $this->api->loadAll($this, Section::class, "{$this}/sections", ['limit' => 1])[0]; |
| 170 | 170 | } |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | * @param null|string $token |
| 177 | 177 | * @return Event[] |
| 178 | 178 | */ |
| 179 | - public function getEvents (&$token) { |
|
| 179 | + public function getEvents(&$token) { |
|
| 180 | 180 | return $this->api->sync($this, $token); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @return Traversable|Section[] |
| 185 | 185 | */ |
| 186 | - public function getIterator () { |
|
| 186 | + public function getIterator() { |
|
| 187 | 187 | return $this->api->loadEach($this, Section::class, "{$this}/sections"); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @depends after-create |
| 192 | 192 | * @return Section[] |
| 193 | 193 | */ |
| 194 | - public function getSections () { |
|
| 194 | + public function getSections() { |
|
| 195 | 195 | return iterator_to_array($this); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @depends after-create |
| 200 | 200 | * @return Status[] |
| 201 | 201 | */ |
| 202 | - public function getStatuses () { |
|
| 202 | + public function getStatuses() { |
|
| 203 | 203 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param array $filter |
| 211 | 211 | * @return Task[] |
| 212 | 212 | */ |
| 213 | - public function getTasks (array $filter = []) { |
|
| 213 | + public function getTasks(array $filter = []) { |
|
| 214 | 214 | $filter['project'] = $this->getGid(); |
| 215 | 215 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
| 216 | 216 | } |
@@ -219,25 +219,25 @@ discard block |
||
| 219 | 219 | * @depends after-create |
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | - public function getUrl (): string { |
|
| 222 | + public function getUrl(): string { |
|
| 223 | 223 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | 227 | * @return ProjectWebhook[] |
| 228 | 228 | */ |
| 229 | - public function getWebhooks () { |
|
| 229 | + public function getWebhooks() { |
|
| 230 | 230 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
| 231 | 231 | 'workspace' => $this->getWorkspace()->getGid(), |
| 232 | 232 | 'resource' => $this->getGid() |
| 233 | 233 | ]); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - public function isBoard (): bool { |
|
| 236 | + public function isBoard(): bool { |
|
| 237 | 237 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - public function isList (): bool { |
|
| 240 | + public function isList(): bool { |
|
| 241 | 241 | return $this->getLayout() === self::LAYOUT_LIST; |
| 242 | 242 | } |
| 243 | 243 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @depends after-create |
| 246 | 246 | * @return Section |
| 247 | 247 | */ |
| 248 | - public function newSection () { |
|
| 248 | + public function newSection() { |
|
| 249 | 249 | return $this->_factory(Section::class, ['project' => $this]); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @depends after-create |
| 254 | 254 | * @return Status |
| 255 | 255 | */ |
| 256 | - public function newStatus () { |
|
| 256 | + public function newStatus() { |
|
| 257 | 257 | return $this->_factory(Status::class); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * @depends after-create |
| 264 | 264 | * @return Task |
| 265 | 265 | */ |
| 266 | - public function newTask () { |
|
| 266 | + public function newTask() { |
|
| 267 | 267 | return $this->getDefaultSection()->newTask(); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param User $user |
| 273 | 273 | * @return $this |
| 274 | 274 | */ |
| 275 | - public function removeMember (User $user) { |
|
| 275 | + public function removeMember(User $user) { |
|
| 276 | 276 | return $this->removeMembers([$user]); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @param User[] $users |
| 282 | 282 | * @return $this |
| 283 | 283 | */ |
| 284 | - public function removeMembers (array $users) { |
|
| 284 | + public function removeMembers(array $users) { |
|
| 285 | 285 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 286 | 286 | 'members' => array_column($users, 'gid') |
| 287 | 287 | ], 'members', $users); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param callable $filter `fn( Section $section ): bool` |
| 292 | 292 | * @return Section[] |
| 293 | 293 | */ |
| 294 | - public function selectSections (callable $filter) { |
|
| 294 | + public function selectSections(callable $filter) { |
|
| 295 | 295 | return $this->_select($this->getSections(), $filter); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param callable $filter `fn( Status $status ): bool` |
| 300 | 300 | * @return Status[] |
| 301 | 301 | */ |
| 302 | - public function selectStatuses (callable $filter) { |
|
| 302 | + public function selectStatuses(callable $filter) { |
|
| 303 | 303 | return $this->_select($this->getStatuses(), $filter); |
| 304 | 304 | } |
| 305 | 305 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
| 309 | 309 | * @return Task[] |
| 310 | 310 | */ |
| 311 | - public function selectTasks (callable $filter, array $apiFilter = []) { |
|
| 311 | + public function selectTasks(callable $filter, array $apiFilter = []) { |
|
| 312 | 312 | return $this->_select($this->getTasks($apiFilter), $filter); |
| 313 | 313 | } |
| 314 | 314 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | * @param null|Team $team |
| 318 | 318 | * @return $this |
| 319 | 319 | */ |
| 320 | - public function setTeam (?Team $team) { |
|
| 320 | + public function setTeam(?Team $team) { |
|
| 321 | 321 | if ($team and !$this->hasWorkspace()) { |
| 322 | 322 | $this->setWorkspace($team->getOrganization()); |
| 323 | 323 | } |