@@ -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->api->factory($this, 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); |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | * @param Project $project |
| 52 | 52 | * @param array $data |
| 53 | 53 | */ |
| 54 | - public function __construct (Project $project, array $data = []) { |
|
| 54 | + public function __construct(Project $project, array $data = []) { |
|
| 55 | 55 | parent::__construct($project, $data); |
| 56 | 56 | $this->project = $project; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - final public function __toString (): string { |
|
| 59 | + final public function __toString(): string { |
|
| 60 | 60 | return "project_statuses/{$this->getGid()}"; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - final protected function _getDir (): string { |
|
| 63 | + final protected function _getDir(): string { |
|
| 64 | 64 | return "{$this->project}/project_statuses"; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function _setData (array $data): void { |
|
| 67 | + protected function _setData(array $data): void { |
|
| 68 | 68 | // redundant, prefer created_by |
| 69 | 69 | unset($data['author']); |
| 70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** |
| 75 | 75 | * @return Project |
| 76 | 76 | */ |
| 77 | - public function getProject () { |
|
| 77 | + public function getProject() { |
|
| 78 | 78 | return $this->project; |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | const NAME = 'asana'; |
| 19 | 19 | |
| 20 | - public function boot () { |
|
| 20 | + public function boot() { |
|
| 21 | 21 | $this->publishes([ |
| 22 | 22 | __DIR__ . '/config/asana.php' => $this->app->configPath('asana.php') |
| 23 | 23 | ]); |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function provides () { |
|
| 33 | + public function provides() { |
|
| 34 | 34 | return [self::NAME]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function register () { |
|
| 37 | + public function register() { |
|
| 38 | 38 | $this->app->singleton(self::NAME, function(Application $app) { |
| 39 | 39 | $config = $app['config'][self::NAME]; |
| 40 | 40 | $pool = null; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | protected $curlInfo; |
| 22 | 22 | |
| 23 | - public function __construct (int $code, string $message, array $curlInfo) { |
|
| 23 | + public function __construct(int $code, string $message, array $curlInfo) { |
|
| 24 | 24 | parent::__construct($message, $code); |
| 25 | 25 | $this->curlInfo = $curlInfo; |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @return array |
| 30 | 30 | */ |
| 31 | - public function getCurlInfo (): array { |
|
| 31 | + public function getCurlInfo(): array { |
|
| 32 | 32 | return $this->curlInfo; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | $this->_log("CACHE DELINK {$key}"); |
| 59 | 59 | unlink($ref); |
| 60 | 60 | unlink($path); |
| 61 | - } |
|
| 62 | - elseif (is_file($path)) { |
|
| 61 | + } elseif (is_file($path)) { |
|
| 63 | 62 | $this->_log("CACHE DELETE {$key}"); |
| 64 | 63 | unlink($path); |
| 65 | 64 | } |
@@ -117,8 +116,7 @@ discard block |
||
| 117 | 116 | ["CACHE SET {$key}", "CACHE BURN {$key}"][$value instanceof ImmutableInterface], |
| 118 | 117 | "CACHE UPDATE {$key}" |
| 119 | 118 | ][is_file($path)]); |
| 120 | - } |
|
| 121 | - else { |
|
| 119 | + } else { |
|
| 122 | 120 | $this->_log([ |
| 123 | 121 | "CACHE LINK {$key} => {$value}", |
| 124 | 122 | "CACHE RENEW LINK {$key} => {$value}" |
@@ -29,30 +29,30 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @param string $dir |
| 31 | 31 | */ |
| 32 | - public function __construct (string $dir) { |
|
| 32 | + public function __construct(string $dir) { |
|
| 33 | 33 | $this->dir = $dir; |
| 34 | 34 | $this->log = new NullLogger(); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - private function _log (string $msg): void { |
|
| 37 | + private function _log(string $msg): void { |
|
| 38 | 38 | $this->log->log(LOG_DEBUG, $msg); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - private function _path ($key): string { |
|
| 41 | + private function _path($key): string { |
|
| 42 | 42 | $path = "{$this->dir}/{$key}~"; |
| 43 | 43 | clearstatcache(true, $path); |
| 44 | 44 | return $path; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - private function _ref ($key): string { |
|
| 47 | + private function _ref($key): string { |
|
| 48 | 48 | return "{$this->dir}/{$key}.ref"; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function clear () { |
|
| 51 | + public function clear() { |
|
| 52 | 52 | // unused. just delete the dir. |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function delete ($key) { |
|
| 55 | + public function delete($key) { |
|
| 56 | 56 | $path = $this->_path($key); |
| 57 | 57 | if (is_link($ref = $this->_ref($key))) { |
| 58 | 58 | $this->_log("CACHE DELINK {$key}"); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function deleteMultiple ($keys) { |
|
| 68 | + public function deleteMultiple($keys) { |
|
| 69 | 69 | // unused |
| 70 | 70 | } |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param mixed $default Unused. |
| 75 | 75 | * @return null|string|object |
| 76 | 76 | */ |
| 77 | - public function get ($key, $default = null) { |
|
| 77 | + public function get($key, $default = null) { |
|
| 78 | 78 | $path = $this->_path($key); |
| 79 | 79 | if (!is_file($path)) { |
| 80 | 80 | $this->_log("CACHE MISS {$key}"); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | return $data; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function getMultiple ($keys, $default = null) { |
|
| 96 | + public function getMultiple($keys, $default = null) { |
|
| 97 | 97 | // unused |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function has ($key): bool { |
|
| 100 | + public function has($key): bool { |
|
| 101 | 101 | return is_file($this->_path($key)); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param int $ttl |
| 108 | 108 | * @return void |
| 109 | 109 | */ |
| 110 | - public function set ($key, $value, $ttl = null): void { |
|
| 110 | + public function set($key, $value, $ttl = null): void { |
|
| 111 | 111 | $path = $this->_path($key); |
| 112 | 112 | if (!is_dir(dirname($path))) { |
| 113 | 113 | mkdir(dirname($path), 0770, true); |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | * @param LoggerInterface $log |
| 137 | 137 | * @return $this |
| 138 | 138 | */ |
| 139 | - public function setLog (LoggerInterface $log) { |
|
| 139 | + public function setLog(LoggerInterface $log) { |
|
| 140 | 140 | $this->log = $log; |
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function setMultiple ($values, $ttl = null) { |
|
| 144 | + public function setMultiple($values, $ttl = null) { |
|
| 145 | 145 | // unused |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @param AbstractEntity $entity |
| 31 | 31 | */ |
| 32 | - protected function _add (AbstractEntity $entity): void { |
|
| 32 | + protected function _add(AbstractEntity $entity): void { |
|
| 33 | 33 | $gid = $entity->getGid(); |
| 34 | 34 | $this->entities[$gid] = $entity; |
| 35 | 35 | $this->gids[$gid] = $gid; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param AbstractEntity $entity |
| 40 | 40 | * @param string[] $keys |
| 41 | 41 | */ |
| 42 | - protected function _addKeys (AbstractEntity $entity, ...$keys): void { |
|
| 42 | + protected function _addKeys(AbstractEntity $entity, ...$keys): void { |
|
| 43 | 43 | $this->gids += array_fill_keys($keys, $entity->getGid()); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param Api|Data $caller For hydration if needed. |
| 49 | 49 | * @return null|AbstractEntity |
| 50 | 50 | */ |
| 51 | - protected function _get (string $key, $caller) { |
|
| 51 | + protected function _get(string $key, $caller) { |
|
| 52 | 52 | if (isset($this->gids[$key])) { |
| 53 | 53 | return $this->entities[$this->gids[$key]]; |
| 54 | 54 | } |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | * @param string $key |
| 63 | 63 | * @return bool |
| 64 | 64 | */ |
| 65 | - protected function _has (string $key): bool { |
|
| 65 | + protected function _has(string $key): bool { |
|
| 66 | 66 | return isset($this->gids[$key]); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @param AbstractEntity $entity |
| 71 | 71 | */ |
| 72 | - final public function add (AbstractEntity $entity): void { |
|
| 72 | + final public function add(AbstractEntity $entity): void { |
|
| 73 | 73 | if (!$entity->isDiff()) { |
| 74 | 74 | $this->_add($entity); |
| 75 | 75 | $this->_addKeys($entity, ...$entity->getPoolKeys()); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param Closure $factory `fn( Api|Data $caller ): null|AbstractEntity` |
| 83 | 83 | * @return null|mixed|AbstractEntity |
| 84 | 84 | */ |
| 85 | - final public function get (string $key, $caller, Closure $factory) { |
|
| 85 | + final public function get(string $key, $caller, Closure $factory) { |
|
| 86 | 86 | /** @var AbstractEntity $entity */ |
| 87 | 87 | if (!$entity = $this->_get($key, $caller) and $entity = $factory($caller)) { |
| 88 | 88 | $gid = $entity->getGid(); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @param string[] $keys |
| 105 | 105 | */ |
| 106 | - public function remove (array $keys): void { |
|
| 106 | + public function remove(array $keys): void { |
|
| 107 | 107 | foreach ($keys as $key) { |
| 108 | 108 | unset($this->entities[$key]); |
| 109 | 109 | unset($this->gids[$key]); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'custom_field' => CustomField::class, |
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | - protected function _setData (array $data): void { |
|
| 26 | + protected function _setData(array $data): void { |
|
| 27 | 27 | // these are the only fields that matter. |
| 28 | 28 | parent::_setData([ |
| 29 | 29 | 'custom_field' => $data['custom_field'], |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | ]); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - final public function getResourceType (): string { |
|
| 34 | + final public function getResourceType(): string { |
|
| 35 | 35 | return self::TYPE; |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -44,46 +44,46 @@ discard block |
||
| 44 | 44 | 'target' => Task::class |
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | - final public function __toString (): string { |
|
| 47 | + final public function __toString(): string { |
|
| 48 | 48 | return "stories/{$this->getGid()}"; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - final protected function _getDir (): string { |
|
| 51 | + final protected function _getDir(): string { |
|
| 52 | 52 | return "{$this->getTarget()}/stories"; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - protected function _setData (array $data): void { |
|
| 55 | + protected function _setData(array $data): void { |
|
| 56 | 56 | // hearts were deprecated for likes |
| 57 | 57 | unset($data['hearted'], $data['hearts'], $data['num_hearts']); |
| 58 | 58 | |
| 59 | 59 | parent::_setData($data); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final public function isAssignment (): bool { |
|
| 62 | + final public function isAssignment(): bool { |
|
| 63 | 63 | return $this->getResourceSubtype() === self::TYPE_ASSIGNED; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - final public function isComment (): bool { |
|
| 66 | + final public function isComment(): bool { |
|
| 67 | 67 | return $this->getResourceSubtype() === self::TYPE_COMMENT_ADDED; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - final public function isDueDate (): bool { |
|
| 70 | + final public function isDueDate(): bool { |
|
| 71 | 71 | return $this->getResourceSubtype() === self::TYPE_DUE_DATE_CHANGED; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function isEdited (): bool { |
|
| 74 | + public function isEdited(): bool { |
|
| 75 | 75 | return $this->_is('is_edited'); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function isFromApi (): bool { |
|
| 78 | + public function isFromApi(): bool { |
|
| 79 | 79 | return $this->getSource() === 'api'; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function isFromWeb (): bool { |
|
| 82 | + public function isFromWeb(): bool { |
|
| 83 | 83 | return $this->getSource() === 'web'; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function isPinned (): bool { |
|
| 86 | + public function isPinned(): bool { |
|
| 87 | 87 | return $this->_is('is_pinned'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param bool $pinned |
| 92 | 92 | * @return $this |
| 93 | 93 | */ |
| 94 | - public function setPinned (bool $pinned) { |
|
| 94 | + public function setPinned(bool $pinned) { |
|
| 95 | 95 | return $this->_set('is_pinned', $pinned); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -48,14 +48,14 @@ |
||
| 48 | 48 | /** |
| 49 | 49 | * @return Api |
| 50 | 50 | */ |
| 51 | - final public static function getApi () { |
|
| 51 | + final public static function getApi() { |
|
| 52 | 52 | return static::getFacadeRoot(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @return string |
| 57 | 57 | */ |
| 58 | - public static function getFacadeAccessor () { |
|
| 58 | + public static function getFacadeAccessor() { |
|
| 59 | 59 | return AsanaServiceProvider::NAME; |
| 60 | 60 | } |
| 61 | 61 | |