@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @return CustomField[] |
| 17 | 17 | */ |
| 18 | - public function getCustomFields () { |
|
| 18 | + public function getCustomFields() { |
|
| 19 | 19 | return array_map(function(FieldSetting $setting) { |
| 20 | 20 | return $setting->getCustomField(); |
| 21 | 21 | }, $this->getCustomFieldSettings()); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param callable $filter `fn( CustomField $field ): bool` |
| 26 | 26 | * @return CustomField[] |
| 27 | 27 | */ |
| 28 | - public function selectCustomFields (callable $filter) { |
|
| 28 | + public function selectCustomFields(callable $filter) { |
|
| 29 | 29 | return $this->{'_select'}($this->getCustomFields(), $filter); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | 'organization' => Workspace::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "organization_exports/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - final protected function _getDir (): string { |
|
| 40 | + final protected function _getDir(): string { |
|
| 41 | 41 | return "organization_exports"; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param Workspace $organization |
| 46 | 46 | * @return $this |
| 47 | 47 | */ |
| 48 | - public function create (Workspace $organization) { |
|
| 48 | + public function create(Workspace $organization) { |
|
| 49 | 49 | $this->_set('organization', $organization); |
| 50 | 50 | return $this->_create(); |
| 51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return bool |
| 57 | 57 | */ |
| 58 | - final public function isActive (): bool { |
|
| 58 | + final public function isActive(): bool { |
|
| 59 | 59 | return $this->getState() === self::STATE_ACTIVE; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return bool |
| 66 | 66 | */ |
| 67 | - final public function isDone (): bool { |
|
| 67 | + final public function isDone(): bool { |
|
| 68 | 68 | return $this->isSuccessful() or $this->isFailed(); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return bool |
| 75 | 75 | */ |
| 76 | - final public function isFailed (): bool { |
|
| 76 | + final public function isFailed(): bool { |
|
| 77 | 77 | return $this->getState() === self::STATE_FAIL; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | - final public function isQueued (): bool { |
|
| 85 | + final public function isQueued(): bool { |
|
| 86 | 86 | return $this->getState() === self::STATE_QUEUED; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return bool |
| 93 | 93 | */ |
| 94 | - final public function isSuccessful (): bool { |
|
| 94 | + final public function isSuccessful(): bool { |
|
| 95 | 95 | return $this->getState() === self::STATE_SUCCESS; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param callable $spinner `fn( OrganizationExport $this ): void` |
| 104 | 104 | * @return $this |
| 105 | 105 | */ |
| 106 | - public function wait (callable $spinner = null) { |
|
| 106 | + public function wait(callable $spinner = null) { |
|
| 107 | 107 | while (!$this->isDone()) { |
| 108 | 108 | if ($spinner) { |
| 109 | 109 | call_user_func($spinner, $this); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'new_task' => Task::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "jobs/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - public function isActive (): bool { |
|
| 45 | + public function isActive(): bool { |
|
| 46 | 46 | return $this->getStatus() === self::STATUS_ACTIVE; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function isDone (): bool { |
|
| 54 | + public function isDone(): bool { |
|
| 55 | 55 | return $this->isSuccessful() or $this->isFailed(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function isDuplicatingProject (): bool { |
|
| 58 | + final public function isDuplicatingProject(): bool { |
|
| 59 | 59 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_PROJECT; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final public function isDuplicatingTask (): bool { |
|
| 62 | + final public function isDuplicatingTask(): bool { |
|
| 63 | 63 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_TASK; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool |
| 70 | 70 | */ |
| 71 | - public function isFailed (): bool { |
|
| 71 | + public function isFailed(): bool { |
|
| 72 | 72 | return $this->getStatus() === self::STATUS_FAIL; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return bool |
| 79 | 79 | */ |
| 80 | - public function isQueued (): bool { |
|
| 80 | + public function isQueued(): bool { |
|
| 81 | 81 | return $this->getStatus() === self::STATUS_QUEUED; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isSuccessful (): bool { |
|
| 89 | + public function isSuccessful(): bool { |
|
| 90 | 90 | return $this->getStatus() === self::STATUS_SUCCESS; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param callable $spinner `fn( Job $this ): void` |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function wait (callable $spinner = null) { |
|
| 101 | + public function wait(callable $spinner = null) { |
|
| 102 | 102 | while (!$this->isDone()) { |
| 103 | 103 | if ($spinner) { |
| 104 | 104 | call_user_func($spinner, $this); |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * @param Project $project |
| 51 | 51 | * @param array $data |
| 52 | 52 | */ |
| 53 | - public function __construct (Project $project, array $data = []) { |
|
| 53 | + public function __construct(Project $project, array $data = []) { |
|
| 54 | 54 | parent::__construct($project, $data); |
| 55 | 55 | $this->project = $project; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function __toString (): string { |
|
| 58 | + final public function __toString(): string { |
|
| 59 | 59 | return "project_statuses/{$this->getGid()}"; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final protected function _getDir (): string { |
|
| 62 | + final protected function _getDir(): string { |
|
| 63 | 63 | return "{$this->project}/project_statuses"; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function _setData (array $data): void { |
|
| 66 | + protected function _setData(array $data): void { |
|
| 67 | 67 | // redundant, prefer created_by |
| 68 | 68 | unset($data['author']); |
| 69 | 69 | parent::_setData($data); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return Project |
| 74 | 74 | */ |
| 75 | - public function getProject () { |
|
| 75 | + public function getProject() { |
|
| 76 | 76 | return $this->project; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -33,25 +33,25 @@ |
||
| 33 | 33 | 'workspace' => Workspace::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "tags/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - final protected function _getDir (): string { |
|
| 40 | + final protected function _getDir(): string { |
|
| 41 | 41 | return 'tags'; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @return Traversable|Task[] |
| 46 | 46 | */ |
| 47 | - public function getIterator () { |
|
| 47 | + public function getIterator() { |
|
| 48 | 48 | return $this->_loadEach(Task::class, "{$this}/tasks"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @return Task[] |
| 53 | 53 | */ |
| 54 | - public function getTasks () { |
|
| 54 | + public function getTasks() { |
|
| 55 | 55 | return iterator_to_array($this); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param Api|Data $caller |
| 49 | 49 | * @param array $data |
| 50 | 50 | */ |
| 51 | - public function __construct ($caller, array $data = []) { |
|
| 51 | + public function __construct($caller, array $data = []) { |
|
| 52 | 52 | $this->api = $caller instanceof self ? $caller->api : $caller; |
| 53 | 53 | $this->_setData($data); |
| 54 | 54 | } |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | * @param array $args |
| 65 | 65 | * @return mixed |
| 66 | 66 | */ |
| 67 | - public function __call (string $method, array $args) { |
|
| 67 | + public function __call(string $method, array $args) { |
|
| 68 | 68 | static $cache = []; |
| 69 | - if (!$call =& $cache[$method]) { |
|
| 69 | + if (!$call = & $cache[$method]) { |
|
| 70 | 70 | preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call); |
| 71 | 71 | $call[1] = '_' . $call[1]; |
| 72 | 72 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return $this->{$call[1]}($call[2], ...$args); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function __debugInfo (): array { |
|
| 79 | + public function __debugInfo(): array { |
|
| 80 | 80 | return $this->data; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param $field |
| 87 | 87 | * @return null|Data|mixed |
| 88 | 88 | */ |
| 89 | - final public function __get ($field) { |
|
| 89 | + final public function __get($field) { |
|
| 90 | 90 | return $this->_get($field); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param $field |
| 99 | 99 | * @return bool |
| 100 | 100 | */ |
| 101 | - final public function __isset ($field) { |
|
| 101 | + final public function __isset($field) { |
|
| 102 | 102 | return true; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $data |
| 110 | 110 | * @return mixed|Data|AbstractEntity |
| 111 | 111 | */ |
| 112 | - final protected function _factory (string $class, array $data = []) { |
|
| 112 | + final protected function _factory(string $class, array $data = []) { |
|
| 113 | 113 | return $this->api->factory($class, $this, $data); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param string $field |
| 122 | 122 | * @return mixed |
| 123 | 123 | */ |
| 124 | - protected function _get (string $field) { |
|
| 124 | + protected function _get(string $field) { |
|
| 125 | 125 | return $this->data[$field] ?? null; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param string $field |
| 137 | 137 | * @return bool |
| 138 | 138 | */ |
| 139 | - protected function _has (string $field): bool { |
|
| 139 | + protected function _has(string $field): bool { |
|
| 140 | 140 | $value = $this->_get($field); |
| 141 | 141 | if (isset($value)) { |
| 142 | 142 | if (is_countable($value)) { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string $field |
| 160 | 160 | * @return bool |
| 161 | 161 | */ |
| 162 | - protected function _is (string $field): bool { |
|
| 162 | + protected function _is(string $field): bool { |
|
| 163 | 163 | return (bool)$this->_get($field); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param array $query |
| 174 | 174 | * @return null|mixed|AbstractEntity |
| 175 | 175 | */ |
| 176 | - final protected function _load (string $class, string $path, array $query = []) { |
|
| 176 | + final protected function _load(string $class, string $path, array $query = []) { |
|
| 177 | 177 | return $this->api->load($class, $this, $path, $query); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @param int $pages |
| 189 | 189 | * @return array|AbstractEntity[] |
| 190 | 190 | */ |
| 191 | - final protected function _loadAll (string $class, string $path, array $query = [], int $pages = 0) { |
|
| 191 | + final protected function _loadAll(string $class, string $path, array $query = [], int $pages = 0) { |
|
| 192 | 192 | return $this->api->loadAll($class, $this, $path, $query, $pages); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param int $pages |
| 204 | 204 | * @return Traversable|AbstractEntity[] |
| 205 | 205 | */ |
| 206 | - final protected function _loadEach (string $class, string $path, array $query = [], int $pages = 0) { |
|
| 206 | + final protected function _loadEach(string $class, string $path, array $query = [], int $pages = 0) { |
|
| 207 | 207 | return $this->api->loadEach($class, $this, $path, $query, $pages); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param callable $filter `fn( Data $object ): bool` |
| 219 | 219 | * @return array |
| 220 | 220 | */ |
| 221 | - protected function _select ($subject, callable $filter) { |
|
| 221 | + protected function _select($subject, callable $filter) { |
|
| 222 | 222 | if (!is_iterable($subject)) { |
| 223 | 223 | $subject = $this->_get($subject) ?? []; |
| 224 | 224 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param mixed $value |
| 241 | 241 | * @return $this |
| 242 | 242 | */ |
| 243 | - protected function _set (string $field, $value) { |
|
| 243 | + protected function _set(string $field, $value) { |
|
| 244 | 244 | $this->data[$field] = $value; |
| 245 | 245 | $this->diff[$field] = true; |
| 246 | 246 | return $this; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @param array $data |
| 253 | 253 | */ |
| 254 | - protected function _setData (array $data): void { |
|
| 254 | + protected function _setData(array $data): void { |
|
| 255 | 255 | $this->data = $this->diff = []; |
| 256 | 256 | foreach ($data as $field => $value) { |
| 257 | 257 | $this->_setMapped($field, $value); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param string $field |
| 265 | 265 | * @param mixed $value |
| 266 | 266 | */ |
| 267 | - protected function _setMapped (string $field, $value): void { |
|
| 267 | + protected function _setMapped(string $field, $value): void { |
|
| 268 | 268 | unset($this->diff[$field]); |
| 269 | 269 | |
| 270 | 270 | // use value as-is? |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @return array |
| 312 | 312 | */ |
| 313 | - public function getDiff (): array { |
|
| 313 | + public function getDiff(): array { |
|
| 314 | 314 | $convert = function($each) use (&$convert) { |
| 315 | 315 | // convert existing entities to gids |
| 316 | 316 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @param string null $field |
| 337 | 337 | * @return bool |
| 338 | 338 | */ |
| 339 | - final public function isDiff (string $field = null): bool { |
|
| 339 | + final public function isDiff(string $field = null): bool { |
|
| 340 | 340 | if ($field) { |
| 341 | 341 | return isset($this->diff[$field]); |
| 342 | 342 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @see toArray() |
| 348 | 348 | * @return array |
| 349 | 349 | */ |
| 350 | - public function jsonSerialize (): array { |
|
| 350 | + public function jsonSerialize(): array { |
|
| 351 | 351 | $data = $this->toArray(); |
| 352 | 352 | ksort($data); |
| 353 | 353 | return $data; |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @return string |
| 360 | 360 | */ |
| 361 | - public function serialize (): string { |
|
| 362 | - return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
| 361 | + public function serialize(): string { |
|
| 362 | + return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * |
| 368 | 368 | * @return array |
| 369 | 369 | */ |
| 370 | - public function toArray (): array { |
|
| 370 | + public function toArray(): array { |
|
| 371 | 371 | return array_map($dehydrate = function($each) use (&$dehydrate) { |
| 372 | 372 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
| 373 | 373 | return $each->getGid(); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | * |
| 388 | 388 | * @param $serialized |
| 389 | 389 | */ |
| 390 | - public function unserialize ($serialized): void { |
|
| 390 | + public function unserialize($serialized): void { |
|
| 391 | 391 | $this->api = Api::getDefault(); |
| 392 | 392 | $data = json_decode($serialized, true); |
| 393 | 393 | $this->_setData($data); |
@@ -315,8 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | if ($isList) { |
| 317 | 317 | $this->data[$field] = array_map($hydrate, $value); |
| 318 | - } |
|
| 319 | - else { |
|
| 318 | + } else { |
|
| 320 | 319 | $this->data[$field] = $hydrate($value); |
| 321 | 320 | } |
| 322 | 321 | } |
@@ -387,11 +386,9 @@ discard block |
||
| 387 | 386 | return array_map($dehydrate = function($each) use (&$dehydrate) { |
| 388 | 387 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
| 389 | 388 | return $each->getGid(); |
| 390 | - } |
|
| 391 | - elseif ($each instanceof self) { |
|
| 389 | + } elseif ($each instanceof self) { |
|
| 392 | 390 | return $each->toArray(); |
| 393 | - } |
|
| 394 | - elseif (is_array($each)) { |
|
| 391 | + } elseif (is_array($each)) { |
|
| 395 | 392 | return array_map($dehydrate, $each); |
| 396 | 393 | } |
| 397 | 394 | return $each; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | 'workspace' => Workspace::class |
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | - final public function __toString (): string { |
|
| 55 | + final public function __toString(): string { |
|
| 56 | 56 | return "portfolios/{$this->getGid()}"; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - final protected function _getDir (): string { |
|
| 59 | + final protected function _getDir(): string { |
|
| 60 | 60 | return 'portfolios'; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param Project $item |
| 66 | 66 | * @return $this |
| 67 | 67 | */ |
| 68 | - public function addItem (Project $item) { |
|
| 68 | + public function addItem(Project $item) { |
|
| 69 | 69 | $this->api->post("{$this}/addItem", ['item' => $item->getGid()]); |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param User $user |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - public function addMember (User $user) { |
|
| 77 | + public function addMember(User $user) { |
|
| 78 | 78 | return $this->addMembers([$user]); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param User[] $users |
| 83 | 83 | * @return $this |
| 84 | 84 | */ |
| 85 | - public function addMembers (array $users) { |
|
| 85 | + public function addMembers(array $users) { |
|
| 86 | 86 | return $this->_addWithPost("{$this}/addMembers", [ |
| 87 | 87 | 'members' => array_column($users, 'gid') |
| 88 | 88 | ], 'members', $users); |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | * @depends after-create |
| 93 | 93 | * @return Project[] |
| 94 | 94 | */ |
| 95 | - public function getItems () { |
|
| 95 | + public function getItems() { |
|
| 96 | 96 | return iterator_to_array($this); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * @return Traversable|Project[] |
| 101 | 101 | */ |
| 102 | - public function getIterator () { |
|
| 102 | + public function getIterator() { |
|
| 103 | 103 | return $this->_loadEach(Project::class, "{$this}/items"); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param Project $item |
| 109 | 109 | * @return $this |
| 110 | 110 | */ |
| 111 | - public function removeItem (Project $item) { |
|
| 111 | + public function removeItem(Project $item) { |
|
| 112 | 112 | $this->api->post("{$this}/removeItem", ['item' => $item->getGid()]); |
| 113 | 113 | return $this; |
| 114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param User $user |
| 118 | 118 | * @return $this |
| 119 | 119 | */ |
| 120 | - public function removeMember (User $user) { |
|
| 120 | + public function removeMember(User $user) { |
|
| 121 | 121 | return $this->removeMembers([$user]); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param User[] $users |
| 126 | 126 | * @return $this |
| 127 | 127 | */ |
| 128 | - public function removeMembers (array $users) { |
|
| 128 | + public function removeMembers(array $users) { |
|
| 129 | 129 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 130 | 130 | 'members' => array_column($users, 'gid') |
| 131 | 131 | ], 'members', $users); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param callable $filter `fn( Project $project ): bool` |
| 136 | 136 | * @return Project[] |
| 137 | 137 | */ |
| 138 | - public function selectItems (callable $filter) { |
|
| 138 | + public function selectItems(callable $filter) { |
|
| 139 | 139 | return $this->_select($this, $filter); |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'workspaces' => [Workspace::class] |
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | - final public function __toString (): string { |
|
| 31 | + final public function __toString(): string { |
|
| 32 | 32 | return "users/{$this->getGid()}"; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param Workspace $workspace |
| 37 | 37 | * @return $this |
| 38 | 38 | */ |
| 39 | - public function addToWorkspace (Workspace $workspace) { |
|
| 39 | + public function addToWorkspace(Workspace $workspace) { |
|
| 40 | 40 | return $this->_addWithPost("{$workspace}/addUser", [ |
| 41 | 41 | 'user' => $this->getGid() |
| 42 | 42 | ], 'workspaces', [$workspace]); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @return string[] |
| 47 | 47 | */ |
| 48 | - public function getCacheKeys () { |
|
| 48 | + public function getCacheKeys() { |
|
| 49 | 49 | $keys = parent::getCacheKeys(); |
| 50 | 50 | |
| 51 | 51 | // only include email as a key if it's loaded |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return Workspace |
| 64 | 64 | */ |
| 65 | - public function getDefaultWorkspace () { |
|
| 65 | + public function getDefaultWorkspace() { |
|
| 66 | 66 | return $this->getWorkspaces()[0]; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 71 | 71 | * @return Portfolio[] |
| 72 | 72 | */ |
| 73 | - public function getFavoritePortfolios (Workspace $workspace = null) { |
|
| 73 | + public function getFavoritePortfolios(Workspace $workspace = null) { |
|
| 74 | 74 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 79 | 79 | * @return Project[] |
| 80 | 80 | */ |
| 81 | - public function getFavoriteProjects (Workspace $workspace = null) { |
|
| 81 | + public function getFavoriteProjects(Workspace $workspace = null) { |
|
| 82 | 82 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 87 | 87 | * @return Tag[] |
| 88 | 88 | */ |
| 89 | - public function getFavoriteTags (Workspace $workspace = null) { |
|
| 89 | + public function getFavoriteTags(Workspace $workspace = null) { |
|
| 90 | 90 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 95 | 95 | * @return Team[] |
| 96 | 96 | */ |
| 97 | - public function getFavoriteTeams (Workspace $workspace = null) { |
|
| 97 | + public function getFavoriteTeams(Workspace $workspace = null) { |
|
| 98 | 98 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 103 | 103 | * @return User[] |
| 104 | 104 | */ |
| 105 | - public function getFavoriteUsers (Workspace $workspace = null) { |
|
| 105 | + public function getFavoriteUsers(Workspace $workspace = null) { |
|
| 106 | 106 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace = null) { |
|
| 115 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace = null) { |
|
| 116 | 116 | return $this->_loadAll($class, "{$this}/favorites", [ |
| 117 | 117 | 'resource_type' => $resourceType, |
| 118 | 118 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param null|Workspace $workspace |
| 124 | 124 | * @return Portfolio[] |
| 125 | 125 | */ |
| 126 | - public function getPortfolios (Workspace $workspace = null) { |
|
| 126 | + public function getPortfolios(Workspace $workspace = null) { |
|
| 127 | 127 | return $this->_loadAll(Portfolio::class, "portfolios", [ |
| 128 | 128 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid(), |
| 129 | 129 | 'owner' => $this->getGid() |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param null|Workspace $workspace Falls back to the default workspace. |
| 135 | 135 | * @return TaskList |
| 136 | 136 | */ |
| 137 | - public function getTaskList (Workspace $workspace = null) { |
|
| 137 | + public function getTaskList(Workspace $workspace = null) { |
|
| 138 | 138 | return $this->_load(TaskList::class, "{$this}/user_task_list", [ |
| 139 | 139 | 'workspace' => ($workspace ?? $this->getDefaultWorkspace())->getGid() |
| 140 | 140 | ]); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param string[] $filter `workspace` falls back to the default. |
| 147 | 147 | * @return Task[] |
| 148 | 148 | */ |
| 149 | - public function getTasks (array $filter = []) { |
|
| 149 | + public function getTasks(array $filter = []) { |
|
| 150 | 150 | $filter['assignee'] = $this->getGid(); |
| 151 | 151 | $filter += ['workspace' => $this->getDefaultWorkspace()->getGid()]; |
| 152 | 152 | return $this->_loadAll(Task::class, 'tasks', $filter); |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | * @param null|Workspace $organization Falls back to the default workspace. |
| 161 | 161 | * @return Team[] |
| 162 | 162 | */ |
| 163 | - public function getTeams (Workspace $organization = null) { |
|
| 163 | + public function getTeams(Workspace $organization = null) { |
|
| 164 | 164 | return $this->_loadAll(Team::class, "{$this}/teams", [ |
| 165 | 165 | 'organization' => ($organization ?? $this->getDefaultWorkspace())->getGid() |
| 166 | 166 | ]); |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function getUrl (): string { |
|
| 169 | + public function getUrl(): string { |
|
| 170 | 170 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param Workspace $workspace |
| 175 | 175 | * @return $this |
| 176 | 176 | */ |
| 177 | - public function removeFromWorkspace (Workspace $workspace) { |
|
| 177 | + public function removeFromWorkspace(Workspace $workspace) { |
|
| 178 | 178 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
| 179 | 179 | 'user' => $this->getGid() |
| 180 | 180 | ], 'workspaces', [$workspace]); |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | 'enum_options' => [EnumOption::class], |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | - final public function __toString (): string { |
|
| 43 | + final public function __toString(): string { |
|
| 44 | 44 | return "custom_fields/{$this->getGid()}"; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - final protected function _getDir (): string { |
|
| 47 | + final protected function _getDir(): string { |
|
| 48 | 48 | return 'custom_fields'; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $name |
| 57 | 57 | * @return EnumOption |
| 58 | 58 | */ |
| 59 | - public function addEnumOption (string $name) { |
|
| 59 | + public function addEnumOption(string $name) { |
|
| 60 | 60 | /** @var EnumOption $option */ |
| 61 | 61 | $option = $this->_factory(EnumOption::class); |
| 62 | 62 | $option->setName($name); |
@@ -72,35 +72,35 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return bool |
| 74 | 74 | */ |
| 75 | - public function hasNotificationsEnabled (): bool { |
|
| 75 | + public function hasNotificationsEnabled(): bool { |
|
| 76 | 76 | return $this->_is('has_notifications_enabled'); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - final public function isEnum (): bool { |
|
| 82 | + final public function isEnum(): bool { |
|
| 83 | 83 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isGlobalToWorkspace (): bool { |
|
| 89 | + public function isGlobalToWorkspace(): bool { |
|
| 90 | 90 | return $this->_is('is_global_to_workspace'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @return bool |
| 95 | 95 | */ |
| 96 | - final public function isNumber (): bool { |
|
| 96 | + final public function isNumber(): bool { |
|
| 97 | 97 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - final public function isText (): bool { |
|
| 103 | + final public function isText(): bool { |
|
| 104 | 104 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param bool $flag |
| 109 | 109 | * @return $this |
| 110 | 110 | */ |
| 111 | - public function setGlobalToWorkspace (bool $flag) { |
|
| 111 | + public function setGlobalToWorkspace(bool $flag) { |
|
| 112 | 112 | return $this->_set('is_global_to_workspace', $flag); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param bool $flag |
| 117 | 117 | * @return $this |
| 118 | 118 | */ |
| 119 | - public function setNotificationsEnabled (bool $flag) { |
|
| 119 | + public function setNotificationsEnabled(bool $flag) { |
|
| 120 | 120 | return $this->_set('has_notifications_enabled', $flag); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
| 125 | 125 | * @return $this |
| 126 | 126 | */ |
| 127 | - public function sortEnumOptions (callable $cmp) { |
|
| 127 | + public function sortEnumOptions(callable $cmp) { |
|
| 128 | 128 | if ($options = $this->getEnumOptions()) { |
| 129 | 129 | $prev = $options[0]; // first option on remote |
| 130 | 130 | usort($options, $cmp); |