@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return string |
| 41 | 41 | */ |
| 42 | - final public function __toString (): string { |
|
| 42 | + final public function __toString(): string { |
|
| 43 | 43 | return "attachments/{$this->getGid()}"; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param string $file |
| 52 | 52 | * @return $this |
| 53 | 53 | */ |
| 54 | - public function create (string $file) { |
|
| 54 | + public function create(string $file) { |
|
| 55 | 55 | // api returns compact version. reload. |
| 56 | 56 | $remote = $this->api->call('POST', "{$this->getParent()}/attachments", [ |
| 57 | 57 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
@@ -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 | return array_map(function(array $each) { |
| 206 | 206 | return $this->api->getPool()->get($each['gid'], $this, function() use ($each) { |
| 207 | 207 | return $this->api->factory($this, [ |
@@ -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); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - final public function __toString (): string { |
|
| 97 | + final public function __toString(): string { |
|
| 98 | 98 | return "projects/{$this->getGid()}"; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | - final protected function _getDir (): string { |
|
| 106 | + final protected function _getDir(): string { |
|
| 107 | 107 | return 'projects'; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - protected function _setData (array $data): void { |
|
| 110 | + protected function _setData(array $data): void { |
|
| 111 | 111 | // this is always empty. fields are in the settings, values are in tasks. |
| 112 | 112 | unset($data['custom_fields']); |
| 113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param User $user |
| 123 | 123 | * @return $this |
| 124 | 124 | */ |
| 125 | - public function addMember (User $user) { |
|
| 125 | + public function addMember(User $user) { |
|
| 126 | 126 | return $this->addMembers([$user]); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param User[] $users |
| 132 | 132 | * @return $this |
| 133 | 133 | */ |
| 134 | - public function addMembers (array $users) { |
|
| 134 | + public function addMembers(array $users) { |
|
| 135 | 135 | return $this->_addWithPost("{$this}/addMembers", [ |
| 136 | 136 | 'members' => array_column($users, 'gid') |
| 137 | 137 | ], 'members', $users); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param string $target |
| 143 | 143 | * @return ProjectWebhook |
| 144 | 144 | */ |
| 145 | - public function addWebhook (string $target) { |
|
| 145 | + public function addWebhook(string $target) { |
|
| 146 | 146 | /** @var ProjectWebhook $webhook */ |
| 147 | 147 | $webhook = $this->api->factory($this, ProjectWebhook::class); |
| 148 | 148 | return $webhook->create($this, $target); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param array $schedule |
| 168 | 168 | * @return Job |
| 169 | 169 | */ |
| 170 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 170 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 171 | 171 | $data = ['name' => $name]; |
| 172 | 172 | if ($team) { |
| 173 | 173 | $data['team'] = $team->getGid(); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @depends after-create |
| 188 | 188 | * @return Section |
| 189 | 189 | */ |
| 190 | - public function getDefaultSection () { |
|
| 190 | + public function getDefaultSection() { |
|
| 191 | 191 | return $this->defaultSection ?? $this->defaultSection = $this->getSections(1)[0]; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param int $limit |
| 200 | 200 | * @return Traversable|Section[] |
| 201 | 201 | */ |
| 202 | - public function getIterator (int $limit = PHP_INT_MAX) { |
|
| 202 | + public function getIterator(int $limit = PHP_INT_MAX) { |
|
| 203 | 203 | return $this->api->loadEach($this, Section::class, "{$this}/sections", ['limit' => $limit]); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @param int $limit |
| 209 | 209 | * @return Section[] |
| 210 | 210 | */ |
| 211 | - public function getSections (int $limit = PHP_INT_MAX) { |
|
| 211 | + public function getSections(int $limit = PHP_INT_MAX) { |
|
| 212 | 212 | return iterator_to_array($this->getIterator($limit)); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @depends after-create |
| 217 | 217 | * @return Status[] |
| 218 | 218 | */ |
| 219 | - public function getStatuses () { |
|
| 219 | + public function getStatuses() { |
|
| 220 | 220 | return $this->api->loadAll($this, Status::class, "{$this}/project_statuses"); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @depends after-create |
| 225 | 225 | * @return TaskCounts |
| 226 | 226 | */ |
| 227 | - public function getTaskCounts () { |
|
| 227 | + public function getTaskCounts() { |
|
| 228 | 228 | $remote = $this->api->get("{$this}/task_counts", [ |
| 229 | 229 | 'opt_fields' => // opt_expand doesn't work. |
| 230 | 230 | 'num_completed_milestones,' |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param array $filter |
| 245 | 245 | * @return Task[] |
| 246 | 246 | */ |
| 247 | - public function getTasks (array $filter = Task::GET_INCOMPLETE) { |
|
| 247 | + public function getTasks(array $filter = Task::GET_INCOMPLETE) { |
|
| 248 | 248 | $filter['project'] = $this->getGid(); |
| 249 | 249 | return $this->api->loadAll($this, Task::class, "tasks", $filter); |
| 250 | 250 | } |
@@ -253,14 +253,14 @@ discard block |
||
| 253 | 253 | * @depends after-create |
| 254 | 254 | * @return string |
| 255 | 255 | */ |
| 256 | - public function getUrl (): string { |
|
| 256 | + public function getUrl(): string { |
|
| 257 | 257 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * @return ProjectWebhook[] |
| 262 | 262 | */ |
| 263 | - public function getWebhooks () { |
|
| 263 | + public function getWebhooks() { |
|
| 264 | 264 | return $this->api->loadAll($this, ProjectWebhook::class, 'webhooks', [ |
| 265 | 265 | 'workspace' => $this->getWorkspace()->getGid(), |
| 266 | 266 | 'resource' => $this->getGid() |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * @return bool |
| 272 | 272 | */ |
| 273 | - final public function isBoard (): bool { |
|
| 273 | + final public function isBoard(): bool { |
|
| 274 | 274 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * @return bool |
| 279 | 279 | */ |
| 280 | - final public function isList (): bool { |
|
| 280 | + final public function isList(): bool { |
|
| 281 | 281 | return $this->getLayout() === self::LAYOUT_LIST; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @depends after-create |
| 288 | 288 | * @return Section |
| 289 | 289 | */ |
| 290 | - public function newSection () { |
|
| 290 | + public function newSection() { |
|
| 291 | 291 | return $this->api->factory($this, Section::class, ['project' => $this]); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @depends after-create |
| 298 | 298 | * @return Status |
| 299 | 299 | */ |
| 300 | - public function newStatus () { |
|
| 300 | + public function newStatus() { |
|
| 301 | 301 | return $this->api->factory($this, Status::class); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @depends after-create |
| 308 | 308 | * @return Task |
| 309 | 309 | */ |
| 310 | - public function newTask () { |
|
| 310 | + public function newTask() { |
|
| 311 | 311 | return $this->getDefaultSection()->newTask(); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @param User $user |
| 317 | 317 | * @return $this |
| 318 | 318 | */ |
| 319 | - public function removeMember (User $user) { |
|
| 319 | + public function removeMember(User $user) { |
|
| 320 | 320 | return $this->removeMembers([$user]); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @param User[] $users |
| 326 | 326 | * @return $this |
| 327 | 327 | */ |
| 328 | - public function removeMembers (array $users) { |
|
| 328 | + public function removeMembers(array $users) { |
|
| 329 | 329 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 330 | 330 | 'members' => array_column($users, 'gid') |
| 331 | 331 | ], 'members', $users); |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @param null|Team $team |
| 337 | 337 | * @return $this |
| 338 | 338 | */ |
| 339 | - public function setTeam (?Team $team) { |
|
| 339 | + public function setTeam(?Team $team) { |
|
| 340 | 340 | if ($team and !$this->hasWorkspace()) { |
| 341 | 341 | $this->setWorkspace($team->getOrganization()); |
| 342 | 342 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected $curlInfo; |
| 23 | 23 | |
| 24 | - public function __construct (int $code, string $message, array $curlInfo) { |
|
| 24 | + public function __construct(int $code, string $message, array $curlInfo) { |
|
| 25 | 25 | parent::__construct($message, $code); |
| 26 | 26 | $this->curlInfo = $curlInfo; |
| 27 | 27 | } |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return array |
| 31 | 31 | */ |
| 32 | - public function asResponse () { |
|
| 33 | - return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
| 32 | + public function asResponse() { |
|
| 33 | + return json_decode($this->getMessage(), true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @return array |
| 38 | 38 | */ |
| 39 | - public function getCurlInfo (): array { |
|
| 39 | + public function getCurlInfo(): array { |
|
| 40 | 40 | return $this->curlInfo; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param int $code |
| 45 | 45 | * @return bool |
| 46 | 46 | */ |
| 47 | - final public function is (int $code): bool { |
|
| 47 | + final public function is(int $code): bool { |
|
| 48 | 48 | return $this->code === $code; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | \ No newline at end of file |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - abstract public function __toString (): string; |
|
| 33 | + abstract public function __toString(): string; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @param self $entity |
| 37 | 37 | * @return bool |
| 38 | 38 | * @internal pool |
| 39 | 39 | */ |
| 40 | - final public function __merge (self $entity): bool { |
|
| 40 | + final public function __merge(self $entity): bool { |
|
| 41 | 41 | $old = $this->toArray(); |
| 42 | 42 | $this->data = array_merge($this->data, array_diff_key($entity->data, $this->diff)); |
| 43 | 43 | return $this->toArray() !== $old; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param string $field |
| 50 | 50 | * @return mixed |
| 51 | 51 | */ |
| 52 | - protected function _get (string $field) { |
|
| 52 | + protected function _get(string $field) { |
|
| 53 | 53 | if (!array_key_exists($field, $this->data) and $this->hasGid()) { |
| 54 | 54 | $this->_reload($field); |
| 55 | 55 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * @param string $field |
| 61 | 61 | */ |
| 62 | - protected function _reload (string $field): void { |
|
| 62 | + protected function _reload(string $field): void { |
|
| 63 | 63 | $remote = $this->api->get($this, ['opt_fields' => static::OPT_FIELDS[$field] ?? $field]); |
| 64 | 64 | $this->_setField($field, $remote[$field]); |
| 65 | 65 | $this->api->getPool()->add($this); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - protected function _setData (array $data): void { |
|
| 68 | + protected function _setData(array $data): void { |
|
| 69 | 69 | // meaningless once the entity is being created. it's constant. |
| 70 | 70 | unset($data['resource_type'], $data['type']); |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * @return null|string |
| 77 | 77 | */ |
| 78 | - final public function getGid (): ?string { |
|
| 78 | + final public function getGid(): ?string { |
|
| 79 | 79 | return $this->data['gid'] ?? null; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return string[] |
| 86 | 86 | */ |
| 87 | - public function getPoolKeys () { |
|
| 87 | + public function getPoolKeys() { |
|
| 88 | 88 | return [$this->getGid(), (string)$this]; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return string |
| 95 | 95 | */ |
| 96 | - final public function getResourceType (): string { |
|
| 96 | + final public function getResourceType(): string { |
|
| 97 | 97 | return static::TYPE; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - final public function hasGid (): bool { |
|
| 103 | + final public function hasGid(): bool { |
|
| 104 | 104 | return isset($this->data['gid']); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @depends after-create |
| 111 | 111 | * @return $this |
| 112 | 112 | */ |
| 113 | - public function reload () { |
|
| 113 | + public function reload() { |
|
| 114 | 114 | $remote = $this->api->get($this, ['opt_expand' => 'this']); |
| 115 | 115 | if (!isset($remote['gid'])) { // null and dir guard |
| 116 | 116 | $this->api->getPool()->remove($this->getPoolKeys()); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param null|string $token Updated to the new token. |
| 25 | 25 | * @return Event[] |
| 26 | 26 | */ |
| 27 | - public function getEvents (?string &$token) { |
|
| 27 | + public function getEvents(?string &$token) { |
|
| 28 | 28 | try { |
| 29 | 29 | /** @var array $remote Asana throws 400 for missing entities. */ |
| 30 | 30 | $remote = $this->api->call('GET', 'events?' . http_build_query([ |
@@ -32,8 +32,7 @@ |
||
| 32 | 32 | 'sync' => $token, |
| 33 | 33 | 'opt_expand' => 'this' |
| 34 | 34 | ])); |
| 35 | - } |
|
| 36 | - catch (AsanaError $error) { |
|
| 35 | + } catch (AsanaError $error) { |
|
| 37 | 36 | if ($error->is(412)) { |
| 38 | 37 | $remote = $error->asResponse(); |
| 39 | 38 | if (!isset($token)) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param string $token |
| 43 | 43 | * @param null|Pool $pool |
| 44 | 44 | */ |
| 45 | - public function __construct (string $token, Pool $pool = null) { |
|
| 45 | + public function __construct(string $token, Pool $pool = null) { |
|
| 46 | 46 | $this->token = $token; |
| 47 | 47 | $this->pool = $pool ?? new Pool(); |
| 48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param array $curlOpts |
| 56 | 56 | * @return null|array |
| 57 | 57 | */ |
| 58 | - public function call (string $method, string $path, array $curlOpts = []) { |
|
| 58 | + public function call(string $method, string $path, array $curlOpts = []) { |
|
| 59 | 59 | $this->getLog()->log(LOG_DEBUG, "{$method} {$path}", $curlOpts); |
| 60 | 60 | $ch = curl_init(); |
| 61 | 61 | curl_setopt_array($ch, [ |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param resource $ch |
| 78 | 78 | * @return null|array |
| 79 | 79 | */ |
| 80 | - protected function call_loop ($ch) { |
|
| 80 | + protected function call_loop($ch) { |
|
| 81 | 81 | $response = curl_exec($ch); |
| 82 | 82 | $info = curl_getinfo($ch); |
| 83 | 83 | if ($response === false) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | switch ($info['http_code']) { |
| 91 | 91 | case 200: |
| 92 | 92 | case 201: |
| 93 | - return json_decode($body, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
| 93 | + return json_decode($body, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
| 94 | 94 | case 404: |
| 95 | 95 | return null; |
| 96 | 96 | case 429: |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param string $path |
| 111 | 111 | */ |
| 112 | - public function delete (string $path): void { |
|
| 112 | + public function delete(string $path): void { |
|
| 113 | 113 | $this->call('DELETE', $path); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param array $data |
| 124 | 124 | * @return mixed|Data|AbstractEntity |
| 125 | 125 | */ |
| 126 | - public function factory ($caller, string $class, array $data = []) { |
|
| 126 | + public function factory($caller, string $class, array $data = []) { |
|
| 127 | 127 | return new $class($caller, $data); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param array $query |
| 135 | 135 | * @return null|array |
| 136 | 136 | */ |
| 137 | - public function get (string $path, array $query = []) { |
|
| 137 | + public function get(string $path, array $query = []) { |
|
| 138 | 138 | return $this->call('GET', $path . '?' . http_build_query($query))['data'] ?? null; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param string $gid |
| 145 | 145 | * @return null|Attachment |
| 146 | 146 | */ |
| 147 | - public function getAttachment (string $gid) { |
|
| 147 | + public function getAttachment(string $gid) { |
|
| 148 | 148 | return $this->load($this, Attachment::class, "attachments/{$gid}"); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param string $gid |
| 155 | 155 | * @return null|CustomField |
| 156 | 156 | */ |
| 157 | - public function getCustomField (string $gid) { |
|
| 157 | + public function getCustomField(string $gid) { |
|
| 158 | 158 | return $this->load($this, CustomField::class, "custom_fields/{$gid}"); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -165,28 +165,28 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return Workspace |
| 167 | 167 | */ |
| 168 | - public function getDefaultWorkspace () { |
|
| 168 | + public function getDefaultWorkspace() { |
|
| 169 | 169 | return $this->getMe()->getDefaultWorkspace(); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * @return LoggerInterface |
| 174 | 174 | */ |
| 175 | - public function getLog () { |
|
| 175 | + public function getLog() { |
|
| 176 | 176 | return $this->log ?? $this->log = new NullLogger(); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * @return User |
| 181 | 181 | */ |
| 182 | - public function getMe () { |
|
| 182 | + public function getMe() { |
|
| 183 | 183 | return $this->getUser('me'); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * @return Pool |
| 188 | 188 | */ |
| 189 | - public function getPool () { |
|
| 189 | + public function getPool() { |
|
| 190 | 190 | return $this->pool; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param string $gid |
| 197 | 197 | * @return null|Portfolio |
| 198 | 198 | */ |
| 199 | - public function getPortfolio (string $gid) { |
|
| 199 | + public function getPortfolio(string $gid) { |
|
| 200 | 200 | return $this->load($this, Portfolio::class, "portfolios/{$gid}"); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @param string $gid |
| 207 | 207 | * @return null|Project |
| 208 | 208 | */ |
| 209 | - public function getProject (string $gid) { |
|
| 209 | + public function getProject(string $gid) { |
|
| 210 | 210 | return $this->load($this, Project::class, "projects/{$gid}"); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param string $gid |
| 215 | 215 | * @return null|ProjectWebhook |
| 216 | 216 | */ |
| 217 | - public function getProjectWebhook (string $gid) { |
|
| 217 | + public function getProjectWebhook(string $gid) { |
|
| 218 | 218 | return $this->load($this, ProjectWebhook::class, "webhooks/{$gid}"); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @param string $gid |
| 225 | 225 | * @return null|Section |
| 226 | 226 | */ |
| 227 | - public function getSection (string $gid) { |
|
| 227 | + public function getSection(string $gid) { |
|
| 228 | 228 | return $this->load($this, Section::class, "sections/{$gid}"); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @param string $gid |
| 235 | 235 | * @return null|Story |
| 236 | 236 | */ |
| 237 | - public function getStory (string $gid) { |
|
| 237 | + public function getStory(string $gid) { |
|
| 238 | 238 | return $this->load($this, Story::class, "stories/{$gid}"); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param string $gid |
| 245 | 245 | * @return null|Tag |
| 246 | 246 | */ |
| 247 | - public function getTag (string $gid) { |
|
| 247 | + public function getTag(string $gid) { |
|
| 248 | 248 | return $this->load($this, Tag::class, "tags/{$gid}"); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @param string $gid |
| 255 | 255 | * @return null|Task |
| 256 | 256 | */ |
| 257 | - public function getTask (string $gid) { |
|
| 257 | + public function getTask(string $gid) { |
|
| 258 | 258 | return $this->load($this, Task::class, "tasks/{$gid}"); |
| 259 | 259 | } |
| 260 | 260 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param string $gid |
| 265 | 265 | * @return null|TaskList |
| 266 | 266 | */ |
| 267 | - public function getTaskList (string $gid) { |
|
| 267 | + public function getTaskList(string $gid) { |
|
| 268 | 268 | return $this->load($this, TaskList::class, "user_task_lists/{$gid}"); |
| 269 | 269 | } |
| 270 | 270 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param string $gid |
| 273 | 273 | * @return null|TaskWebhook |
| 274 | 274 | */ |
| 275 | - public function getTaskWebhook (string $gid) { |
|
| 275 | + public function getTaskWebhook(string $gid) { |
|
| 276 | 276 | return $this->load($this, TaskWebhook::class, "webhooks/{$gid}"); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param string $gid |
| 283 | 283 | * @return null|Team |
| 284 | 284 | */ |
| 285 | - public function getTeam (string $gid) { |
|
| 285 | + public function getTeam(string $gid) { |
|
| 286 | 286 | return $this->load($this, Team::class, "teams/{$gid}"); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param string $gid |
| 293 | 293 | * @return null|User |
| 294 | 294 | */ |
| 295 | - public function getUser (string $gid) { |
|
| 295 | + public function getUser(string $gid) { |
|
| 296 | 296 | return $this->load($this, User::class, "users/{$gid}"); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param array $data |
| 305 | 305 | * @return Event |
| 306 | 306 | */ |
| 307 | - public function getWebhookEvent (array $data) { |
|
| 307 | + public function getWebhookEvent(array $data) { |
|
| 308 | 308 | return $this->factory($this, Event::class, $data); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param string $gid |
| 315 | 315 | * @return null|Workspace |
| 316 | 316 | */ |
| 317 | - public function getWorkspace (string $gid) { |
|
| 317 | + public function getWorkspace(string $gid) { |
|
| 318 | 318 | return $this->load($this, Workspace::class, "workspaces/{$gid}"); |
| 319 | 319 | } |
| 320 | 320 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @param array $query |
| 328 | 328 | * @return null|mixed|AbstractEntity |
| 329 | 329 | */ |
| 330 | - public function load ($caller, string $class, string $path, array $query = []) { |
|
| 330 | + public function load($caller, string $class, string $path, array $query = []) { |
|
| 331 | 331 | $key = rtrim($path . '?' . http_build_query($query), '?'); |
| 332 | 332 | $query['opt_expand'] = 'this'; |
| 333 | 333 | return $this->pool->get($key, $caller, function($caller) use ($class, $path, $query) { |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @param array $query |
| 348 | 348 | * @return array|AbstractEntity[] |
| 349 | 349 | */ |
| 350 | - public function loadAll ($caller, string $class, string $path, array $query = []) { |
|
| 350 | + public function loadAll($caller, string $class, string $path, array $query = []) { |
|
| 351 | 351 | return iterator_to_array($this->loadEach(...func_get_args())); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * @param array $query `limit` can exceed `100` here. |
| 363 | 363 | * @return Generator|AbstractEntity[] |
| 364 | 364 | */ |
| 365 | - public function loadEach ($caller, string $class, string $path, array $query = []) { |
|
| 365 | + public function loadEach($caller, string $class, string $path, array $query = []) { |
|
| 366 | 366 | $query['opt_expand'] = 'this'; |
| 367 | 367 | $remain = $query['limit'] ?? PHP_INT_MAX; |
| 368 | 368 | do { |
@@ -386,13 +386,13 @@ discard block |
||
| 386 | 386 | * @param array $options |
| 387 | 387 | * @return null|array |
| 388 | 388 | */ |
| 389 | - public function post (string $path, array $data = [], array $options = []) { |
|
| 389 | + public function post(string $path, array $data = [], array $options = []) { |
|
| 390 | 390 | return $this->call('POST', $path, [ |
| 391 | 391 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 392 | 392 | CURLOPT_POSTFIELDS => json_encode([ |
| 393 | 393 | 'options' => $options, |
| 394 | 394 | 'data' => $data |
| 395 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
| 395 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
| 396 | 396 | ])['data'] ?? null; |
| 397 | 397 | } |
| 398 | 398 | |
@@ -404,20 +404,20 @@ discard block |
||
| 404 | 404 | * @param array $options |
| 405 | 405 | * @return null|array |
| 406 | 406 | */ |
| 407 | - public function put (string $path, array $data = [], array $options = []) { |
|
| 407 | + public function put(string $path, array $data = [], array $options = []) { |
|
| 408 | 408 | return $this->call('PUT', $path, [ |
| 409 | 409 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 410 | 410 | CURLOPT_POSTFIELDS => json_encode([ |
| 411 | 411 | 'options' => $options, |
| 412 | 412 | 'data' => $data |
| 413 | - ], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR) |
|
| 413 | + ], JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR) |
|
| 414 | 414 | ])['data'] ?? null; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
| 418 | 418 | * @param LoggerInterface $log |
| 419 | 419 | */ |
| 420 | - public function setLog (LoggerInterface $log) { |
|
| 420 | + public function setLog(LoggerInterface $log) { |
|
| 421 | 421 | $this->log = $log; |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | \ No newline at end of file |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | - final public function __toString (): string { |
|
| 122 | + final public function __toString(): string { |
|
| 123 | 123 | return "tasks/{$this->getGid()}"; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | - final protected function _getDir (): string { |
|
| 131 | + final protected function _getDir(): string { |
|
| 132 | 132 | return 'tasks'; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - private function _onSave (): void { |
|
| 135 | + private function _onSave(): void { |
|
| 136 | 136 | /** @var FieldEntries $fields */ |
| 137 | 137 | if ($fields = $this->data['custom_fields'] ?? null) { |
| 138 | 138 | $fields->__unset(true); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - protected function _setData (array $data): void { |
|
| 146 | + protected function _setData(array $data): void { |
|
| 147 | 147 | // hearts were deprecated for likes |
| 148 | 148 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
| 149 | 149 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param string $file |
| 164 | 164 | * @return Attachment |
| 165 | 165 | */ |
| 166 | - public function addAttachment (string $file) { |
|
| 166 | + public function addAttachment(string $file) { |
|
| 167 | 167 | /** @var Attachment $attachment */ |
| 168 | 168 | $attachment = $this->api->factory($this, Attachment::class, ['parent' => $this]); |
| 169 | 169 | return $attachment->create($file); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string $text |
| 177 | 177 | * @return Story |
| 178 | 178 | */ |
| 179 | - public function addComment (string $text) { |
|
| 179 | + public function addComment(string $text) { |
|
| 180 | 180 | return $this->newComment()->setText($text)->create(); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param Task[] $tasks |
| 188 | 188 | * @return $this |
| 189 | 189 | */ |
| 190 | - public function addDependencies (array $tasks) { |
|
| 190 | + public function addDependencies(array $tasks) { |
|
| 191 | 191 | $this->api->post("{$this}/addDependencies", ['dependents' => array_column($tasks, 'gid')]); |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param Task $task |
| 200 | 200 | * @return $this |
| 201 | 201 | */ |
| 202 | - public function addDependency (Task $task) { |
|
| 202 | + public function addDependency(Task $task) { |
|
| 203 | 203 | return $this->addDependencies([$task]); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param Task $task |
| 211 | 211 | * @return $this |
| 212 | 212 | */ |
| 213 | - public function addDependent (Task $task) { |
|
| 213 | + public function addDependent(Task $task) { |
|
| 214 | 214 | return $this->addDependents([$task]); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param Task[] $tasks |
| 222 | 222 | * @return $this |
| 223 | 223 | */ |
| 224 | - public function addDependents (array $tasks) { |
|
| 224 | + public function addDependents(array $tasks) { |
|
| 225 | 225 | $this->api->post("{$this}/addDependents", ['dependents' => array_column($tasks, 'gid')]); |
| 226 | 226 | return $this; |
| 227 | 227 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @param User $user |
| 233 | 233 | * @return $this |
| 234 | 234 | */ |
| 235 | - public function addFollower (User $user) { |
|
| 235 | + public function addFollower(User $user) { |
|
| 236 | 236 | return $this->addFollowers([$user]); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param User[] $users |
| 245 | 245 | * @return $this |
| 246 | 246 | */ |
| 247 | - public function addFollowers (array $users) { |
|
| 247 | + public function addFollowers(array $users) { |
|
| 248 | 248 | return $this->_addWithPost("{$this}/addFollowers", [ |
| 249 | 249 | 'followers' => array_column($users, 'gid') |
| 250 | 250 | ], 'followers', $users); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param Tag $tag |
| 259 | 259 | * @return $this |
| 260 | 260 | */ |
| 261 | - public function addTag (Tag $tag) { |
|
| 261 | + public function addTag(Tag $tag) { |
|
| 262 | 262 | return $this->_addWithPost("{$this}/addTag", [ |
| 263 | 263 | 'tag' => $tag->getGid() |
| 264 | 264 | ], 'tags', [$tag]); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param Section $section |
| 275 | 275 | * @return $this |
| 276 | 276 | */ |
| 277 | - public function addToProject (Section $section) { |
|
| 277 | + public function addToProject(Section $section) { |
|
| 278 | 278 | /** @var Membership $membership */ |
| 279 | 279 | $membership = $this->api->factory($this, Membership::class) |
| 280 | 280 | ->_set('project', $section->getProject()) |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @param string $target |
| 290 | 290 | * @return TaskWebhook |
| 291 | 291 | */ |
| 292 | - public function addWebhook (string $target) { |
|
| 292 | + public function addWebhook(string $target) { |
|
| 293 | 293 | /** @var TaskWebhook $webhook */ |
| 294 | 294 | $webhook = $this->api->factory($this, TaskWebhook::class); |
| 295 | 295 | return $webhook->create($this, $target); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | /** |
| 299 | 299 | * @return $this |
| 300 | 300 | */ |
| 301 | - public function create () { |
|
| 301 | + public function create() { |
|
| 302 | 302 | $this->_create(); |
| 303 | 303 | $this->_onSave(); |
| 304 | 304 | return $this; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param string[] $include |
| 315 | 315 | * @return Job |
| 316 | 316 | */ |
| 317 | - public function duplicate (string $name, array $include) { |
|
| 317 | + public function duplicate(string $name, array $include) { |
|
| 318 | 318 | /** @var array $remote */ |
| 319 | 319 | $remote = $this->api->post("{$this}/duplicate", [ |
| 320 | 320 | 'name' => $name, |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @depends after-create |
| 330 | 330 | * @return Attachment[] |
| 331 | 331 | */ |
| 332 | - public function getAttachments () { |
|
| 332 | + public function getAttachments() { |
|
| 333 | 333 | return $this->api->loadAll($this, Attachment::class, "{$this}/attachments"); |
| 334 | 334 | } |
| 335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * @depends after-create |
| 338 | 338 | * @return Story[] |
| 339 | 339 | */ |
| 340 | - public function getComments () { |
|
| 340 | + public function getComments() { |
|
| 341 | 341 | return $this->selectStories(function(Story $story) { |
| 342 | 342 | return $story->isComment(); |
| 343 | 343 | }); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @depends after-create |
| 350 | 350 | * @return Task[] |
| 351 | 351 | */ |
| 352 | - public function getDependencies () { |
|
| 352 | + public function getDependencies() { |
|
| 353 | 353 | return $this->api->loadAll($this, self::class, "{$this}/dependencies"); |
| 354 | 354 | } |
| 355 | 355 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @depends after-create |
| 360 | 360 | * @return Task[] |
| 361 | 361 | */ |
| 362 | - public function getDependents () { |
|
| 362 | + public function getDependents() { |
|
| 363 | 363 | return $this->api->loadAll($this, self::class, "{$this}/dependents"); |
| 364 | 364 | } |
| 365 | 365 | |
@@ -374,21 +374,21 @@ discard block |
||
| 374 | 374 | * |
| 375 | 375 | * @return External |
| 376 | 376 | */ |
| 377 | - public function getExternal () { |
|
| 377 | + public function getExternal() { |
|
| 378 | 378 | return $this->_get('external') ?? $this->data['external'] = $this->api->factory($this, External::class); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | 382 | * @return Project[] |
| 383 | 383 | */ |
| 384 | - public function getProjects () { |
|
| 384 | + public function getProjects() { |
|
| 385 | 385 | return array_column($this->getMemberships(), 'project'); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
| 389 | 389 | * @return Section[] |
| 390 | 390 | */ |
| 391 | - public function getSections () { |
|
| 391 | + public function getSections() { |
|
| 392 | 392 | return array_column($this->getMemberships(), 'section'); |
| 393 | 393 | } |
| 394 | 394 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * @depends after-create |
| 397 | 397 | * @return Story[] |
| 398 | 398 | */ |
| 399 | - public function getStories () { |
|
| 399 | + public function getStories() { |
|
| 400 | 400 | return $this->api->loadAll($this, Story::class, "{$this}/stories"); |
| 401 | 401 | } |
| 402 | 402 | |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | * @depends after-create |
| 405 | 405 | * @return Task[] |
| 406 | 406 | */ |
| 407 | - public function getSubTasks () { |
|
| 407 | + public function getSubTasks() { |
|
| 408 | 408 | return $this->api->loadAll($this, self::class, "{$this}/subtasks"); |
| 409 | 409 | } |
| 410 | 410 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @depends after-create |
| 413 | 413 | * @return string |
| 414 | 414 | */ |
| 415 | - public function getUrl (): string { |
|
| 415 | + public function getUrl(): string { |
|
| 416 | 416 | return "https://app.asana.com/0/0/{$this->getGid()}"; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | * @depends after-create |
| 421 | 421 | * @return TaskWebhook[] |
| 422 | 422 | */ |
| 423 | - public function getWebhooks () { |
|
| 423 | + public function getWebhooks() { |
|
| 424 | 424 | return $this->api->loadAll($this, TaskWebhook::class, 'webhooks', [ |
| 425 | 425 | 'workspace' => $this->getWorkspace()->getGid(), |
| 426 | 426 | 'resource' => $this->getGid() |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @depends after-create |
| 434 | 434 | * @return Story |
| 435 | 435 | */ |
| 436 | - public function newComment () { |
|
| 436 | + public function newComment() { |
|
| 437 | 437 | return $this->api->factory($this, Story::class, [ |
| 438 | 438 | 'resource_subtype' => Story::TYPE_COMMENT_ADDED, |
| 439 | 439 | 'target' => $this |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * @depends after-create |
| 447 | 447 | * @return Task |
| 448 | 448 | */ |
| 449 | - public function newSubTask () { |
|
| 449 | + public function newSubTask() { |
|
| 450 | 450 | /** @var Task $sub */ |
| 451 | 451 | $sub = $this->api->factory($this, self::class); |
| 452 | 452 | return $sub->setParent($this); |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * @param Task[] $tasks |
| 460 | 460 | * @return $this |
| 461 | 461 | */ |
| 462 | - public function removeDependencies (array $tasks) { |
|
| 462 | + public function removeDependencies(array $tasks) { |
|
| 463 | 463 | $this->api->post("{$this}/removeDependencies", ['dependencies' => array_column($tasks, 'gid')]); |
| 464 | 464 | return $this; |
| 465 | 465 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @param Task $task |
| 472 | 472 | * @return $this |
| 473 | 473 | */ |
| 474 | - public function removeDependency (Task $task) { |
|
| 474 | + public function removeDependency(Task $task) { |
|
| 475 | 475 | return $this->removeDependencies([$task]); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | * @param Task $task |
| 483 | 483 | * @return $this |
| 484 | 484 | */ |
| 485 | - public function removeDependent (Task $task) { |
|
| 485 | + public function removeDependent(Task $task) { |
|
| 486 | 486 | return $this->removeDependents([$task]); |
| 487 | 487 | } |
| 488 | 488 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param Task[] $tasks |
| 494 | 494 | * @return $this |
| 495 | 495 | */ |
| 496 | - public function removeDependents (array $tasks) { |
|
| 496 | + public function removeDependents(array $tasks) { |
|
| 497 | 497 | $this->api->post("{$this}/removeDependents", ['dependents' => array_column($tasks, 'gid')]); |
| 498 | 498 | return $this; |
| 499 | 499 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * @param User $user |
| 505 | 505 | * @return $this |
| 506 | 506 | */ |
| 507 | - public function removeFollower (User $user) { |
|
| 507 | + public function removeFollower(User $user) { |
|
| 508 | 508 | return $this->removeFollowers([$user]); |
| 509 | 509 | } |
| 510 | 510 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | * @param User[] $users |
| 517 | 517 | * @return $this |
| 518 | 518 | */ |
| 519 | - public function removeFollowers (array $users) { |
|
| 519 | + public function removeFollowers(array $users) { |
|
| 520 | 520 | return $this->_removeWithPost("{$this}/removeFollowers", [ |
| 521 | 521 | 'followers' => array_column($users, 'gid') |
| 522 | 522 | ], 'followers', $users); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | * @param Project $project |
| 531 | 531 | * @return $this |
| 532 | 532 | */ |
| 533 | - public function removeFromProject (Project $project) { |
|
| 533 | + public function removeFromProject(Project $project) { |
|
| 534 | 534 | return $this->_removeWithPost("{$this}/removeProject", [ |
| 535 | 535 | 'project' => $project->getGid() |
| 536 | 536 | ], 'memberships', function(Membership $membership) use ($project) { |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | * @param Tag $tag |
| 547 | 547 | * @return $this |
| 548 | 548 | */ |
| 549 | - public function removeTag (Tag $tag) { |
|
| 549 | + public function removeTag(Tag $tag) { |
|
| 550 | 550 | return $this->_removeWithPost("{$this}/removeTag", [ |
| 551 | 551 | 'tag' => $tag->getGid() |
| 552 | 552 | ], 'tags', [$tag]); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @param null|Task $parent |
| 560 | 560 | * @return $this |
| 561 | 561 | */ |
| 562 | - public function setParent (?self $parent) { |
|
| 562 | + public function setParent(?self $parent) { |
|
| 563 | 563 | return $this->_setWithPost("{$this}/setParent", [ |
| 564 | 564 | 'parent' => $parent |
| 565 | 565 | ], 'parent', $parent); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | /** |
| 569 | 569 | * @return $this |
| 570 | 570 | */ |
| 571 | - public function update () { |
|
| 571 | + public function update() { |
|
| 572 | 572 | $this->_update(); |
| 573 | 573 | $this->_onSave(); |
| 574 | 574 | return $this; |