@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - final public function __toString (): string { |
|
| 41 | + final public function __toString(): string { |
|
| 42 | 42 | return "workspaces/{$this->getGid()}"; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return OrganizationExport |
| 51 | 51 | */ |
| 52 | - public function export () { |
|
| 52 | + public function export() { |
|
| 53 | 53 | /** @var OrganizationExport $export */ |
| 54 | 54 | $export = $this->api->factory($this, OrganizationExport::class); |
| 55 | 55 | return $export->create($this); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param int $limit 1-100 |
| 70 | 70 | * @return array|AbstractEntity[] |
| 71 | 71 | */ |
| 72 | - protected function find (string $class, string $text, int $limit = 20) { |
|
| 72 | + protected function find(string $class, string $text, int $limit = 20) { |
|
| 73 | 73 | return $this->api->loadAll($this, $class, "{$this}/typeahead", [ |
| 74 | 74 | 'resource_type' => $class::TYPE, |
| 75 | 75 | 'query' => $text, |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param int $limit 1-100 |
| 85 | 85 | * @return CustomField[] |
| 86 | 86 | */ |
| 87 | - public function findCustomFields (string $text, int $limit = 20) { |
|
| 87 | + public function findCustomFields(string $text, int $limit = 20) { |
|
| 88 | 88 | return $this->find(CustomField::class, $text, $limit); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param int $limit 1-100 |
| 96 | 96 | * @return Portfolio[] |
| 97 | 97 | */ |
| 98 | - public function findPortfolios (string $text, int $limit = 20) { |
|
| 98 | + public function findPortfolios(string $text, int $limit = 20) { |
|
| 99 | 99 | return $this->find(Portfolio::class, $text, $limit); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param int $limit 1-100 |
| 107 | 107 | * @return Project[] |
| 108 | 108 | */ |
| 109 | - public function findProjects (string $text, int $limit = 20) { |
|
| 109 | + public function findProjects(string $text, int $limit = 20) { |
|
| 110 | 110 | return $this->find(Project::class, $text, $limit); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param int $limit 1-100 |
| 118 | 118 | * @return Tag[] |
| 119 | 119 | */ |
| 120 | - public function findTags (string $text, int $limit = 20) { |
|
| 120 | + public function findTags(string $text, int $limit = 20) { |
|
| 121 | 121 | return $this->find(Tag::class, $text, $limit); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | * @param int $limit 1-100 |
| 129 | 129 | * @return Task[] |
| 130 | 130 | */ |
| 131 | - public function findTasks (string $text, int $limit = 20) { |
|
| 131 | + public function findTasks(string $text, int $limit = 20) { |
|
| 132 | 132 | return $this->find(Task::class, $text, $limit); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * @return CustomField[] |
| 137 | 137 | */ |
| 138 | - public function getCustomFields () { |
|
| 138 | + public function getCustomFields() { |
|
| 139 | 139 | return $this->api->loadAll($this, CustomField::class, "{$this}/custom_fields"); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return Portfolio[] |
| 146 | 146 | */ |
| 147 | - public function getPortfolios () { |
|
| 147 | + public function getPortfolios() { |
|
| 148 | 148 | return $this->api->loadAll($this, Portfolio::class, "portfolios", [ |
| 149 | 149 | 'workspace' => $this->getGid(), |
| 150 | 150 | 'owner' => $this->api->getMe()->getGid() // the only allowed value, but still required. |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param array $filter |
| 158 | 158 | * @return Project[] |
| 159 | 159 | */ |
| 160 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
| 160 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
| 161 | 161 | $filter['workspace'] = $this->getGid(); |
| 162 | 162 | return $this->api->loadAll($this, Project::class, 'projects', $filter); |
| 163 | 163 | } |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * @return Tag[] |
| 167 | 167 | */ |
| 168 | - public function getTags () { |
|
| 168 | + public function getTags() { |
|
| 169 | 169 | return $this->api->loadAll($this, Tag::class, 'tags', ['workspace' => $this->getGid()]); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * @return Team[] |
| 174 | 174 | */ |
| 175 | - public function getTeams () { |
|
| 175 | + public function getTeams() { |
|
| 176 | 176 | return $this->api->loadAll($this, Team::class, "organizations/{$this->getGid()}/teams"); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param string $email |
| 181 | 181 | * @return null|User |
| 182 | 182 | */ |
| 183 | - public function getUserByEmail (string $email) { |
|
| 183 | + public function getUserByEmail(string $email) { |
|
| 184 | 184 | return $this->api->getPool()->get("users/{$email}", $this, function() use ($email) { |
| 185 | 185 | foreach ($this->getUsers() as $user) { |
| 186 | 186 | if ($user->getEmail() === $email) { |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | /** |
| 195 | 195 | * @return User[] |
| 196 | 196 | */ |
| 197 | - public function getUsers () { |
|
| 197 | + public function getUsers() { |
|
| 198 | 198 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * @return ProjectWebhook[]|TaskWebhook[] |
| 203 | 203 | */ |
| 204 | - public function getWebhooks () { |
|
| 204 | + public function getWebhooks() { |
|
| 205 | 205 | /** @var array $all */ |
| 206 | 206 | $all = $this->api->get('webhooks', ['workspace' => $this->getGid()], ['expand' => 'this']); |
| 207 | 207 | return array_map(function(array $each) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * @return bool |
| 220 | 220 | */ |
| 221 | - final public function isOrganization (): bool { |
|
| 221 | + final public function isOrganization(): bool { |
|
| 222 | 222 | return $this->_is('is_organization'); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @return CustomField |
| 229 | 229 | */ |
| 230 | - public function newCustomField () { |
|
| 230 | + public function newCustomField() { |
|
| 231 | 231 | /** @var CustomField $field */ |
| 232 | 232 | $field = $this->api->factory($this, CustomField::class); |
| 233 | 233 | return $field->setWorkspace($this); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return Portfolio |
| 240 | 240 | */ |
| 241 | - public function newPortfolio () { |
|
| 241 | + public function newPortfolio() { |
|
| 242 | 242 | /** @var Portfolio $portfolio */ |
| 243 | 243 | $portfolio = $this->api->factory($this, Portfolio::class); |
| 244 | 244 | return $portfolio->setWorkspace($this); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * |
| 250 | 250 | * @return Project |
| 251 | 251 | */ |
| 252 | - public function newProject () { |
|
| 252 | + public function newProject() { |
|
| 253 | 253 | /** @var Project $project */ |
| 254 | 254 | $project = $this->api->factory($this, Project::class); |
| 255 | 255 | return $project->setWorkspace($this); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return Tag |
| 262 | 262 | */ |
| 263 | - public function newTag () { |
|
| 263 | + public function newTag() { |
|
| 264 | 264 | /** @var Tag $tag */ |
| 265 | 265 | $tag = $this->api->factory($this, Tag::class); |
| 266 | 266 | return $tag->setWorkspace($this); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * |
| 272 | 272 | * @return Task |
| 273 | 273 | */ |
| 274 | - public function newTask () { |
|
| 274 | + public function newTask() { |
|
| 275 | 275 | /** @var Task $task */ |
| 276 | 276 | $task = $this->api->factory($this, Task::class); |
| 277 | 277 | return $task->setWorkspace($this); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | - final public function __toString (): string { |
|
| 95 | + final public function __toString(): string { |
|
| 96 | 96 | return "projects/{$this->getGid()}"; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - final protected function _getDir (): string { |
|
| 104 | + final protected function _getDir(): string { |
|
| 105 | 105 | return 'projects'; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - protected function _setData (array $data): void { |
|
| 108 | + protected function _setData(array $data): void { |
|
| 109 | 109 | // this is always empty. fields are in the settings, values are in tasks. |
| 110 | 110 | unset($data['custom_fields']); |
| 111 | 111 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * @param User $user |
| 121 | 121 | * @return $this |
| 122 | 122 | */ |
| 123 | - public function addMember (User $user) { |
|
| 123 | + public function addMember(User $user) { |
|
| 124 | 124 | return $this->addMembers([$user]); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @param User[] $users |
| 130 | 130 | * @return $this |
| 131 | 131 | */ |
| 132 | - public function addMembers (array $users) { |
|
| 132 | + public function addMembers(array $users) { |
|
| 133 | 133 | return $this->_addWithPost("{$this}/addMembers", [ |
| 134 | 134 | 'members' => array_column($users, 'gid') |
| 135 | 135 | ], 'members', $users); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string $target |
| 141 | 141 | * @return ProjectWebhook |
| 142 | 142 | */ |
| 143 | - public function addWebhook (string $target) { |
|
| 143 | + public function addWebhook(string $target) { |
|
| 144 | 144 | /** @var ProjectWebhook $webhook */ |
| 145 | 145 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
| 146 | 146 | return $webhook->create($this, $target); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param array $schedule |
| 166 | 166 | * @return Job |
| 167 | 167 | */ |
| 168 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 168 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 169 | 169 | $data = ['name' => $name]; |
| 170 | 170 | if ($team) { |
| 171 | 171 | $data['team'] = $team->getGid(); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @depends after-create |
| 186 | 186 | * @return Section |
| 187 | 187 | */ |
| 188 | - public function getDefaultSection () { |
|
| 188 | + public function getDefaultSection() { |
|
| 189 | 189 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param null|string $token |
| 199 | 199 | * @return Event[] |
| 200 | 200 | */ |
| 201 | - public function getEvents (&$token) { |
|
| 201 | + public function getEvents(&$token) { |
|
| 202 | 202 | return $this->api->sync($this->getGid(), $token); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param int $limit |
| 211 | 211 | * @return Traversable|Section[] |
| 212 | 212 | */ |
| 213 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
| 213 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
| 214 | 214 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param int $limit |
| 220 | 220 | * @return Section[] |
| 221 | 221 | */ |
| 222 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
| 222 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
| 223 | 223 | return iterator_to_array($this->getIterator($limit)); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @depends after-create |
| 228 | 228 | * @return Status[] |
| 229 | 229 | */ |
| 230 | - public function getStatuses () { |
|
| 230 | + public function getStatuses() { |
|
| 231 | 231 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @depends after-create |
| 236 | 236 | * @return TaskCounts |
| 237 | 237 | */ |
| 238 | - public function getTaskCounts () { |
|
| 238 | + public function getTaskCounts() { |
|
| 239 | 239 | /** @var array $remote */ |
| 240 | 240 | $remote = $this->api->get("{$this}/task_counts", [], TaskCounts::OPT); |
| 241 | 241 | return $this->api->factory($this, TaskCounts::class, $remote); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @param array $filter |
| 249 | 249 | * @return Task[] |
| 250 | 250 | */ |
| 251 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
| 251 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
| 252 | 252 | $filter['project'] = $this->getGid(); |
| 253 | 253 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
| 254 | 254 | } |
@@ -257,25 +257,25 @@ discard block |
||
| 257 | 257 | * @depends after-create |
| 258 | 258 | * @return string |
| 259 | 259 | */ |
| 260 | - public function getUrl (): string { |
|
| 260 | + public function getUrl(): string { |
|
| 261 | 261 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * @return ProjectWebhook[] |
| 266 | 266 | */ |
| 267 | - public function getWebhooks () { |
|
| 267 | + public function getWebhooks() { |
|
| 268 | 268 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
| 269 | 269 | 'workspace' => $this->getWorkspace()->getGid(), |
| 270 | 270 | 'resource' => $this->getGid() |
| 271 | 271 | ]); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - final public function isBoard (): bool { |
|
| 274 | + final public function isBoard(): bool { |
|
| 275 | 275 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - final public function isList (): bool { |
|
| 278 | + final public function isList(): bool { |
|
| 279 | 279 | return $this->getLayout() === self::LAYOUT_LIST; |
| 280 | 280 | } |
| 281 | 281 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * @depends after-create |
| 286 | 286 | * @return Section |
| 287 | 287 | */ |
| 288 | - public function newSection () { |
|
| 288 | + public function newSection() { |
|
| 289 | 289 | return $this->api->factory($this, Section::class, ['project' => $this]); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @depends after-create |
| 296 | 296 | * @return Status |
| 297 | 297 | */ |
| 298 | - public function newStatus () { |
|
| 298 | + public function newStatus() { |
|
| 299 | 299 | return $this->api->factory($this, Status::class); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @depends after-create |
| 306 | 306 | * @return Task |
| 307 | 307 | */ |
| 308 | - public function newTask () { |
|
| 308 | + public function newTask() { |
|
| 309 | 309 | return $this->getDefaultSection()->newTask(); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param User $user |
| 315 | 315 | * @return $this |
| 316 | 316 | */ |
| 317 | - public function removeMember (User $user) { |
|
| 317 | + public function removeMember(User $user) { |
|
| 318 | 318 | return $this->removeMembers([$user]); |
| 319 | 319 | } |
| 320 | 320 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * @param User[] $users |
| 324 | 324 | * @return $this |
| 325 | 325 | */ |
| 326 | - public function removeMembers (array $users) { |
|
| 326 | + public function removeMembers(array $users) { |
|
| 327 | 327 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 328 | 328 | 'members' => array_column($users, 'gid') |
| 329 | 329 | ], 'members', $users); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @param null|Team $team |
| 335 | 335 | * @return $this |
| 336 | 336 | */ |
| 337 | - public function setTeam (?Team $team) { |
|
| 337 | + public function setTeam(?Team $team) { |
|
| 338 | 338 | if ($team and !$this->hasWorkspace()) { |
| 339 | 339 | $this->setWorkspace($team->getOrganization()); |
| 340 | 340 | } |
@@ -50,7 +50,7 @@ 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 | $this->project = $project; |
| 55 | 55 | parent::__construct($project, $data); |
| 56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - final public function __toString (): string { |
|
| 63 | + final public function __toString(): string { |
|
| 64 | 64 | return "project_statuses/{$this->getGid()}"; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | - final protected function _getDir (): string { |
|
| 72 | + final protected function _getDir(): string { |
|
| 73 | 73 | return "{$this->project}/project_statuses"; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - protected function _setData (array $data): void { |
|
| 76 | + protected function _setData(array $data): void { |
|
| 77 | 77 | // redundant, prefer created_by |
| 78 | 78 | unset($data['author']); |
| 79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * @return Project |
| 85 | 85 | */ |
| 86 | - public function getProject () { |
|
| 86 | + public function getProject() { |
|
| 87 | 87 | return $this->project; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | \ No newline at end of file |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - final public function __toString (): string { |
|
| 39 | + final public function __toString(): string { |
|
| 40 | 40 | return "sections/{$this->getGid()}"; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return string |
| 47 | 47 | */ |
| 48 | - final protected function _getDir (): string { |
|
| 48 | + final protected function _getDir(): string { |
|
| 49 | 49 | return "{$this->getProject()}/sections"; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param array $filter |
| 54 | 54 | * @return Traversable|Task[] |
| 55 | 55 | */ |
| 56 | - public function getIterator (array $filter = Task::GET_INCOMPLETE) { |
|
| 56 | + public function getIterator(array $filter = Task::GET_INCOMPLETE) { |
|
| 57 | 57 | $filter['section'] = $this->getGid(); |
| 58 | 58 | return $this->api->loadEach($this, Task::class, 'tasks', $filter); |
| 59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param array $filter |
| 63 | 63 | * @return Task[] |
| 64 | 64 | */ |
| 65 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
| 65 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
| 66 | 66 | return iterator_to_array($this->getIterator($filter)); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @depends after-create |
| 73 | 73 | * @return Task |
| 74 | 74 | */ |
| 75 | - public function newTask () { |
|
| 75 | + public function newTask() { |
|
| 76 | 76 | /** @var Task $task */ |
| 77 | 77 | $task = $this->api->factory($this, Task::class); |
| 78 | 78 | return $task->addToProject($this); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - final public function __toString (): string { |
|
| 51 | + final public function __toString(): string { |
|
| 52 | 52 | return "custom_fields/{$this->getGid()}"; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - final protected function _getDir (): string { |
|
| 60 | + final protected function _getDir(): string { |
|
| 61 | 61 | return 'custom_fields'; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - protected function _setData (array $data): void { |
|
| 64 | + protected function _setData(array $data): void { |
|
| 65 | 65 | // strip out field entry values if present. |
| 66 | 66 | $data = array_intersect_key($data, array_flip([ |
| 67 | 67 | 'gid', |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param string $name |
| 83 | 83 | * @return EnumOption |
| 84 | 84 | */ |
| 85 | - public function addEnumOption (string $name) { |
|
| 85 | + public function addEnumOption(string $name) { |
|
| 86 | 86 | /** @var EnumOption $option */ |
| 87 | 87 | $option = $this->api->factory($this, EnumOption::class); |
| 88 | 88 | $option->setName($name); |
@@ -98,35 +98,35 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * @return bool |
| 100 | 100 | */ |
| 101 | - final public function hasNotificationsEnabled (): bool { |
|
| 101 | + final public function hasNotificationsEnabled(): bool { |
|
| 102 | 102 | return $this->_is('has_notifications_enabled'); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @return bool |
| 107 | 107 | */ |
| 108 | - final public function isEnum (): bool { |
|
| 108 | + final public function isEnum(): bool { |
|
| 109 | 109 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @return bool |
| 114 | 114 | */ |
| 115 | - final public function isGlobalToWorkspace (): bool { |
|
| 115 | + final public function isGlobalToWorkspace(): bool { |
|
| 116 | 116 | return $this->_is('is_global_to_workspace'); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | - final public function isNumber (): bool { |
|
| 122 | + final public function isNumber(): bool { |
|
| 123 | 123 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @return bool |
| 128 | 128 | */ |
| 129 | - final public function isText (): bool { |
|
| 129 | + final public function isText(): bool { |
|
| 130 | 130 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param bool $flag |
| 135 | 135 | * @return $this |
| 136 | 136 | */ |
| 137 | - final public function setGlobalToWorkspace (bool $flag) { |
|
| 137 | + final public function setGlobalToWorkspace(bool $flag) { |
|
| 138 | 138 | return $this->_set('is_global_to_workspace', $flag); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param bool $flag |
| 143 | 143 | * @return $this |
| 144 | 144 | */ |
| 145 | - final public function setNotificationsEnabled (bool $flag) { |
|
| 145 | + final public function setNotificationsEnabled(bool $flag) { |
|
| 146 | 146 | return $this->_set('has_notifications_enabled', $flag); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
| 151 | 151 | * @return $this |
| 152 | 152 | */ |
| 153 | - public function sortEnumOptions (callable $cmp) { |
|
| 153 | + public function sortEnumOptions(callable $cmp) { |
|
| 154 | 154 | if ($options = $this->getEnumOptions()) { |
| 155 | 155 | $prev = $options[0]; // first option on remote |
| 156 | 156 | usort($options, $cmp); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @param Workspace $workspace |
| 21 | 21 | * @return $this |
| 22 | 22 | */ |
| 23 | - final public function setWorkspace (Workspace $workspace) { |
|
| 23 | + final public function setWorkspace(Workspace $workspace) { |
|
| 24 | 24 | return $this->_set('workspace', $workspace); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - final public function __toString (): string { |
|
| 41 | + final public function __toString(): string { |
|
| 42 | 42 | return "organization_exports/{$this->getGid()}"; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @return string |
| 49 | 49 | */ |
| 50 | - final protected function _getDir (): string { |
|
| 50 | + final protected function _getDir(): string { |
|
| 51 | 51 | return "organization_exports"; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param Workspace $organization |
| 56 | 56 | * @return $this |
| 57 | 57 | */ |
| 58 | - public function create (Workspace $organization) { |
|
| 58 | + public function create(Workspace $organization) { |
|
| 59 | 59 | $this->_set('organization', $organization); |
| 60 | 60 | return $this->_create(); |
| 61 | 61 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return bool |
| 67 | 67 | */ |
| 68 | - final public function isActive (): bool { |
|
| 68 | + final public function isActive(): bool { |
|
| 69 | 69 | return $this->getState() === self::STATE_ACTIVE; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return bool |
| 76 | 76 | */ |
| 77 | - final public function isDone (): bool { |
|
| 77 | + final public function isDone(): bool { |
|
| 78 | 78 | return $this->isSuccessful() or $this->isFailed(); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return bool |
| 85 | 85 | */ |
| 86 | - final public function isFailed (): bool { |
|
| 86 | + final public function isFailed(): bool { |
|
| 87 | 87 | return $this->getState() === self::STATE_FAIL; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return bool |
| 94 | 94 | */ |
| 95 | - final public function isQueued (): bool { |
|
| 95 | + final public function isQueued(): bool { |
|
| 96 | 96 | return $this->getState() === self::STATE_QUEUED; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return bool |
| 103 | 103 | */ |
| 104 | - final public function isSuccessful (): bool { |
|
| 104 | + final public function isSuccessful(): bool { |
|
| 105 | 105 | return $this->getState() === self::STATE_SUCCESS; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param callable $spinner `fn( OrganizationExport $this ): void` |
| 114 | 114 | * @return $this |
| 115 | 115 | */ |
| 116 | - public function wait (callable $spinner = null) { |
|
| 116 | + public function wait(callable $spinner = null) { |
|
| 117 | 117 | while (!$this->isDone()) { |
| 118 | 118 | if ($spinner) { |
| 119 | 119 | call_user_func($spinner, $this); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected $key; |
| 42 | 42 | |
| 43 | - protected function _setData (array $data): void { |
|
| 43 | + protected function _setData(array $data): void { |
|
| 44 | 44 | $this->key = [ |
| 45 | 45 | Event::ACTION_ADDED => 'added_value', |
| 46 | 46 | Event::ACTION_REMOVED => 'removed_value', |
@@ -67,35 +67,35 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return null|User|Project|Section|Task|FieldEntry|Attachment|Story|Like |
| 69 | 69 | */ |
| 70 | - public function getPayload () { |
|
| 70 | + public function getPayload() { |
|
| 71 | 71 | return $this->data[$this->key]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @return bool |
| 76 | 76 | */ |
| 77 | - final public function hasPayload (): bool { |
|
| 77 | + final public function hasPayload(): bool { |
|
| 78 | 78 | return isset($this->data[$this->key]); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @return bool |
| 83 | 83 | */ |
| 84 | - final public function wasAddition (): bool { |
|
| 84 | + final public function wasAddition(): bool { |
|
| 85 | 85 | return $this->getAction() === Event::ACTION_ADDED; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * @return bool |
| 90 | 90 | */ |
| 91 | - final public function wasRemoval (): bool { |
|
| 91 | + final public function wasRemoval(): bool { |
|
| 92 | 92 | return $this->getAction() === Event::ACTION_REMOVED; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * @return bool |
| 97 | 97 | */ |
| 98 | - final public function wasValue (): bool { |
|
| 98 | + final public function wasValue(): bool { |
|
| 99 | 99 | return $this->getAction() === Event::ACTION_CHANGED; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - final public function __toString (): string { |
|
| 33 | + final public function __toString(): string { |
|
| 34 | 34 | return "teams/{$this->getGid()}"; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param User $user |
| 39 | 39 | * @return $this |
| 40 | 40 | */ |
| 41 | - public function addUser (User $user) { |
|
| 41 | + public function addUser(User $user) { |
|
| 42 | 42 | $this->api->post("{$this}/addUser", ['user' => $user->getGid()]); |
| 43 | 43 | return $this; |
| 44 | 44 | } |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | * @param array $filter |
| 52 | 52 | * @return Project[] |
| 53 | 53 | */ |
| 54 | - public function getProjects (array $filter = Project::GET_ACTIVE) { |
|
| 54 | + public function getProjects(array $filter = Project::GET_ACTIVE) { |
|
| 55 | 55 | return $this->api->loadAll($this, Project::class, "{$this}/projects", $filter); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function getUrl (): string { |
|
| 58 | + public function getUrl(): string { |
|
| 59 | 59 | return "https://app.asana.com/0/{$this->getGid()}/overview"; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return User[] |
| 68 | 68 | */ |
| 69 | - public function getUsers () { |
|
| 69 | + public function getUsers() { |
|
| 70 | 70 | return $this->api->loadAll($this, User::class, "{$this}/users"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param User $user |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - public function removeUser (User $user) { |
|
| 77 | + public function removeUser(User $user) { |
|
| 78 | 78 | $this->api->post("{$this}/removeUser", ['user' => $user->getGid()]); |
| 79 | 79 | return $this; |
| 80 | 80 | } |