@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @return CustomField[] |
| 17 | 17 | */ |
| 18 | - public function getCustomFields () { |
|
| 18 | + public function getCustomFields() { |
|
| 19 | 19 | return array_map(function(FieldSetting $setting) { |
| 20 | 20 | return $setting->getCustomField(); |
| 21 | 21 | }, $this->getCustomFieldSettings()); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param callable $filter `fn( CustomField $field ): bool` |
| 26 | 26 | * @return CustomField[] |
| 27 | 27 | */ |
| 28 | - public function selectCustomFields (callable $filter) { |
|
| 28 | + public function selectCustomFields(callable $filter) { |
|
| 29 | 29 | return $this->{'_select'}($this->getCustomFields(), $filter); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | 'organization' => Workspace::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "organization_exports/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - final protected function _getDir (): string { |
|
| 40 | + final protected function _getDir(): string { |
|
| 41 | 41 | return "organization_exports"; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param Workspace $organization |
| 46 | 46 | * @return $this |
| 47 | 47 | */ |
| 48 | - public function create (Workspace $organization) { |
|
| 48 | + public function create(Workspace $organization) { |
|
| 49 | 49 | $this->_set('organization', $organization); |
| 50 | 50 | return $this->_create(); |
| 51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return bool |
| 57 | 57 | */ |
| 58 | - final public function isActive (): bool { |
|
| 58 | + final public function isActive(): bool { |
|
| 59 | 59 | return $this->getState() === self::STATE_ACTIVE; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return bool |
| 66 | 66 | */ |
| 67 | - final public function isDone (): bool { |
|
| 67 | + final public function isDone(): bool { |
|
| 68 | 68 | return $this->isSuccessful() or $this->isFailed(); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return bool |
| 75 | 75 | */ |
| 76 | - final public function isFailed (): bool { |
|
| 76 | + final public function isFailed(): bool { |
|
| 77 | 77 | return $this->getState() === self::STATE_FAIL; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | - final public function isQueued (): bool { |
|
| 85 | + final public function isQueued(): bool { |
|
| 86 | 86 | return $this->getState() === self::STATE_QUEUED; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return bool |
| 93 | 93 | */ |
| 94 | - final public function isSuccessful (): bool { |
|
| 94 | + final public function isSuccessful(): bool { |
|
| 95 | 95 | return $this->getState() === self::STATE_SUCCESS; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param callable $spinner `fn( OrganizationExport $this ): void` |
| 104 | 104 | * @return $this |
| 105 | 105 | */ |
| 106 | - public function wait (callable $spinner = null) { |
|
| 106 | + public function wait(callable $spinner = null) { |
|
| 107 | 107 | while (!$this->isDone()) { |
| 108 | 108 | if ($spinner) { |
| 109 | 109 | call_user_func($spinner, $this); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'new_task' => Task::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "jobs/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - public function isActive (): bool { |
|
| 45 | + public function isActive(): bool { |
|
| 46 | 46 | return $this->getStatus() === self::STATUS_ACTIVE; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function isDone (): bool { |
|
| 54 | + public function isDone(): bool { |
|
| 55 | 55 | return $this->isSuccessful() or $this->isFailed(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function isDuplicatingProject (): bool { |
|
| 58 | + final public function isDuplicatingProject(): bool { |
|
| 59 | 59 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_PROJECT; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final public function isDuplicatingTask (): bool { |
|
| 62 | + final public function isDuplicatingTask(): bool { |
|
| 63 | 63 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_TASK; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool |
| 70 | 70 | */ |
| 71 | - public function isFailed (): bool { |
|
| 71 | + public function isFailed(): bool { |
|
| 72 | 72 | return $this->getStatus() === self::STATUS_FAIL; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return bool |
| 79 | 79 | */ |
| 80 | - public function isQueued (): bool { |
|
| 80 | + public function isQueued(): bool { |
|
| 81 | 81 | return $this->getStatus() === self::STATUS_QUEUED; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isSuccessful (): bool { |
|
| 89 | + public function isSuccessful(): bool { |
|
| 90 | 90 | return $this->getStatus() === self::STATUS_SUCCESS; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param callable $spinner `fn( Job $this ): void` |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function wait (callable $spinner = null) { |
|
| 101 | + public function wait(callable $spinner = null) { |
|
| 102 | 102 | while (!$this->isDone()) { |
| 103 | 103 | if ($spinner) { |
| 104 | 104 | call_user_func($spinner, $this); |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * @param Project $project |
| 51 | 51 | * @param array $data |
| 52 | 52 | */ |
| 53 | - public function __construct (Project $project, array $data = []) { |
|
| 53 | + public function __construct(Project $project, array $data = []) { |
|
| 54 | 54 | parent::__construct($project, $data); |
| 55 | 55 | $this->project = $project; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function __toString (): string { |
|
| 58 | + final public function __toString(): string { |
|
| 59 | 59 | return "project_statuses/{$this->getGid()}"; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final protected function _getDir (): string { |
|
| 62 | + final protected function _getDir(): string { |
|
| 63 | 63 | return "{$this->project}/project_statuses"; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function _setData (array $data): void { |
|
| 66 | + protected function _setData(array $data): void { |
|
| 67 | 67 | // redundant, prefer created_by |
| 68 | 68 | unset($data['author']); |
| 69 | 69 | parent::_setData($data); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return Project |
| 74 | 74 | */ |
| 75 | - public function getProject () { |
|
| 75 | + public function getProject() { |
|
| 76 | 76 | return $this->project; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | 'workspace' => Workspace::class |
| 71 | 71 | ]; |
| 72 | 72 | |
| 73 | - final public function __toString (): string { |
|
| 73 | + final public function __toString(): string { |
|
| 74 | 74 | return "projects/{$this->getGid()}"; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - final protected function _getDir (): string { |
|
| 77 | + final protected function _getDir(): string { |
|
| 78 | 78 | return 'projects'; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - protected function _setData (array $data): void { |
|
| 81 | + protected function _setData(array $data): void { |
|
| 82 | 82 | // this is always empty. fields are in the settings, values are in tasks. |
| 83 | 83 | unset($data['custom_fields']); |
| 84 | 84 | parent::_setData($data); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param User $user |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function addMember (User $user) { |
|
| 92 | + public function addMember(User $user) { |
|
| 93 | 93 | return $this->addMembers([$user]); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param User[] $users |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function addMembers (array $users) { |
|
| 101 | + public function addMembers(array $users) { |
|
| 102 | 102 | return $this->_addWithPost("{$this}/addMembers", [ |
| 103 | 103 | 'members' => array_column($users, 'gid') |
| 104 | 104 | ], 'members', $users); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $target |
| 110 | 110 | * @return ProjectWebhook |
| 111 | 111 | */ |
| 112 | - public function addWebhook (string $target) { |
|
| 112 | + public function addWebhook(string $target) { |
|
| 113 | 113 | /** @var ProjectWebhook $webhook */ |
| 114 | 114 | $webhook = $this->factory(ProjectWebhook::class); |
| 115 | 115 | return $webhook->create($this, $target); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param array $schedule |
| 135 | 135 | * @return Job |
| 136 | 136 | */ |
| 137 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 137 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 138 | 138 | $data = ['name' => $name]; |
| 139 | 139 | if ($team) { |
| 140 | 140 | $data['team'] = $team->getGid(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @depends after-create |
| 154 | 154 | * @return Section |
| 155 | 155 | */ |
| 156 | - public function getDefaultSection () { |
|
| 156 | + public function getDefaultSection() { |
|
| 157 | 157 | return $this->loadAll(Section::class, "{$this}/sections", ['limit' => 1])[0]; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param null|string $token |
| 165 | 165 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 166 | 166 | */ |
| 167 | - public function getEvents (&$token) { |
|
| 167 | + public function getEvents(&$token) { |
|
| 168 | 168 | return $this->api->sync($this, $token); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @depends after-create |
| 173 | 173 | * @return Section[] |
| 174 | 174 | */ |
| 175 | - public function getSections () { |
|
| 175 | + public function getSections() { |
|
| 176 | 176 | return $this->loadAll(Section::class, "{$this}/sections"); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @depends after-create |
| 181 | 181 | * @return Status[] |
| 182 | 182 | */ |
| 183 | - public function getStatuses () { |
|
| 183 | + public function getStatuses() { |
|
| 184 | 184 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param array $filter |
| 194 | 194 | * @return Task[] |
| 195 | 195 | */ |
| 196 | - public function getTasks (array $filter = []) { |
|
| 196 | + public function getTasks(array $filter = []) { |
|
| 197 | 197 | $filter['project'] = $this->getGid(); |
| 198 | 198 | return $this->loadAll(Task::class, "tasks", $filter); |
| 199 | 199 | } |
@@ -202,25 +202,25 @@ discard block |
||
| 202 | 202 | * @depends after-create |
| 203 | 203 | * @return string |
| 204 | 204 | */ |
| 205 | - public function getUrl (): string { |
|
| 205 | + public function getUrl(): string { |
|
| 206 | 206 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * @return ProjectWebhook[] |
| 211 | 211 | */ |
| 212 | - public function getWebhooks () { |
|
| 212 | + public function getWebhooks() { |
|
| 213 | 213 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
| 214 | 214 | 'workspace' => $this->getWorkspace()->getGid(), |
| 215 | 215 | 'resource' => $this->getGid() |
| 216 | 216 | ]); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - public function isBoard (): bool { |
|
| 219 | + public function isBoard(): bool { |
|
| 220 | 220 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - public function isList (): bool { |
|
| 223 | + public function isList(): bool { |
|
| 224 | 224 | return $this->getLayout() === self::LAYOUT_LIST; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @depends after-create |
| 229 | 229 | * @return Section |
| 230 | 230 | */ |
| 231 | - public function newSection () { |
|
| 231 | + public function newSection() { |
|
| 232 | 232 | return $this->factory(Section::class, ['project' => $this]); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @depends after-create |
| 237 | 237 | * @return Status |
| 238 | 238 | */ |
| 239 | - public function newStatus () { |
|
| 239 | + public function newStatus() { |
|
| 240 | 240 | return $this->factory(Status::class); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @depends after-create |
| 247 | 247 | * @return Task |
| 248 | 248 | */ |
| 249 | - public function newTask () { |
|
| 249 | + public function newTask() { |
|
| 250 | 250 | return $this->getDefaultSection()->newTask(); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @param User $user |
| 256 | 256 | * @return $this |
| 257 | 257 | */ |
| 258 | - public function removeMember (User $user) { |
|
| 258 | + public function removeMember(User $user) { |
|
| 259 | 259 | return $this->removeMembers([$user]); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param User[] $users |
| 265 | 265 | * @return $this |
| 266 | 266 | */ |
| 267 | - public function removeMembers (array $users) { |
|
| 267 | + public function removeMembers(array $users) { |
|
| 268 | 268 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 269 | 269 | 'members' => array_column($users, 'gid') |
| 270 | 270 | ], 'members', $users); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param callable $filter `fn( Section $section ): bool` |
| 275 | 275 | * @return Section[] |
| 276 | 276 | */ |
| 277 | - public function selectSections (callable $filter) { |
|
| 277 | + public function selectSections(callable $filter) { |
|
| 278 | 278 | return $this->_select($this->getSections(), $filter); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param callable $filter `fn( Status $status ): bool` |
| 283 | 283 | * @return Status[] |
| 284 | 284 | */ |
| 285 | - public function selectStatuses (callable $filter) { |
|
| 285 | + public function selectStatuses(callable $filter) { |
|
| 286 | 286 | return $this->_select($this->getStatuses(), $filter); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
| 292 | 292 | * @return Task[] |
| 293 | 293 | */ |
| 294 | - public function selectTasks (callable $filter, array $apiFilter = []) { |
|
| 294 | + public function selectTasks(callable $filter, array $apiFilter = []) { |
|
| 295 | 295 | return $this->_select($this->getTasks($apiFilter), $filter); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param null|Team $team |
| 301 | 301 | * @return $this |
| 302 | 302 | */ |
| 303 | - public function setTeam (?Team $team) { |
|
| 303 | + public function setTeam(?Team $team) { |
|
| 304 | 304 | if ($team and !$this->hasWorkspace()) { |
| 305 | 305 | $this->setWorkspace($team->getOrganization()); |
| 306 | 306 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | 'enum_options' => [EnumOption::class], |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | - final public function __toString (): string { |
|
| 43 | + final public function __toString(): string { |
|
| 44 | 44 | return "custom_fields/{$this->getGid()}"; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - final protected function _getDir (): string { |
|
| 47 | + final protected function _getDir(): string { |
|
| 48 | 48 | return 'custom_fields'; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $name |
| 57 | 57 | * @return EnumOption |
| 58 | 58 | */ |
| 59 | - public function addEnumOption (string $name) { |
|
| 59 | + public function addEnumOption(string $name) { |
|
| 60 | 60 | /** @var EnumOption $option */ |
| 61 | 61 | $option = $this->factory(EnumOption::class); |
| 62 | 62 | $option->setName($name); |
@@ -72,35 +72,35 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return bool |
| 74 | 74 | */ |
| 75 | - public function hasNotificationsEnabled (): bool { |
|
| 75 | + public function hasNotificationsEnabled(): bool { |
|
| 76 | 76 | return $this->_is('has_notifications_enabled'); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - final public function isEnum (): bool { |
|
| 82 | + final public function isEnum(): bool { |
|
| 83 | 83 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isGlobalToWorkspace (): bool { |
|
| 89 | + public function isGlobalToWorkspace(): bool { |
|
| 90 | 90 | return $this->_is('is_global_to_workspace'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @return bool |
| 95 | 95 | */ |
| 96 | - final public function isNumber (): bool { |
|
| 96 | + final public function isNumber(): bool { |
|
| 97 | 97 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - final public function isText (): bool { |
|
| 103 | + final public function isText(): bool { |
|
| 104 | 104 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param bool $flag |
| 109 | 109 | * @return $this |
| 110 | 110 | */ |
| 111 | - public function setGlobalToWorkspace (bool $flag) { |
|
| 111 | + public function setGlobalToWorkspace(bool $flag) { |
|
| 112 | 112 | return $this->_set('is_global_to_workspace', $flag); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param bool $flag |
| 117 | 117 | * @return $this |
| 118 | 118 | */ |
| 119 | - public function setNotificationsEnabled (bool $flag) { |
|
| 119 | + public function setNotificationsEnabled(bool $flag) { |
|
| 120 | 120 | return $this->_set('has_notifications_enabled', $flag); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
| 125 | 125 | * @return $this |
| 126 | 126 | */ |
| 127 | - public function sortEnumOptions (callable $cmp) { |
|
| 127 | + public function sortEnumOptions(callable $cmp) { |
|
| 128 | 128 | if ($options = $this->getEnumOptions()) { |
| 129 | 129 | $prev = $options[0]; // first option on remote |
| 130 | 130 | usort($options, $cmp); |