@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | - abstract public function __toString (): string; |
|
| 28 | + abstract public function __toString(): string; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Maps lazy-loaded / reloadable mapped {@see Data} to their proper expanded field expression. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param AbstractEntity $entity |
| 46 | 46 | * @internal |
| 47 | 47 | */ |
| 48 | - public function __set (string $from, self $entity) { |
|
| 48 | + public function __set(string $from, self $entity) { |
|
| 49 | 49 | if ($from === Cache::class and $entity !== $this) { |
| 50 | 50 | foreach ($entity->data as $field => $value) { |
| 51 | 51 | if (!isset($this->diff[$field])) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return $this |
| 64 | 64 | * @internal |
| 65 | 65 | */ |
| 66 | - protected function _addWithPost (string $addPath, array $data, string $field, array $diff) { |
|
| 66 | + protected function _addWithPost(string $addPath, array $data, string $field, array $diff) { |
|
| 67 | 67 | if ($this->hasGid()) { |
| 68 | 68 | return $this->_setWithPost($addPath, $data, $field); |
| 69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @internal |
| 77 | 77 | */ |
| 78 | - protected function _cache (): void { |
|
| 78 | + protected function _cache(): void { |
|
| 79 | 79 | $this->api->getCache()->add($this); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @internal |
| 86 | 86 | */ |
| 87 | - protected function _delete (): void { |
|
| 87 | + protected function _delete(): void { |
|
| 88 | 88 | $this->api->delete($this); |
| 89 | 89 | $this->api->getCache()->remove($this); |
| 90 | 90 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param string $field |
| 96 | 96 | * @return mixed |
| 97 | 97 | */ |
| 98 | - protected function _get (string $field) { |
|
| 98 | + protected function _get(string $field) { |
|
| 99 | 99 | if (!array_key_exists($field, $this->data) and isset($this->data['gid'])) { |
| 100 | 100 | $this->reload($field); |
| 101 | 101 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return $this |
| 111 | 111 | * @internal |
| 112 | 112 | */ |
| 113 | - protected function _removeWithPost (string $rmPath, array $data, string $field, $diff) { |
|
| 113 | + protected function _removeWithPost(string $rmPath, array $data, string $field, $diff) { |
|
| 114 | 114 | if ($this->hasGid()) { |
| 115 | 115 | return $this->_setWithPost($rmPath, $data, $field); |
| 116 | 116 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return $this |
| 128 | 128 | * @internal |
| 129 | 129 | */ |
| 130 | - protected function _save (string $dir = null) { |
|
| 130 | + protected function _save(string $dir = null) { |
|
| 131 | 131 | if (isset($dir)) { |
| 132 | 132 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
| 133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return $this; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - protected function _setData (array $data): void { |
|
| 146 | + protected function _setData(array $data): void { |
|
| 147 | 147 | // the resource type is constant. there's no need to keep it per-instance. |
| 148 | 148 | unset($data['resource_type']); |
| 149 | 149 | parent::_setData($data); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @return $this |
| 160 | 160 | * @internal |
| 161 | 161 | */ |
| 162 | - protected function _setWithPost (string $path, array $data, string $field, $value = null) { |
|
| 162 | + protected function _setWithPost(string $path, array $data, string $field, $value = null) { |
|
| 163 | 163 | if ($this->hasGid()) { |
| 164 | 164 | /** @var array $remote */ |
| 165 | 165 | $remote = $this->api->post($path, $data, ['fields' => static::$optFields[$field] ?? $field]); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return string[] |
| 179 | 179 | */ |
| 180 | - public function getCacheKeys () { |
|
| 180 | + public function getCacheKeys() { |
|
| 181 | 181 | return [$this->getGid(), (string)$this]; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | - final public function getResourceType (): string { |
|
| 189 | + final public function getResourceType(): string { |
|
| 190 | 190 | return $this::TYPE; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param string $field |
| 198 | 198 | * @return $this |
| 199 | 199 | */ |
| 200 | - public function reload (string $field = null) { |
|
| 200 | + public function reload(string $field = null) { |
|
| 201 | 201 | if (!$this->hasGid()) { |
| 202 | 202 | throw new LogicException(static::class . " has no GID, it can't be reloaded."); |
| 203 | 203 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param Api|Data $caller |
| 48 | 48 | * @param array $data |
| 49 | 49 | */ |
| 50 | - public function __construct ($caller, array $data = []) { |
|
| 50 | + public function __construct($caller, array $data = []) { |
|
| 51 | 51 | $this->api = $caller instanceof self ? $caller->api : $caller; |
| 52 | 52 | $this->_setData($data); |
| 53 | 53 | } |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | * @param array $args |
| 64 | 64 | * @return mixed |
| 65 | 65 | */ |
| 66 | - public function __call (string $method, array $args) { |
|
| 66 | + public function __call(string $method, array $args) { |
|
| 67 | 67 | static $cache = []; |
| 68 | - if (!$call =& $cache[$method]) { |
|
| 68 | + if (!$call = & $cache[$method]) { |
|
| 69 | 69 | preg_match('/^(get|has|is|select|set)(.+)$/', $method, $call); |
| 70 | 70 | $call[1] = '_' . $call[1]; |
| 71 | 71 | $call[2] = preg_replace_callback('/[A-Z]/', function(array $match) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return $this->{$call[1]}($call[2], ...$args); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function __debugInfo (): array { |
|
| 78 | + public function __debugInfo(): array { |
|
| 79 | 79 | return $this->data; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param $field |
| 86 | 86 | * @return null|Data|mixed |
| 87 | 87 | */ |
| 88 | - final public function __get ($field) { |
|
| 88 | + final public function __get($field) { |
|
| 89 | 89 | return $this->_get($field); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param $field |
| 98 | 98 | * @return bool |
| 99 | 99 | */ |
| 100 | - final public function __isset ($field) { |
|
| 100 | + final public function __isset($field) { |
|
| 101 | 101 | return true; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $field |
| 110 | 110 | * @return mixed |
| 111 | 111 | */ |
| 112 | - protected function _get (string $field) { |
|
| 112 | + protected function _get(string $field) { |
|
| 113 | 113 | return $this->data[$field] ?? null; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param string $field |
| 124 | 124 | * @return bool |
| 125 | 125 | */ |
| 126 | - protected function _has (string $field): bool { |
|
| 126 | + protected function _has(string $field): bool { |
|
| 127 | 127 | $value = $this->_get($field); |
| 128 | 128 | if (isset($value)) { |
| 129 | 129 | if (is_countable($value)) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param string $field |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - protected function _is (string $field): bool { |
|
| 149 | + protected function _is(string $field): bool { |
|
| 150 | 150 | return !empty($this->_get($field)); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param callable $filter `fn( Data $object ): bool` |
| 162 | 162 | * @return array |
| 163 | 163 | */ |
| 164 | - protected function _select ($subject, callable $filter) { |
|
| 164 | + protected function _select($subject, callable $filter) { |
|
| 165 | 165 | if (!is_array($subject)) { |
| 166 | 166 | $subject = $this->_get($subject) ?? []; |
| 167 | 167 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param mixed $value |
| 178 | 178 | * @return $this |
| 179 | 179 | */ |
| 180 | - protected function _set (string $field, $value) { |
|
| 180 | + protected function _set(string $field, $value) { |
|
| 181 | 181 | $this->data[$field] = $value; |
| 182 | 182 | $this->diff[$field] = true; |
| 183 | 183 | return $this; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @param array $data |
| 190 | 190 | */ |
| 191 | - protected function _setData (array $data): void { |
|
| 191 | + protected function _setData(array $data): void { |
|
| 192 | 192 | $this->data = $this->diff = []; |
| 193 | 193 | foreach ($data as $field => $value) { |
| 194 | 194 | $this->_setMapped($field, $value); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param string $field |
| 202 | 202 | * @param mixed $value |
| 203 | 203 | */ |
| 204 | - protected function _setMapped (string $field, $value): void { |
|
| 204 | + protected function _setMapped(string $field, $value): void { |
|
| 205 | 205 | unset($this->diff[$field]); |
| 206 | 206 | |
| 207 | 207 | // use value as-is? |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @param array $data |
| 250 | 250 | * @return mixed|Data|AbstractEntity |
| 251 | 251 | */ |
| 252 | - final protected function factory (string $class, array $data = []) { |
|
| 252 | + final protected function factory(string $class, array $data = []) { |
|
| 253 | 253 | return $this->api->factory($class, $this, $data); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @return array |
| 260 | 260 | */ |
| 261 | - public function getDiff (): array { |
|
| 261 | + public function getDiff(): array { |
|
| 262 | 262 | $convert = function($each) use (&$convert) { |
| 263 | 263 | // convert existing entities to gids |
| 264 | 264 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @param string null $field |
| 285 | 285 | * @return bool |
| 286 | 286 | */ |
| 287 | - final public function isDiff (string $field = null): bool { |
|
| 287 | + final public function isDiff(string $field = null): bool { |
|
| 288 | 288 | if ($field) { |
| 289 | 289 | return isset($this->diff[$field]); |
| 290 | 290 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @see toArray() |
| 296 | 296 | * @return array |
| 297 | 297 | */ |
| 298 | - public function jsonSerialize (): array { |
|
| 298 | + public function jsonSerialize(): array { |
|
| 299 | 299 | $data = $this->toArray(); |
| 300 | 300 | ksort($data); |
| 301 | 301 | return $data; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param array $query |
| 312 | 312 | * @return null|mixed|AbstractEntity |
| 313 | 313 | */ |
| 314 | - final protected function load (string $class, string $path, array $query = []) { |
|
| 314 | + final protected function load(string $class, string $path, array $query = []) { |
|
| 315 | 315 | return $this->api->load($class, $this, $path, $query); |
| 316 | 316 | } |
| 317 | 317 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @param int $pages |
| 327 | 327 | * @return array|AbstractEntity[] |
| 328 | 328 | */ |
| 329 | - final protected function loadAll (string $class, string $path, array $query = [], int $pages = 0) { |
|
| 329 | + final protected function loadAll(string $class, string $path, array $query = [], int $pages = 0) { |
|
| 330 | 330 | return $this->api->loadAll($class, $this, $path, $query, $pages); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | * |
| 336 | 336 | * @return string |
| 337 | 337 | */ |
| 338 | - public function serialize (): string { |
|
| 339 | - return json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
|
| 338 | + public function serialize(): string { |
|
| 339 | + return json_encode($this, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @return array |
| 346 | 346 | */ |
| 347 | - public function toArray (): array { |
|
| 347 | + public function toArray(): array { |
|
| 348 | 348 | return array_map($dehydrate = function($each) use (&$dehydrate) { |
| 349 | 349 | if ($each instanceof AbstractEntity and $each->hasGid()) { |
| 350 | 350 | return $each->getGid(); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * |
| 365 | 365 | * @param $serialized |
| 366 | 366 | */ |
| 367 | - public function unserialize ($serialized): void { |
|
| 367 | + public function unserialize($serialized): void { |
|
| 368 | 368 | $this->api = Api::getDefault(); |
| 369 | 369 | $data = json_decode($serialized, true); |
| 370 | 370 | $this->_setData($data); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'new_task' => Task::class |
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | - final public function __toString (): string { |
|
| 36 | + final public function __toString(): string { |
|
| 37 | 37 | return "jobs/{$this->getGid()}"; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - public function isActive (): bool { |
|
| 45 | + public function isActive(): bool { |
|
| 46 | 46 | return $this->getStatus() === self::STATUS_ACTIVE; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function isDone (): bool { |
|
| 54 | + public function isDone(): bool { |
|
| 55 | 55 | return $this->isSuccessful() or $this->isFailed(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function isDuplicatingProject (): bool { |
|
| 58 | + final public function isDuplicatingProject(): bool { |
|
| 59 | 59 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_PROJECT; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final public function isDuplicatingTask (): bool { |
|
| 62 | + final public function isDuplicatingTask(): bool { |
|
| 63 | 63 | return $this->getResourceSubtype() === self::TYPE_DUPLICATE_TASK; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool |
| 70 | 70 | */ |
| 71 | - public function isFailed (): bool { |
|
| 71 | + public function isFailed(): bool { |
|
| 72 | 72 | return $this->getStatus() === self::STATUS_FAIL; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return bool |
| 79 | 79 | */ |
| 80 | - public function isQueued (): bool { |
|
| 80 | + public function isQueued(): bool { |
|
| 81 | 81 | return $this->getStatus() === self::STATUS_QUEUED; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isSuccessful (): bool { |
|
| 89 | + public function isSuccessful(): bool { |
|
| 90 | 90 | return $this->getStatus() === self::STATUS_SUCCESS; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param callable $spinner `fn( Job $this ): void` |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function wait (callable $spinner = null) { |
|
| 101 | + public function wait(callable $spinner = null) { |
|
| 102 | 102 | while (!$this->isDone()) { |
| 103 | 103 | if ($spinner) { |
| 104 | 104 | call_user_func($spinner, $this); |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * @param Project $project |
| 51 | 51 | * @param array $data |
| 52 | 52 | */ |
| 53 | - public function __construct (Project $project, array $data = []) { |
|
| 53 | + public function __construct(Project $project, array $data = []) { |
|
| 54 | 54 | parent::__construct($project, $data); |
| 55 | 55 | $this->project = $project; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final public function __toString (): string { |
|
| 58 | + final public function __toString(): string { |
|
| 59 | 59 | return "project_statuses/{$this->getGid()}"; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final protected function _getDir (): string { |
|
| 62 | + final protected function _getDir(): string { |
|
| 63 | 63 | return "{$this->project}/project_statuses"; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function _setData (array $data): void { |
|
| 66 | + protected function _setData(array $data): void { |
|
| 67 | 67 | // redundant, prefer created_by |
| 68 | 68 | unset($data['author']); |
| 69 | 69 | parent::_setData($data); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return Project |
| 74 | 74 | */ |
| 75 | - public function getProject () { |
|
| 75 | + public function getProject() { |
|
| 76 | 76 | return $this->project; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | 'workspace' => Workspace::class |
| 71 | 71 | ]; |
| 72 | 72 | |
| 73 | - final public function __toString (): string { |
|
| 73 | + final public function __toString(): string { |
|
| 74 | 74 | return "projects/{$this->getGid()}"; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - final protected function _getDir (): string { |
|
| 77 | + final protected function _getDir(): string { |
|
| 78 | 78 | return 'projects'; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - protected function _setData (array $data): void { |
|
| 81 | + protected function _setData(array $data): void { |
|
| 82 | 82 | // this is always empty. fields are in the settings, values are in tasks. |
| 83 | 83 | unset($data['custom_fields']); |
| 84 | 84 | parent::_setData($data); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param User $user |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function addMember (User $user) { |
|
| 92 | + public function addMember(User $user) { |
|
| 93 | 93 | return $this->addMembers([$user]); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param User[] $users |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function addMembers (array $users) { |
|
| 101 | + public function addMembers(array $users) { |
|
| 102 | 102 | return $this->_addWithPost("{$this}/addMembers", [ |
| 103 | 103 | 'members' => array_column($users, 'gid') |
| 104 | 104 | ], 'members', $users); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $target |
| 110 | 110 | * @return ProjectWebhook |
| 111 | 111 | */ |
| 112 | - public function addWebhook (string $target) { |
|
| 112 | + public function addWebhook(string $target) { |
|
| 113 | 113 | /** @var ProjectWebhook $webhook */ |
| 114 | 114 | $webhook = $this->factory(ProjectWebhook::class); |
| 115 | 115 | return $webhook->create($this, $target); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param array $schedule |
| 135 | 135 | * @return Job |
| 136 | 136 | */ |
| 137 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 137 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 138 | 138 | $data = ['name' => $name]; |
| 139 | 139 | if ($team) { |
| 140 | 140 | $data['team'] = $team->getGid(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @depends after-create |
| 154 | 154 | * @return Section |
| 155 | 155 | */ |
| 156 | - public function getDefaultSection () { |
|
| 156 | + public function getDefaultSection() { |
|
| 157 | 157 | return $this->loadAll(Section::class, "{$this}/sections", ['limit' => 1])[0]; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param null|string $token |
| 165 | 165 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 166 | 166 | */ |
| 167 | - public function getEvents (&$token) { |
|
| 167 | + public function getEvents(&$token) { |
|
| 168 | 168 | return $this->api->sync($this, $token); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @depends after-create |
| 173 | 173 | * @return Section[] |
| 174 | 174 | */ |
| 175 | - public function getSections () { |
|
| 175 | + public function getSections() { |
|
| 176 | 176 | return $this->loadAll(Section::class, "{$this}/sections"); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @depends after-create |
| 181 | 181 | * @return Status[] |
| 182 | 182 | */ |
| 183 | - public function getStatuses () { |
|
| 183 | + public function getStatuses() { |
|
| 184 | 184 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param array $filter |
| 194 | 194 | * @return Task[] |
| 195 | 195 | */ |
| 196 | - public function getTasks (array $filter = []) { |
|
| 196 | + public function getTasks(array $filter = []) { |
|
| 197 | 197 | $filter['project'] = $this->getGid(); |
| 198 | 198 | return $this->loadAll(Task::class, "tasks", $filter); |
| 199 | 199 | } |
@@ -202,25 +202,25 @@ discard block |
||
| 202 | 202 | * @depends after-create |
| 203 | 203 | * @return string |
| 204 | 204 | */ |
| 205 | - public function getUrl (): string { |
|
| 205 | + public function getUrl(): string { |
|
| 206 | 206 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * @return ProjectWebhook[] |
| 211 | 211 | */ |
| 212 | - public function getWebhooks () { |
|
| 212 | + public function getWebhooks() { |
|
| 213 | 213 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
| 214 | 214 | 'workspace' => $this->getWorkspace()->getGid(), |
| 215 | 215 | 'resource' => $this->getGid() |
| 216 | 216 | ]); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - public function isBoard (): bool { |
|
| 219 | + public function isBoard(): bool { |
|
| 220 | 220 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - public function isList (): bool { |
|
| 223 | + public function isList(): bool { |
|
| 224 | 224 | return $this->getLayout() === self::LAYOUT_LIST; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @depends after-create |
| 229 | 229 | * @return Section |
| 230 | 230 | */ |
| 231 | - public function newSection () { |
|
| 231 | + public function newSection() { |
|
| 232 | 232 | return $this->factory(Section::class, ['project' => $this]); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @depends after-create |
| 237 | 237 | * @return Status |
| 238 | 238 | */ |
| 239 | - public function newStatus () { |
|
| 239 | + public function newStatus() { |
|
| 240 | 240 | return $this->factory(Status::class); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @depends after-create |
| 247 | 247 | * @return Task |
| 248 | 248 | */ |
| 249 | - public function newTask () { |
|
| 249 | + public function newTask() { |
|
| 250 | 250 | return $this->getDefaultSection()->newTask(); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @param User $user |
| 256 | 256 | * @return $this |
| 257 | 257 | */ |
| 258 | - public function removeMember (User $user) { |
|
| 258 | + public function removeMember(User $user) { |
|
| 259 | 259 | return $this->removeMembers([$user]); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param User[] $users |
| 265 | 265 | * @return $this |
| 266 | 266 | */ |
| 267 | - public function removeMembers (array $users) { |
|
| 267 | + public function removeMembers(array $users) { |
|
| 268 | 268 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 269 | 269 | 'members' => array_column($users, 'gid') |
| 270 | 270 | ], 'members', $users); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param callable $filter `fn( Section $section ): bool` |
| 275 | 275 | * @return Section[] |
| 276 | 276 | */ |
| 277 | - public function selectSections (callable $filter) { |
|
| 277 | + public function selectSections(callable $filter) { |
|
| 278 | 278 | return $this->_select($this->getSections(), $filter); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param callable $filter `fn( Status $status ): bool` |
| 283 | 283 | * @return Status[] |
| 284 | 284 | */ |
| 285 | - public function selectStatuses (callable $filter) { |
|
| 285 | + public function selectStatuses(callable $filter) { |
|
| 286 | 286 | return $this->_select($this->getStatuses(), $filter); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @param array $apiFilter Pre-filter given to the API to reduce network load. |
| 292 | 292 | * @return Task[] |
| 293 | 293 | */ |
| 294 | - public function selectTasks (callable $filter, array $apiFilter = []) { |
|
| 294 | + public function selectTasks(callable $filter, array $apiFilter = []) { |
|
| 295 | 295 | return $this->_select($this->getTasks($apiFilter), $filter); |
| 296 | 296 | } |
| 297 | 297 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param null|Team $team |
| 301 | 301 | * @return $this |
| 302 | 302 | */ |
| 303 | - public function setTeam (?Team $team) { |
|
| 303 | + public function setTeam(?Team $team) { |
|
| 304 | 304 | if ($team and !$this->hasWorkspace()) { |
| 305 | 305 | $this->setWorkspace($team->getOrganization()); |
| 306 | 306 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | 'enum_options' => [EnumOption::class], |
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | - final public function __toString (): string { |
|
| 43 | + final public function __toString(): string { |
|
| 44 | 44 | return "custom_fields/{$this->getGid()}"; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - final protected function _getDir (): string { |
|
| 47 | + final protected function _getDir(): string { |
|
| 48 | 48 | return 'custom_fields'; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $name |
| 57 | 57 | * @return EnumOption |
| 58 | 58 | */ |
| 59 | - public function addEnumOption (string $name) { |
|
| 59 | + public function addEnumOption(string $name) { |
|
| 60 | 60 | /** @var EnumOption $option */ |
| 61 | 61 | $option = $this->factory(EnumOption::class); |
| 62 | 62 | $option->setName($name); |
@@ -72,35 +72,35 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @return bool |
| 74 | 74 | */ |
| 75 | - public function hasNotificationsEnabled (): bool { |
|
| 75 | + public function hasNotificationsEnabled(): bool { |
|
| 76 | 76 | return $this->_is('has_notifications_enabled'); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - final public function isEnum (): bool { |
|
| 82 | + final public function isEnum(): bool { |
|
| 83 | 83 | return $this->getResourceSubtype() === self::TYPE_ENUM; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | - public function isGlobalToWorkspace (): bool { |
|
| 89 | + public function isGlobalToWorkspace(): bool { |
|
| 90 | 90 | return $this->_is('is_global_to_workspace'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @return bool |
| 95 | 95 | */ |
| 96 | - final public function isNumber (): bool { |
|
| 96 | + final public function isNumber(): bool { |
|
| 97 | 97 | return $this->getResourceSubtype() === self::TYPE_NUMBER; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @return bool |
| 102 | 102 | */ |
| 103 | - final public function isText (): bool { |
|
| 103 | + final public function isText(): bool { |
|
| 104 | 104 | return $this->getResourceSubtype() === self::TYPE_TEXT; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param bool $flag |
| 109 | 109 | * @return $this |
| 110 | 110 | */ |
| 111 | - public function setGlobalToWorkspace (bool $flag) { |
|
| 111 | + public function setGlobalToWorkspace(bool $flag) { |
|
| 112 | 112 | return $this->_set('is_global_to_workspace', $flag); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param bool $flag |
| 117 | 117 | * @return $this |
| 118 | 118 | */ |
| 119 | - public function setNotificationsEnabled (bool $flag) { |
|
| 119 | + public function setNotificationsEnabled(bool $flag) { |
|
| 120 | 120 | return $this->_set('has_notifications_enabled', $flag); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param callable $cmp `fn( EnumOption $a, EnumOption $b ): int` |
| 125 | 125 | * @return $this |
| 126 | 126 | */ |
| 127 | - public function sortEnumOptions (callable $cmp) { |
|
| 127 | + public function sortEnumOptions(callable $cmp) { |
|
| 128 | 128 | if ($options = $this->getEnumOptions()) { |
| 129 | 129 | $prev = $options[0]; // first option on remote |
| 130 | 130 | usort($options, $cmp); |