@@ -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 |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param Workspace $workspace |
| 61 | 61 | * @return Portfolio[] |
| 62 | 62 | */ |
| 63 | - public function getFavoritePortfolios (Workspace $workspace) { |
|
| 63 | + public function getFavoritePortfolios(Workspace $workspace) { |
|
| 64 | 64 | return $this->getFavorites(Portfolio::class, Portfolio::TYPE, $workspace); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param Workspace $workspace |
| 69 | 69 | * @return Project[] |
| 70 | 70 | */ |
| 71 | - public function getFavoriteProjects (Workspace $workspace) { |
|
| 71 | + public function getFavoriteProjects(Workspace $workspace) { |
|
| 72 | 72 | return $this->getFavorites(Project::class, Project::TYPE, $workspace); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param Workspace $workspace |
| 77 | 77 | * @return Tag[] |
| 78 | 78 | */ |
| 79 | - public function getFavoriteTags (Workspace $workspace) { |
|
| 79 | + public function getFavoriteTags(Workspace $workspace) { |
|
| 80 | 80 | return $this->getFavorites(Tag::class, Tag::TYPE, $workspace); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param Workspace $workspace |
| 85 | 85 | * @return Team[] |
| 86 | 86 | */ |
| 87 | - public function getFavoriteTeams (Workspace $workspace) { |
|
| 87 | + public function getFavoriteTeams(Workspace $workspace) { |
|
| 88 | 88 | return $this->getFavorites(Team::class, Team::TYPE, $workspace); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param Workspace $workspace |
| 93 | 93 | * @return User[] |
| 94 | 94 | */ |
| 95 | - public function getFavoriteUsers (Workspace $workspace) { |
|
| 95 | + public function getFavoriteUsers(Workspace $workspace) { |
|
| 96 | 96 | return $this->getFavorites(self::class, self::TYPE, $workspace); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param Workspace $workspace |
| 103 | 103 | * @return array |
| 104 | 104 | */ |
| 105 | - protected function getFavorites (string $class, string $resourceType, Workspace $workspace) { |
|
| 105 | + protected function getFavorites(string $class, string $resourceType, Workspace $workspace) { |
|
| 106 | 106 | return $this->loadAll($class, "{$this}/favorites", [ |
| 107 | 107 | 'resource_type' => $resourceType, |
| 108 | 108 | 'workspace' => $workspace->getGid() |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param Workspace $workspace |
| 118 | 118 | * @return Task[] |
| 119 | 119 | */ |
| 120 | - public function getIncompleteTasks (Workspace $workspace) { |
|
| 120 | + public function getIncompleteTasks(Workspace $workspace) { |
|
| 121 | 121 | return $this->getTasks($workspace, ['completed_since' => 'now']); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param Workspace $workspace |
| 126 | 126 | * @return Portfolio[] |
| 127 | 127 | */ |
| 128 | - public function getPortfolios (Workspace $workspace) { |
|
| 128 | + public function getPortfolios(Workspace $workspace) { |
|
| 129 | 129 | return $this->loadAll(Portfolio::class, "portfolios", [ |
| 130 | 130 | 'workspace' => $workspace->getGid(), |
| 131 | 131 | 'owner' => $this->getGid() |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param Workspace $workspace |
| 137 | 137 | * @return TaskList |
| 138 | 138 | */ |
| 139 | - public function getTaskList (Workspace $workspace) { |
|
| 139 | + public function getTaskList(Workspace $workspace) { |
|
| 140 | 140 | return $this->load(TaskList::class, "{$this}/user_task_list", [ |
| 141 | 141 | 'workspace' => $workspace->getGid() |
| 142 | 142 | ]); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param string[] $filter |
| 152 | 152 | * @return Task[] |
| 153 | 153 | */ |
| 154 | - public function getTasks (Workspace $workspace, array $filter = []) { |
|
| 154 | + public function getTasks(Workspace $workspace, array $filter = []) { |
|
| 155 | 155 | $filter['assignee'] = $this->getGid(); |
| 156 | 156 | $filter['workspace'] = $workspace->getGid(); |
| 157 | 157 | return $this->loadAll(Task::class, 'tasks', $filter); |
@@ -165,13 +165,13 @@ discard block |
||
| 165 | 165 | * @param Workspace $organization |
| 166 | 166 | * @return Team[] |
| 167 | 167 | */ |
| 168 | - public function getTeams (Workspace $organization) { |
|
| 168 | + public function getTeams(Workspace $organization) { |
|
| 169 | 169 | return $this->loadAll(Team::class, "{$this}/teams", [ |
| 170 | 170 | 'organization' => $organization->getGid() |
| 171 | 171 | ]); |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function getUrl (): string { |
|
| 174 | + public function getUrl(): string { |
|
| 175 | 175 | return "https://app.asana.com/0/{$this->getGid()}/list"; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param Workspace $workspace |
| 180 | 180 | * @return $this |
| 181 | 181 | */ |
| 182 | - public function removeFromWorkspace (Workspace $workspace) { |
|
| 182 | + public function removeFromWorkspace(Workspace $workspace) { |
|
| 183 | 183 | return $this->_removeWithPost("{$workspace}/removeUser", [ |
| 184 | 184 | 'user' => $this->getGid() |
| 185 | 185 | ], 'workspaces', [$workspace]); |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | 'workspace' => Workspace::class |
| 68 | 68 | ]; |
| 69 | 69 | |
| 70 | - final public function __toString (): string { |
|
| 70 | + final public function __toString(): string { |
|
| 71 | 71 | return "projects/{$this->getGid()}"; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - final protected function _getDir (): string { |
|
| 74 | + final protected function _getDir(): string { |
|
| 75 | 75 | return 'projects'; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param User $user |
| 81 | 81 | * @return $this |
| 82 | 82 | */ |
| 83 | - public function addMember (User $user) { |
|
| 83 | + public function addMember(User $user) { |
|
| 84 | 84 | return $this->addMembers([$user]); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param User[] $users |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function addMembers (array $users) { |
|
| 92 | + public function addMembers(array $users) { |
|
| 93 | 93 | return $this->_addWithPost("{$this}/addMembers", [ |
| 94 | 94 | 'members' => array_column($users, 'gid') |
| 95 | 95 | ], 'members', $users); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $target |
| 101 | 101 | * @return ProjectWebhook |
| 102 | 102 | */ |
| 103 | - public function addWebhook (string $target) { |
|
| 103 | + public function addWebhook(string $target) { |
|
| 104 | 104 | /** @var ProjectWebhook $webhook */ |
| 105 | 105 | $webhook = $this->factory(ProjectWebhook::class); |
| 106 | 106 | return $webhook->create($this, $target); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param array $schedule |
| 126 | 126 | * @return Job |
| 127 | 127 | */ |
| 128 | - public function duplicate (string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 128 | + public function duplicate(string $name, array $include, Team $team = null, array $schedule = []) { |
|
| 129 | 129 | $data = ['name' => $name]; |
| 130 | 130 | if ($team) { |
| 131 | 131 | $data['team'] = $team->getGid(); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param null|string $token |
| 148 | 148 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 149 | 149 | */ |
| 150 | - public function getEvents (&$token) { |
|
| 150 | + public function getEvents(&$token) { |
|
| 151 | 151 | return $this->api->sync($this, $token); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @depends after-create |
| 156 | 156 | * @return Section[] |
| 157 | 157 | */ |
| 158 | - public function getSections () { |
|
| 158 | + public function getSections() { |
|
| 159 | 159 | return $this->loadAll(Section::class, "{$this}/sections"); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @depends after-create |
| 164 | 164 | * @return Status[] |
| 165 | 165 | */ |
| 166 | - public function getStatuses () { |
|
| 166 | + public function getStatuses() { |
|
| 167 | 167 | return $this->loadAll(Status::class, "{$this}/project_statuses"); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param array $filter |
| 177 | 177 | * @return Task[] |
| 178 | 178 | */ |
| 179 | - public function getTasks (array $filter = []) { |
|
| 179 | + public function getTasks(array $filter = []) { |
|
| 180 | 180 | $filter['project'] = $this->getGid(); |
| 181 | 181 | return $this->loadAll(Task::class, "tasks", $filter); |
| 182 | 182 | } |
@@ -185,25 +185,25 @@ discard block |
||
| 185 | 185 | * @depends after-create |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | - public function getUrl (): string { |
|
| 188 | + public function getUrl(): string { |
|
| 189 | 189 | return "https://app.asana.com/0/{$this->getGid()}"; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * @return ProjectWebhook[] |
| 194 | 194 | */ |
| 195 | - public function getWebhooks () { |
|
| 195 | + public function getWebhooks() { |
|
| 196 | 196 | return $this->loadAll(ProjectWebhook::class, 'webhooks', [ |
| 197 | 197 | 'workspace' => $this->getWorkspace()->getGid(), |
| 198 | 198 | 'resource' => $this->getGid() |
| 199 | 199 | ]); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function isBoard (): bool { |
|
| 202 | + public function isBoard(): bool { |
|
| 203 | 203 | return $this->getLayout() === self::LAYOUT_BOARD; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - public function isList (): bool { |
|
| 206 | + public function isList(): bool { |
|
| 207 | 207 | return $this->getLayout() === self::LAYOUT_LIST; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @depends after-create |
| 212 | 212 | * @return Section |
| 213 | 213 | */ |
| 214 | - public function newSection () { |
|
| 214 | + public function newSection() { |
|
| 215 | 215 | return $this->factory(Section::class, ['project' => $this]); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @depends after-create |
| 220 | 220 | * @return Status |
| 221 | 221 | */ |
| 222 | - public function newStatus () { |
|
| 222 | + public function newStatus() { |
|
| 223 | 223 | return $this->factory(Status::class); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @depends after-create |
| 230 | 230 | * @return Task |
| 231 | 231 | */ |
| 232 | - public function newTask () { |
|
| 232 | + public function newTask() { |
|
| 233 | 233 | return $this->getSections()[0]->newTask(); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param User $user |
| 239 | 239 | * @return $this |
| 240 | 240 | */ |
| 241 | - public function removeMember (User $user) { |
|
| 241 | + public function removeMember(User $user) { |
|
| 242 | 242 | return $this->removeMembers([$user]); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @param User[] $users |
| 248 | 248 | * @return $this |
| 249 | 249 | */ |
| 250 | - public function removeMembers (array $users) { |
|
| 250 | + public function removeMembers(array $users) { |
|
| 251 | 251 | return $this->_removeWithPost("{$this}/removeMembers", [ |
| 252 | 252 | 'members' => array_column($users, 'gid') |
| 253 | 253 | ], 'members', $users); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param null|Team $team |
| 259 | 259 | * @return $this |
| 260 | 260 | */ |
| 261 | - public function setTeam (?Team $team) { |
|
| 261 | + public function setTeam(?Team $team) { |
|
| 262 | 262 | if ($team and !$this->hasWorkspace()) { |
| 263 | 263 | $this->setWorkspace($team->getOrganization()); |
| 264 | 264 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param AbstractEntity $entity |
| 35 | 35 | * @return bool Success |
| 36 | 36 | */ |
| 37 | - public function add (AbstractEntity $entity): bool { |
|
| 37 | + public function add(AbstractEntity $entity): bool { |
|
| 38 | 38 | if ($gid = $entity->getGid() and !$entity->isDiff()) { |
| 39 | 39 | $this->entities[$gid] = $entity; |
| 40 | 40 | $this->addKeys($gid, $entity->getCacheKeys()); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param string $gid |
| 50 | 50 | * @param string[] $keys |
| 51 | 51 | */ |
| 52 | - protected function addKeys (string $gid, array $keys): void { |
|
| 52 | + protected function addKeys(string $gid, array $keys): void { |
|
| 53 | 53 | $this->gids += array_fill_keys($keys, $gid); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param Closure $factory `fn( Api|Data $caller ): null|AbstractEntity` |
| 65 | 65 | * @return null|mixed|AbstractEntity |
| 66 | 66 | */ |
| 67 | - public function get (string $key, $caller, Closure $factory) { |
|
| 67 | + public function get(string $key, $caller, Closure $factory) { |
|
| 68 | 68 | // POOL HIT |
| 69 | 69 | if ($gid = $this->gids[$key] ?? null) { |
| 70 | 70 | return $this->entities[$gid]; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @param AbstractEntity $entity |
| 94 | 94 | */ |
| 95 | - public function remove (AbstractEntity $entity): void { |
|
| 95 | + public function remove(AbstractEntity $entity): void { |
|
| 96 | 96 | $gid = $entity->getGid(); |
| 97 | 97 | unset($this->entities[$gid]); |
| 98 | 98 | foreach ($entity->getCacheKeys() as $key) { |
@@ -12,5 +12,5 @@ |
||
| 12 | 12 | * @param string $path |
| 13 | 13 | * @param null|array $data |
| 14 | 14 | */ |
| 15 | - public function log (string $message, string $path, array $data = null): void; |
|
| 15 | + public function log(string $message, string $path, array $data = null): void; |
|
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @param PSR16 $psr |
| 36 | 36 | */ |
| 37 | - public function __construct (PSR16 $psr) { |
|
| 37 | + public function __construct(PSR16 $psr) { |
|
| 38 | 38 | $this->psr = $psr; |
| 39 | 39 | $this->ttl = new DateInterval('PT1H'); |
| 40 | 40 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string $key |
| 44 | 44 | * @throws InvalidArgumentException |
| 45 | 45 | */ |
| 46 | - protected function _delete (string $key) { |
|
| 46 | + protected function _delete(string $key) { |
|
| 47 | 47 | $this->psr->delete('asana:' . $key); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @return null|string|AbstractEntity |
| 53 | 53 | * @throws InvalidArgumentException |
| 54 | 54 | */ |
| 55 | - protected function _get (string $key) { |
|
| 55 | + protected function _get(string $key) { |
|
| 56 | 56 | return $this->psr->get('asana:' . $key); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param mixed $value |
| 62 | 62 | * @throws InvalidArgumentException |
| 63 | 63 | */ |
| 64 | - protected function _set (string $key, $value) { |
|
| 64 | + protected function _set(string $key, $value) { |
|
| 65 | 65 | $this->psr->set('asana:' . $key, $value, $this->ttl); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return bool |
| 71 | 71 | * @throws InvalidArgumentException |
| 72 | 72 | */ |
| 73 | - public function add (AbstractEntity $entity): bool { |
|
| 73 | + public function add(AbstractEntity $entity): bool { |
|
| 74 | 74 | if (parent::add($entity)) { |
| 75 | 75 | $this->_set($entity->getGid(), $entity); |
| 76 | 76 | return true; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @param string[] $keys |
| 84 | 84 | * @throws InvalidArgumentException |
| 85 | 85 | */ |
| 86 | - protected function addKeys (string $gid, array $keys): void { |
|
| 86 | + protected function addKeys(string $gid, array $keys): void { |
|
| 87 | 87 | parent::addKeys($gid, $keys); |
| 88 | 88 | // stash gid refs |
| 89 | 89 | foreach ($keys as $key) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @return null|AbstractEntity |
| 101 | 101 | * @throws InvalidArgumentException |
| 102 | 102 | */ |
| 103 | - public function get (string $key, $caller, Closure $factory) { |
|
| 103 | + public function get(string $key, $caller, Closure $factory) { |
|
| 104 | 104 | // POOL MISS && CACHE HIT |
| 105 | 105 | if (!isset($this->gids[$key]) and $entity = $this->_get($key)) { |
| 106 | 106 | if ($entity instanceof AbstractEntity) { |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * @return DateInterval |
| 125 | 125 | */ |
| 126 | - public function getTtl () { |
|
| 126 | + public function getTtl() { |
|
| 127 | 127 | return $this->ttl; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param AbstractEntity $entity |
| 132 | 132 | * @throws InvalidArgumentException |
| 133 | 133 | */ |
| 134 | - public function remove (AbstractEntity $entity): void { |
|
| 134 | + public function remove(AbstractEntity $entity): void { |
|
| 135 | 135 | parent::remove($entity); |
| 136 | 136 | foreach ($entity->getCacheKeys() as $key) { |
| 137 | 137 | $this->_delete($key); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param DateInterval $ttl |
| 143 | 143 | * @return $this |
| 144 | 144 | */ |
| 145 | - public function setTtl (DateInterval $ttl) { |
|
| 145 | + public function setTtl(DateInterval $ttl) { |
|
| 146 | 146 | $this->ttl = $ttl; |
| 147 | 147 | return $this; |
| 148 | 148 | } |
@@ -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,7 +51,7 @@ 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 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | - public function isFailed (): bool { |
|
| 63 | + public function isFailed(): bool { |
|
| 64 | 64 | return $this->getStatus() === self::STATUS_FAIL; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return bool |
| 71 | 71 | */ |
| 72 | - public function isQueued (): bool { |
|
| 72 | + public function isQueued(): bool { |
|
| 73 | 73 | return $this->getStatus() === self::STATUS_QUEUED; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return bool |
| 80 | 80 | */ |
| 81 | - public function isSuccessful (): bool { |
|
| 81 | + public function isSuccessful(): bool { |
|
| 82 | 82 | return $this->getStatus() === self::STATUS_SUCCESS; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param callable $spinner `fn( Job $this ): void` |
| 91 | 91 | * @return $this |
| 92 | 92 | */ |
| 93 | - public function wait (callable $spinner = null) { |
|
| 93 | + public function wait(callable $spinner = null) { |
|
| 94 | 94 | while (!$this->isDone()) { |
| 95 | 95 | if ($spinner) { |
| 96 | 96 | call_user_func($spinner, $this); |
@@ -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 | - public function isActive (): bool { |
|
| 58 | + 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 | - public function isDone (): bool { |
|
| 67 | + 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 | - public function isFailed (): bool { |
|
| 76 | + 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 | - public function isQueued (): bool { |
|
| 85 | + 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 | - public function isSuccessful (): bool { |
|
| 94 | + 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); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | - abstract public function __toString (): string; |
|
| 21 | + abstract public function __toString(): string; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Maps lazy-loaded / reloadable mapped {@see Data} to their proper expanded field expression. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return $this |
| 38 | 38 | * @internal |
| 39 | 39 | */ |
| 40 | - protected function _addWithPost (string $path, array $data, string $field, array $diff) { |
|
| 40 | + protected function _addWithPost(string $path, array $data, string $field, array $diff) { |
|
| 41 | 41 | if ($this->hasGid()) { |
| 42 | 42 | return $this->_setWithPost($path, $data, $field); |
| 43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @internal |
| 51 | 51 | */ |
| 52 | - protected function _cache (): void { |
|
| 52 | + protected function _cache(): void { |
|
| 53 | 53 | $this->api->getCache()->add($this); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @internal |
| 60 | 60 | */ |
| 61 | - protected function _delete (): void { |
|
| 61 | + protected function _delete(): void { |
|
| 62 | 62 | $this->api->delete($this); |
| 63 | 63 | $this->api->getCache()->remove($this); |
| 64 | 64 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param string $field |
| 70 | 70 | * @return mixed |
| 71 | 71 | */ |
| 72 | - protected function _get (string $field) { |
|
| 72 | + protected function _get(string $field) { |
|
| 73 | 73 | if (!array_key_exists($field, $this->data) and isset($this->data['gid'])) { |
| 74 | 74 | $this->reload($field); |
| 75 | 75 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return $this |
| 85 | 85 | * @internal |
| 86 | 86 | */ |
| 87 | - protected function _removeWithPost (string $path, array $data, string $field = null, $diff = null) { |
|
| 87 | + protected function _removeWithPost(string $path, array $data, string $field = null, $diff = null) { |
|
| 88 | 88 | if ($this->hasGid()) { |
| 89 | 89 | return $this->_setWithPost($path, $data, $field); |
| 90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @return $this |
| 105 | 105 | * @internal |
| 106 | 106 | */ |
| 107 | - protected function _save (string $dir = null) { |
|
| 107 | + protected function _save(string $dir = null) { |
|
| 108 | 108 | if (isset($dir)) { |
| 109 | 109 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
| 110 | 110 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @return $this |
| 131 | 131 | * @internal |
| 132 | 132 | */ |
| 133 | - protected function _setWithPost (string $path, array $data, string $field, $value = null) { |
|
| 133 | + protected function _setWithPost(string $path, array $data, string $field, $value = null) { |
|
| 134 | 134 | if ($this->hasGid()) { |
| 135 | 135 | /** @var array $remote */ |
| 136 | 136 | $remote = $this->api->post($path, $data, ['fields' => static::$optFields[$field] ?? $field]); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return string[] |
| 150 | 150 | */ |
| 151 | - public function getCacheKeys () { |
|
| 151 | + public function getCacheKeys() { |
|
| 152 | 152 | return [$this->getGid(), (string)$this]; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string $field |
| 159 | 159 | * @return $this |
| 160 | 160 | */ |
| 161 | - public function reload (string $field = null) { |
|
| 161 | + public function reload(string $field = null) { |
|
| 162 | 162 | if (isset($field)) { |
| 163 | 163 | $value = $this->api->get($this, [], ['fields' => static::$optFields[$field] ?? $field])[$field] ?? null; |
| 164 | 164 | $this->_setMapped($field, $value); |
@@ -87,11 +87,9 @@ discard block |
||
| 87 | 87 | protected function _removeWithPost (string $path, array $data, string $field = null, $diff = null) { |
| 88 | 88 | if ($this->hasGid()) { |
| 89 | 89 | return $this->_setWithPost($path, $data, $field); |
| 90 | - } |
|
| 91 | - elseif (is_array($diff)) { |
|
| 90 | + } elseif (is_array($diff)) { |
|
| 92 | 91 | $this->_set($field, array_values(array_diff($this->data[$field] ?? [], $diff))); |
| 93 | - } |
|
| 94 | - elseif ($diff instanceof Closure) { |
|
| 92 | + } elseif ($diff instanceof Closure) { |
|
| 95 | 93 | $this->_set($field, array_filter($diff, $this->data[$field] ?? [])); |
| 96 | 94 | } |
| 97 | 95 | return $this; |
@@ -107,11 +105,9 @@ discard block |
||
| 107 | 105 | protected function _save (string $dir = null) { |
| 108 | 106 | if (isset($dir)) { |
| 109 | 107 | $remote = $this->api->post($dir, $this->getDiff(), ['expand' => 'this']); |
| 110 | - } |
|
| 111 | - elseif ($this->isDiff()) { |
|
| 108 | + } elseif ($this->isDiff()) { |
|
| 112 | 109 | $remote = $this->api->put($this, $this->getDiff(), ['expand' => 'this']); |
| 113 | - } |
|
| 114 | - else { |
|
| 110 | + } else { |
|
| 115 | 111 | return $this; |
| 116 | 112 | } |
| 117 | 113 | /** @var array $remote */ |
@@ -162,8 +158,7 @@ discard block |
||
| 162 | 158 | if (isset($field)) { |
| 163 | 159 | $value = $this->api->get($this, [], ['fields' => static::$optFields[$field] ?? $field])[$field] ?? null; |
| 164 | 160 | $this->_setMapped($field, $value); |
| 165 | - } |
|
| 166 | - else { |
|
| 161 | + } else { |
|
| 167 | 162 | $this->_setData($this->api->get($this, [], ['expand' => 'this'])); |
| 168 | 163 | } |
| 169 | 164 | $this->_cache(); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | * @param Workspace $workspace |
| 18 | 18 | * @return $this |
| 19 | 19 | */ |
| 20 | - public function setWorkspace (Workspace $workspace) { |
|
| 20 | + public function setWorkspace(Workspace $workspace) { |
|
| 21 | 21 | return $this->_set('workspace', $workspace); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |