@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | private $defaultSection; |
| 97 | 97 | |
| 98 | - protected function _setData (array $data): void { |
|
| 98 | + protected function _setData(array $data): void { |
|
| 99 | 99 | // this is always empty. fields are in the settings, values are in tasks. |
| 100 | 100 | unset($data['custom_fields']); |
| 101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param User $user |
| 110 | 110 | * @return $this |
| 111 | 111 | */ |
| 112 | - public function addFollower (User $user) { |
|
| 112 | + public function addFollower(User $user) { |
|
| 113 | 113 | return $this->addFollowers([$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 addFollowers (array $users) { |
|
| 120 | + public function addFollowers(array $users) { |
|
| 121 | 121 | return $this->_addWithPost("{$this}/addFollowers", [ |
| 122 | 122 | 'followers' => array_column($users, 'gid') |
| 123 | 123 | ], 'followers', $users); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param User $user |
| 128 | 128 | * @return $this |
| 129 | 129 | */ |
| 130 | - public function addMember (User $user) { |
|
| 130 | + public function addMember(User $user) { |
|
| 131 | 131 | return $this->addMembers([$user]); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param User[] $users |
| 136 | 136 | * @return $this |
| 137 | 137 | */ |
| 138 | - public function addMembers (array $users) { |
|
| 138 | + public function addMembers(array $users) { |
|
| 139 | 139 | return $this->_addWithPost("{$this}/addMembers", [ |
| 140 | 140 | 'members' => array_column($users, 'gid') |
| 141 | 141 | ], 'members', $users); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param array $schedule |
| 160 | 160 | * @return Job |
| 161 | 161 | */ |
| 162 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 162 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 163 | 163 | $data = ['name' => $name]; |
| 164 | 164 | if ($team) { |
| 165 | 165 | $data['team'] = $team->getGid(); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | /** |
| 179 | 179 | * @return Section |
| 180 | 180 | */ |
| 181 | - public function getDefaultSection () { |
|
| 181 | + public function getDefaultSection() { |
|
| 182 | 182 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param int $limit |
| 191 | 191 | * @return Traversable|Section[] |
| 192 | 192 | */ |
| 193 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
| 193 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
| 194 | 194 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -198,21 +198,21 @@ discard block |
||
| 198 | 198 | * @param int $limit |
| 199 | 199 | * @return Section[] |
| 200 | 200 | */ |
| 201 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
| 201 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
| 202 | 202 | return iterator_to_array($this->getIterator($limit)); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | 206 | * @return Status[] |
| 207 | 207 | */ |
| 208 | - public function getStatuses () { |
|
| 208 | + public function getStatuses() { |
|
| 209 | 209 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | 213 | * @return TaskCounts |
| 214 | 214 | */ |
| 215 | - public function getTaskCounts () { |
|
| 215 | + public function getTaskCounts() { |
|
| 216 | 216 | $remote = $this->api->get("{$this}/task_counts", [ |
| 217 | 217 | 'opt_fields' => // opt_expand doesn't work. |
| 218 | 218 | 'num_completed_milestones,' |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param array $filter |
| 232 | 232 | * @return Task[] |
| 233 | 233 | */ |
| 234 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
| 234 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
| 235 | 235 | $filter['project'] = $this->getGid(); |
| 236 | 236 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
| 237 | 237 | } |
@@ -239,14 +239,14 @@ discard block |
||
| 239 | 239 | /** |
| 240 | 240 | * @return string |
| 241 | 241 | */ |
| 242 | - final public function getUrl (): string { |
|
| 242 | + final public function getUrl(): string { |
|
| 243 | 243 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * @return ProjectWebhook[] |
| 248 | 248 | */ |
| 249 | - public function getWebhooks () { |
|
| 249 | + public function getWebhooks() { |
|
| 250 | 250 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
| 251 | 251 | 'workspace' => $this->getWorkspace()->getGid(), |
| 252 | 252 | 'resource' => $this->getGid() |
@@ -256,21 +256,21 @@ discard block |
||
| 256 | 256 | /** |
| 257 | 257 | * @return bool |
| 258 | 258 | */ |
| 259 | - final public function isBoard (): bool { |
|
| 259 | + final public function isBoard(): bool { |
|
| 260 | 260 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
| 264 | 264 | * @return bool |
| 265 | 265 | */ |
| 266 | - final public function isList (): bool { |
|
| 266 | + final public function isList(): bool { |
|
| 267 | 267 | return $this->getLayout() === self::LAYOUT_LIST; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
| 273 | - final public function isTemplate (): bool { |
|
| 273 | + final public function isTemplate(): bool { |
|
| 274 | 274 | return $this->_is('is_template'); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * |
| 280 | 280 | * @return Section |
| 281 | 281 | */ |
| 282 | - public function newSection () { |
|
| 282 | + public function newSection() { |
|
| 283 | 283 | return $this->api->factory($this, Section::class, ['project' => $this]); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * |
| 289 | 289 | * @return Status |
| 290 | 290 | */ |
| 291 | - public function newStatus () { |
|
| 291 | + public function newStatus() { |
|
| 292 | 292 | return $this->api->factory($this, Status::class); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return Task |
| 299 | 299 | */ |
| 300 | - public function newTask () { |
|
| 300 | + public function newTask() { |
|
| 301 | 301 | return $this->getDefaultSection()->newTask(); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * |
| 307 | 307 | * @return ProjectWebhook |
| 308 | 308 | */ |
| 309 | - public function newWebhook () { |
|
| 309 | + public function newWebhook() { |
|
| 310 | 310 | /** @var ProjectWebhook $webhook */ |
| 311 | 311 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
| 312 | 312 | return $webhook->setResource($this); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @param User $user |
| 317 | 317 | * @return $this |
| 318 | 318 | */ |
| 319 | - public function removeFollower (User $user) { |
|
| 319 | + public function removeFollower(User $user) { |
|
| 320 | 320 | return $this->removeFollowers([$user]); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @param User[] $users |
| 325 | 325 | * @return $this |
| 326 | 326 | */ |
| 327 | - public function removeFollowers (array $users) { |
|
| 327 | + public function removeFollowers(array $users) { |
|
| 328 | 328 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
| 329 | 329 | 'followers' => array_column($users, 'gid') |
| 330 | 330 | ], 'followers', $users); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @param User $user |
| 335 | 335 | * @return $this |
| 336 | 336 | */ |
| 337 | - public function removeMember (User $user) { |
|
| 337 | + public function removeMember(User $user) { |
|
| 338 | 338 | return $this->removeMembers([$user]); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @param User[] $users |
| 343 | 343 | * @return $this |
| 344 | 344 | */ |
| 345 | - public function removeMembers (array $users) { |
|
| 345 | + public function removeMembers(array $users) { |
|
| 346 | 346 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 347 | 347 | 'members' => array_column($users, 'gid') |
| 348 | 348 | ], 'members', $users); |
@@ -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; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param Change|FieldEntries $caller |
| 32 | 32 | * @param array $data |
| 33 | 33 | */ |
| 34 | - public function __construct ($caller, array $data = []) { |
|
| 34 | + public function __construct($caller, array $data = []) { |
|
| 35 | 35 | $this->caller = $caller; |
| 36 | 36 | parent::__construct($caller, $data); |
| 37 | 37 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | - public function __toString (): string { |
|
| 42 | + public function __toString(): string { |
|
| 43 | 43 | if ($this->isEnum()) { |
| 44 | 44 | return (string)$this->getCurrentOptionName(); |
| 45 | 45 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param array $data |
| 53 | 53 | */ |
| 54 | - protected function _setData (array $data): void { |
|
| 54 | + protected function _setData(array $data): void { |
|
| 55 | 55 | if (isset($data['resource_subtype'])) { // sentinel for bloat |
| 56 | 56 | $tiny = array_intersect_key($data, array_flip([ |
| 57 | 57 | 'gid', |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | * @param null|string $value |
| 78 | 78 | * @return null|string |
| 79 | 79 | */ |
| 80 | - protected function _toEnumOptionGid ($value) { |
|
| 80 | + protected function _toEnumOptionGid($value) { |
|
| 81 | 81 | return $this->getEnumOptionValues()[$value] ?? $value; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - final public function getCurrentOptionName (): string { |
|
| 87 | + final public function getCurrentOptionName(): string { |
|
| 88 | 88 | return $this->getEnumOptionNames()[$this->getValue()]; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @return CustomField |
| 93 | 93 | */ |
| 94 | - public function getCustomField () { |
|
| 94 | + public function getCustomField() { |
|
| 95 | 95 | return $this->api->getCustomField($this->getGid()); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return string[] |
| 102 | 102 | */ |
| 103 | - final public function getEnumOptionNames () { |
|
| 103 | + final public function getEnumOptionNames() { |
|
| 104 | 104 | static $names = []; // shared |
| 105 | 105 | $gid = $this->data['gid']; |
| 106 | 106 | return $names[$gid] ?? $names[$gid] = array_column($this->data['enum_options'], 'name', 'gid'); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return string[] |
| 113 | 113 | */ |
| 114 | - final public function getEnumOptionValues () { |
|
| 114 | + final public function getEnumOptionValues() { |
|
| 115 | 115 | static $values = []; // shared |
| 116 | 116 | $gid = $this->data['gid']; |
| 117 | 117 | return $values[$gid] ?? $values[$gid] = array_column($this->data['enum_options'], 'gid', 'name'); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return null|number|string |
| 122 | 122 | */ |
| 123 | - final public function getValue () { |
|
| 123 | + final public function getValue() { |
|
| 124 | 124 | $type = $this->data['type']; |
| 125 | 125 | if ($type === CustomField::TYPE_ENUM) { |
| 126 | 126 | return $this->data['enum_value']['gid'] ?? null; |
@@ -131,21 +131,21 @@ discard block |
||
| 131 | 131 | /** |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
| 134 | - final public function isEnum (): bool { |
|
| 134 | + final public function isEnum(): bool { |
|
| 135 | 135 | return $this->getType() === CustomField::TYPE_ENUM; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * @return bool |
| 140 | 140 | */ |
| 141 | - final public function isNumber (): bool { |
|
| 141 | + final public function isNumber(): bool { |
|
| 142 | 142 | return $this->getType() === CustomField::TYPE_NUMBER; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @return bool |
| 147 | 147 | */ |
| 148 | - final public function isText (): bool { |
|
| 148 | + final public function isText(): bool { |
|
| 149 | 149 | return $this->getType() === CustomField::TYPE_TEXT; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param null|number|string $value |
| 154 | 154 | * @return $this |
| 155 | 155 | */ |
| 156 | - final public function setValue ($value) { |
|
| 156 | + final public function setValue($value) { |
|
| 157 | 157 | if ($this->caller instanceof FieldEntries) { // read-only if the entry is in an event change. |
| 158 | 158 | $type = $this->data['type']; |
| 159 | 159 | $this->diff["{$type}_value"] = true; |
@@ -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(); |