@@ -35,7 +35,7 @@ |
||
| 35 | 35 | /** |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public static function random () { |
|
| 38 | + public static function random() { |
|
| 39 | 39 | try { |
| 40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
| 41 | 41 | return $colors[array_rand($colors)]; |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | try { |
| 40 | 40 | $colors = (new ReflectionClass(self::class))->getConstants(); |
| 41 | 41 | return $colors[array_rand($colors)]; |
| 42 | - } |
|
| 43 | - catch (Exception $exception) { |
|
| 42 | + } catch (Exception $exception) { |
|
| 44 | 43 | return 'none'; // unreachable |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | use DeleteTrait; |
| 32 | 32 | |
| 33 | - final public function __toString (): string { |
|
| 33 | + final public function __toString(): string { |
|
| 34 | 34 | return "webhooks/{$this->getGid()}"; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - final protected function _getDir (): string { |
|
| 37 | + final protected function _getDir(): string { |
|
| 38 | 38 | return 'webhooks'; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param string $target |
| 44 | 44 | * @return $this |
| 45 | 45 | */ |
| 46 | - public function create ($resource, string $target) { |
|
| 46 | + public function create($resource, string $target) { |
|
| 47 | 47 | $this->_set('resource', $resource); |
| 48 | 48 | $this->_set('target', $target); |
| 49 | 49 | return $this->_create(); |
@@ -460,8 +460,7 @@ |
||
| 460 | 460 | 'sync' => $token, |
| 461 | 461 | 'opt_expand' => 'this' |
| 462 | 462 | ])); |
| 463 | - } |
|
| 464 | - catch (Error $error) { |
|
| 463 | + } catch (Error $error) { |
|
| 465 | 464 | if ($error->getCode() !== 412) { |
| 466 | 465 | throw $error; |
| 467 | 466 | } |
@@ -52,25 +52,25 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return Cache |
| 54 | 54 | */ |
| 55 | - public static function getCache () { |
|
| 55 | + public static function getCache() { |
|
| 56 | 56 | return static::$cache ?? static::$cache = new Cache(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @return Api |
| 61 | 61 | */ |
| 62 | - public static function getDefault () { |
|
| 62 | + public static function getDefault() { |
|
| 63 | 63 | return self::$default; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @return LoggerInterface |
| 68 | 68 | */ |
| 69 | - public static function getLogger () { |
|
| 69 | + public static function getLogger() { |
|
| 70 | 70 | return static::$logger |
| 71 | 71 | ?? static::$logger = new class implements LoggerInterface { |
| 72 | 72 | |
| 73 | - public function log (string $message, string $path, array $data = null): void { |
|
| 73 | + public function log(string $message, string $path, array $data = null): void { |
|
| 74 | 74 | // stub |
| 75 | 75 | } |
| 76 | 76 | |
@@ -80,28 +80,28 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @param Cache $cache |
| 82 | 82 | */ |
| 83 | - public static function setCache (Cache $cache) { |
|
| 83 | + public static function setCache(Cache $cache) { |
|
| 84 | 84 | static::$cache = $cache; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * @param Api $default |
| 89 | 89 | */ |
| 90 | - public static function setDefault (Api $default) { |
|
| 90 | + public static function setDefault(Api $default) { |
|
| 91 | 91 | self::$default = $default; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @param LoggerInterface $logger |
| 96 | 96 | */ |
| 97 | - public static function setLogger (LoggerInterface $logger) { |
|
| 97 | + public static function setLogger(LoggerInterface $logger) { |
|
| 98 | 98 | static::$logger = $logger; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @param string $token |
| 103 | 103 | */ |
| 104 | - public function __construct (string $token) { |
|
| 104 | + public function __construct(string $token) { |
|
| 105 | 105 | $this->token = $token; |
| 106 | 106 | if (!static::$default) { |
| 107 | 107 | static::$default = $this; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return null|array |
| 118 | 118 | * @internal |
| 119 | 119 | */ |
| 120 | - protected function _exec (string $method, string $path, array $opts = []) { |
|
| 120 | + protected function _exec(string $method, string $path, array $opts = []) { |
|
| 121 | 121 | static::getLogger()->log($method, $path, $opts); |
| 122 | 122 | /** @var resource $ch */ |
| 123 | 123 | $ch = curl_init(); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return string |
| 167 | 167 | * @internal |
| 168 | 168 | */ |
| 169 | - protected function _getPath (string $path, array $query): string { |
|
| 169 | + protected function _getPath(string $path, array $query): string { |
|
| 170 | 170 | return $query ? $path . '?' . http_build_query($query) : $path; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | * @return null|array |
| 176 | 176 | * @internal |
| 177 | 177 | */ |
| 178 | - protected function _jsonDecode (string $json) { |
|
| 179 | - return json_decode($json, true, JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR); |
|
| 178 | + protected function _jsonDecode(string $json) { |
|
| 179 | + return json_decode($json, true, JSON_BIGINT_AS_STRING|JSON_THROW_ON_ERROR); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | * @return string |
| 185 | 185 | * @internal |
| 186 | 186 | */ |
| 187 | - protected function _jsonEncode (array $data): string { |
|
| 188 | - return json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); |
|
| 187 | + protected function _jsonEncode(array $data): string { |
|
| 188 | + return json_encode($data, JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @param string $path |
| 195 | 195 | */ |
| 196 | - public function delete (string $path): void { |
|
| 196 | + public function delete(string $path): void { |
|
| 197 | 197 | $this->_exec('DELETE', $path); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @param array $data |
| 208 | 208 | * @return mixed|Data|AbstractEntity |
| 209 | 209 | */ |
| 210 | - public function factory (string $class, $caller, array $data = []) { |
|
| 210 | + public function factory(string $class, $caller, array $data = []) { |
|
| 211 | 211 | return new $class($caller, $data); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param array $options |
| 220 | 220 | * @return null|array |
| 221 | 221 | */ |
| 222 | - public function get (string $path, array $query = [], array $options = []) { |
|
| 222 | + public function get(string $path, array $query = [], array $options = []) { |
|
| 223 | 223 | foreach ($options as $name => $value) { |
| 224 | 224 | $query["opt_{$name}"] = $value; |
| 225 | 225 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $gid |
| 234 | 234 | * @return null|Attachment |
| 235 | 235 | */ |
| 236 | - public function getAttachment (string $gid) { |
|
| 236 | + public function getAttachment(string $gid) { |
|
| 237 | 237 | return $this->load(Attachment::class, $this, "attachments/{$gid}"); |
| 238 | 238 | } |
| 239 | 239 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $gid |
| 244 | 244 | * @return null|CustomField |
| 245 | 245 | */ |
| 246 | - public function getCustomField (string $gid) { |
|
| 246 | + public function getCustomField(string $gid) { |
|
| 247 | 247 | return $this->load(CustomField::class, $this, "custom_fields/{$gid}"); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return User |
| 254 | 254 | */ |
| 255 | - public function getMe () { |
|
| 255 | + public function getMe() { |
|
| 256 | 256 | return $this->getUser('me'); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @param string $gid |
| 263 | 263 | * @return null|Portfolio |
| 264 | 264 | */ |
| 265 | - public function getPortfolio (string $gid) { |
|
| 265 | + public function getPortfolio(string $gid) { |
|
| 266 | 266 | return $this->load(Portfolio::class, $this, "portfolios/{$gid}"); |
| 267 | 267 | } |
| 268 | 268 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param string $gid |
| 273 | 273 | * @return null|Project |
| 274 | 274 | */ |
| 275 | - public function getProject (string $gid) { |
|
| 275 | + public function getProject(string $gid) { |
|
| 276 | 276 | return $this->load(Project::class, $this, "projects/{$gid}"); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param string $gid |
| 283 | 283 | * @return null|Section |
| 284 | 284 | */ |
| 285 | - public function getSection (string $gid) { |
|
| 285 | + public function getSection(string $gid) { |
|
| 286 | 286 | return $this->load(Section::class, $this, "sections/{$gid}"); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param string $gid |
| 293 | 293 | * @return null|Story |
| 294 | 294 | */ |
| 295 | - public function getStory (string $gid) { |
|
| 295 | + public function getStory(string $gid) { |
|
| 296 | 296 | return $this->load(Story::class, $this, "stories/{$gid}"); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @param string $gid |
| 303 | 303 | * @return null|Tag |
| 304 | 304 | */ |
| 305 | - public function getTag (string $gid) { |
|
| 305 | + public function getTag(string $gid) { |
|
| 306 | 306 | return $this->load(Tag::class, $this, "tags/{$gid}"); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param string $gid |
| 313 | 313 | * @return null|Task |
| 314 | 314 | */ |
| 315 | - public function getTask (string $gid) { |
|
| 315 | + public function getTask(string $gid) { |
|
| 316 | 316 | return $this->load(Task::class, $this, "tasks/{$gid}"); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @param string $gid |
| 323 | 323 | * @return null|Team |
| 324 | 324 | */ |
| 325 | - public function getTeam (string $gid) { |
|
| 325 | + public function getTeam(string $gid) { |
|
| 326 | 326 | return $this->load(Team::class, $this, "teams/{$gid}"); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * @param string $gid |
| 333 | 333 | * @return null|User |
| 334 | 334 | */ |
| 335 | - public function getUser (string $gid) { |
|
| 335 | + public function getUser(string $gid) { |
|
| 336 | 336 | return $this->load(User::class, $this, "users/{$gid}"); |
| 337 | 337 | } |
| 338 | 338 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * @param array $data |
| 345 | 345 | * @return ProjectEvent|TaskEvent|StoryEvent |
| 346 | 346 | */ |
| 347 | - public function getWebhookEvent (array $data) { |
|
| 347 | + public function getWebhookEvent(array $data) { |
|
| 348 | 348 | static $classes = [ |
| 349 | 349 | Project::TYPE => ProjectEvent::class, |
| 350 | 350 | Task::TYPE => TaskEvent::class, |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @param string $gid |
| 360 | 360 | * @return null|Workspace |
| 361 | 361 | */ |
| 362 | - public function getWorkspace (string $gid) { |
|
| 362 | + public function getWorkspace(string $gid) { |
|
| 363 | 363 | return $this->load(Workspace::class, $this, "workspaces/{$gid}"); |
| 364 | 364 | } |
| 365 | 365 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * @param string $name |
| 370 | 370 | * @return null|Workspace |
| 371 | 371 | */ |
| 372 | - public function getWorkspaceByName (string $name) { |
|
| 372 | + public function getWorkspaceByName(string $name) { |
|
| 373 | 373 | foreach ($this->getMe()->getWorkspaces() as $workspace) { |
| 374 | 374 | if ($workspace->getName() === $name) { |
| 375 | 375 | return $workspace; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * @param array $query |
| 390 | 390 | * @return null|mixed|AbstractEntity |
| 391 | 391 | */ |
| 392 | - public function load (string $class, $caller, string $path, array $query = []) { |
|
| 392 | + public function load(string $class, $caller, string $path, array $query = []) { |
|
| 393 | 393 | $key = $this->_getPath($path, $query); |
| 394 | 394 | return $this->getCache()->get($key, $caller, function($caller) use ($class, $path, $query) { |
| 395 | 395 | $data = $this->get($path, $query, ['expand' => 'this']); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | * @param int $pages If positive, stops after this many pages have been fetched. |
| 410 | 410 | * @return array|AbstractEntity[] |
| 411 | 411 | */ |
| 412 | - public function loadAll (string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
| 412 | + public function loadAll(string $class, $caller, string $path, array $query = [], int $pages = 0) { |
|
| 413 | 413 | $query['opt_expand'] = 'this'; |
| 414 | 414 | $query += ['limit' => 100]; |
| 415 | 415 | $path = $this->_getPath($path, $query); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * @param array $options |
| 436 | 436 | * @return null|array |
| 437 | 437 | */ |
| 438 | - public function post (string $path, array $data = [], array $options = []) { |
|
| 438 | + public function post(string $path, array $data = [], array $options = []) { |
|
| 439 | 439 | $response = $this->_exec('POST', $path, [ |
| 440 | 440 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 441 | 441 | CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data]) |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * @param array $options |
| 452 | 452 | * @return null|array |
| 453 | 453 | */ |
| 454 | - public function put (string $path, array $data = [], array $options = []) { |
|
| 454 | + public function put(string $path, array $data = [], array $options = []) { |
|
| 455 | 455 | $response = $this->_exec('PUT', $path, [ |
| 456 | 456 | CURLOPT_HTTPHEADER => ['Content-Type: application/json'], |
| 457 | 457 | CURLOPT_POSTFIELDS => $this->_jsonEncode(['options' => $options, 'data' => $data]) |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * @param null|string $token |
| 471 | 471 | * @return ProjectEvent[]|TaskEvent[]|StoryEvent[] |
| 472 | 472 | */ |
| 473 | - public function sync ($entity, ?string &$token) { |
|
| 473 | + public function sync($entity, ?string &$token) { |
|
| 474 | 474 | try { |
| 475 | 475 | $response = $this->_exec('GET', $this->_getPath('events', [ |
| 476 | 476 | 'resource' => $entity->getGid(), |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @param string $file |
| 506 | 506 | * @return null|array |
| 507 | 507 | */ |
| 508 | - public function upload (string $path, string $file) { |
|
| 508 | + public function upload(string $path, string $file) { |
|
| 509 | 509 | $response = $this->_exec('POST', $path, [ |
| 510 | 510 | CURLOPT_POSTFIELDS => ['file' => new CURLFile(realpath($file))] // multipart/form-data |
| 511 | 511 | ]); |
@@ -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 |
@@ -49,21 +49,21 @@ |
||
| 49 | 49 | /** |
| 50 | 50 | * @return Api |
| 51 | 51 | */ |
| 52 | - final public static function getApi () { |
|
| 52 | + final public static function getApi() { |
|
| 53 | 53 | return static::getFacadeRoot(); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @return string |
| 58 | 58 | */ |
| 59 | - public static function getFacadeAccessor () { |
|
| 59 | + public static function getFacadeAccessor() { |
|
| 60 | 60 | return AsanaServiceProvider::NAME; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @return Api |
| 65 | 65 | */ |
| 66 | - public static function getFacadeRoot () { |
|
| 66 | + public static function getFacadeRoot() { |
|
| 67 | 67 | return parent::getFacadeRoot(); |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -41,11 +41,9 @@ |
||
| 41 | 41 | if ($field['type'] === CustomField::TYPE_ENUM) { |
| 42 | 42 | $this->optionNames[$gid] = array_column($field['enum_options'], 'name', 'gid'); |
| 43 | 43 | $this->data[$gid] = $field['enum_value']['gid']; |
| 44 | - } |
|
| 45 | - elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
| 44 | + } elseif ($field['type'] === CustomField::TYPE_TEXT) { |
|
| 46 | 45 | $this->data[$gid] = $field['text_value']; |
| 47 | - } |
|
| 48 | - elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
| 46 | + } elseif ($field['type'] === CustomField::TYPE_NUMBER) { |
|
| 49 | 47 | $this->data[$gid] = $field['number_value']; |
| 50 | 48 | } |
| 51 | 49 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | protected $task; |
| 41 | 41 | |
| 42 | - public function __construct (Task $task, array $fields) { |
|
| 42 | + public function __construct(Task $task, array $fields) { |
|
| 43 | 43 | parent::__construct($task); |
| 44 | 44 | $this->task = $task; |
| 45 | 45 | foreach ($fields as $field) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @return int |
| 62 | 62 | */ |
| 63 | - public function count () { |
|
| 63 | + public function count() { |
|
| 64 | 64 | return count($this->data); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string $enumGid |
| 69 | 69 | * @return null|string |
| 70 | 70 | */ |
| 71 | - public function getCurrentOptionName (string $enumGid): ?string { |
|
| 71 | + public function getCurrentOptionName(string $enumGid): ?string { |
|
| 72 | 72 | return $this->optionNames[$enumGid][$this[$enumGid]] ?? null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $fieldName |
| 77 | 77 | * @return null|string |
| 78 | 78 | */ |
| 79 | - public function getGid (string $fieldName) { |
|
| 79 | + public function getGid(string $fieldName) { |
|
| 80 | 80 | return $this->gids[$fieldName] ?? null; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return string[] |
| 87 | 87 | */ |
| 88 | - public function getGids () { |
|
| 88 | + public function getGids() { |
|
| 89 | 89 | return $this->gids; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @return Traversable |
| 94 | 94 | */ |
| 95 | - public function getIterator () { |
|
| 95 | + public function getIterator() { |
|
| 96 | 96 | return new ArrayIterator($this->data); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $fieldGid |
| 101 | 101 | * @return null|string |
| 102 | 102 | */ |
| 103 | - public function getName (string $fieldGid): ?string { |
|
| 103 | + public function getName(string $fieldGid): ?string { |
|
| 104 | 104 | return array_search($fieldGid, $this->gids) ?: null; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return string[] |
| 111 | 111 | */ |
| 112 | - public function getNames () { |
|
| 112 | + public function getNames() { |
|
| 113 | 113 | return array_flip($this->gids); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $optionName |
| 119 | 119 | * @return null|string |
| 120 | 120 | */ |
| 121 | - public function getOptionGid (string $enumGid, string $optionName) { |
|
| 121 | + public function getOptionGid(string $enumGid, string $optionName) { |
|
| 122 | 122 | return array_search($optionName, $this->optionNames[$enumGid]) ?: null; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param string $enumGid |
| 129 | 129 | * @return string[] |
| 130 | 130 | */ |
| 131 | - public function getOptionGids (string $enumGid) { |
|
| 131 | + public function getOptionGids(string $enumGid) { |
|
| 132 | 132 | return array_flip($this->optionNames[$enumGid]); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $optionGid |
| 138 | 138 | * @return null|string |
| 139 | 139 | */ |
| 140 | - public function getOptionName (string $enumGid, string $optionGid): ?string { |
|
| 140 | + public function getOptionName(string $enumGid, string $optionGid): ?string { |
|
| 141 | 141 | return $this->optionNames[$enumGid][$optionGid] ?? null; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $enumGid |
| 148 | 148 | * @return string[] |
| 149 | 149 | */ |
| 150 | - public function getOptionNames (string $enumGid) { |
|
| 150 | + public function getOptionNames(string $enumGid) { |
|
| 151 | 151 | return $this->optionNames[$enumGid]; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param string $fieldGid |
| 156 | 156 | * @return null|number|string |
| 157 | 157 | */ |
| 158 | - public function getValue (string $fieldGid) { |
|
| 158 | + public function getValue(string $fieldGid) { |
|
| 159 | 159 | return $this->data[$fieldGid] ?? null; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param string $fieldGid |
| 164 | 164 | * @return bool |
| 165 | 165 | */ |
| 166 | - public function offsetExists ($fieldGid) { |
|
| 166 | + public function offsetExists($fieldGid) { |
|
| 167 | 167 | return array_key_exists($fieldGid, $this->data); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $fieldGid |
| 172 | 172 | * @return null|number|string |
| 173 | 173 | */ |
| 174 | - public function offsetGet ($fieldGid) { |
|
| 174 | + public function offsetGet($fieldGid) { |
|
| 175 | 175 | return $this->getValue($fieldGid); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param string $fieldGid |
| 180 | 180 | * @param null|number|string $value |
| 181 | 181 | */ |
| 182 | - public function offsetSet ($fieldGid, $value) { |
|
| 182 | + public function offsetSet($fieldGid, $value) { |
|
| 183 | 183 | $this->setValue($fieldGid, $value); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @param string $fieldGid |
| 190 | 190 | */ |
| 191 | - public function offsetUnset ($fieldGid) { |
|
| 191 | + public function offsetUnset($fieldGid) { |
|
| 192 | 192 | $this->setValue($fieldGid, null); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param null|number|string $value |
| 198 | 198 | * @return $this |
| 199 | 199 | */ |
| 200 | - public function setValue (string $fieldGid, $value) { |
|
| 200 | + public function setValue(string $fieldGid, $value) { |
|
| 201 | 201 | $this->data[$fieldGid] = $value; |
| 202 | 202 | $this->diff[$fieldGid] = true; |
| 203 | 203 | $this->task->diff['custom_fields'] = true; |
@@ -31,18 +31,18 @@ |
||
| 31 | 31 | 'workspace' => Workspace::class |
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | - final public function __toString (): string { |
|
| 34 | + final public function __toString(): string { |
|
| 35 | 35 | return "tags/{$this->getGid()}"; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - final protected function _getDir (): string { |
|
| 38 | + final protected function _getDir(): string { |
|
| 39 | 39 | return 'tags'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @return Task[] |
| 44 | 44 | */ |
| 45 | - public function getTasks () { |
|
| 45 | + public function getTasks() { |
|
| 46 | 46 | return $this->loadAll(Task::class, "{$this}/tasks"); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -52,23 +52,23 @@ |
||
| 52 | 52 | * @param Project $project |
| 53 | 53 | * @param array $data |
| 54 | 54 | */ |
| 55 | - public function __construct (Project $project, array $data = []) { |
|
| 55 | + public function __construct(Project $project, array $data = []) { |
|
| 56 | 56 | parent::__construct($project, $data); |
| 57 | 57 | $this->project = $project; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - final public function __toString (): string { |
|
| 60 | + final public function __toString(): string { |
|
| 61 | 61 | return "project_statuses/{$this->getGid()}"; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - final protected function _getDir (): string { |
|
| 64 | + final protected function _getDir(): string { |
|
| 65 | 65 | return "{$this->project}/project_statuses"; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @return Project |
| 70 | 70 | */ |
| 71 | - public function getProject () { |
|
| 71 | + public function getProject() { |
|
| 72 | 72 | return $this->project; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | \ No newline at end of file |
@@ -14,11 +14,11 @@ |
||
| 14 | 14 | |
| 15 | 15 | const NAME = 'asana'; |
| 16 | 16 | |
| 17 | - public function boot () { |
|
| 17 | + public function boot() { |
|
| 18 | 18 | $this->mergeConfigFrom(App::configPath('asana.php'), self::NAME); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function register () { |
|
| 21 | + public function register() { |
|
| 22 | 22 | // cli: announce config file |
| 23 | 23 | if (App::runningInConsole() and !Str::contains($this->app->version(), 'Lumen')) { |
| 24 | 24 | $this->publishes([__DIR__ . '/config/asana.php' => App::configPath('asana.php')], 'config'); |