@@ -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); |
@@ -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 |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | * |
| 13 | 13 | * @return string |
| 14 | 14 | */ |
| 15 | - abstract protected function _getDir (): string; |
|
| 15 | + abstract protected function _getDir(): string; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * `POST` the new entity to Asana. |
| 19 | 19 | * |
| 20 | 20 | * @return $this |
| 21 | 21 | */ |
| 22 | - public function create () { |
|
| 22 | + public function create() { |
|
| 23 | 23 | return $this->{'_save'}($this->_getDir()); |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * `DELETE` |
| 12 | 12 | */ |
| 13 | - public function delete (): void { |
|
| 13 | + public function delete(): void { |
|
| 14 | 14 | $this->{'_delete'}(); |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | \ No newline at end of file |