@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getClickupTokenAttribute() |
| 69 | 69 | { |
| 70 | - return is_null($this->attributes['clickup_token'] ?? null) |
|
| 70 | + return is_null($this->attributes[ 'clickup_token' ] ?? null) |
|
| 71 | 71 | ? null |
| 72 | - : Crypt::decrypt($this->attributes['clickup_token']); |
|
| 72 | + : Crypt::decrypt($this->attributes[ 'clickup_token' ]); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function initializeHasClickUp() |
| 79 | 79 | { |
| 80 | - $this->fillable[] = 'clickup_token'; |
|
| 81 | - $this->hidden[] = 'clickup'; |
|
| 82 | - $this->hidden[] = 'clickup_token'; |
|
| 80 | + $this->fillable[ ] = 'clickup_token'; |
|
| 81 | + $this->hidden[ ] = 'clickup'; |
|
| 82 | + $this->hidden[ ] = 'clickup_token'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -94,6 +94,6 @@ discard block |
||
| 94 | 94 | $this->builder = null; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $this->attributes['clickup_token'] = is_null($clickup_token) ? null : Crypt::encrypt($clickup_token); |
|
| 97 | + $this->attributes[ 'clickup_token' ] = is_null($clickup_token) ? null : Crypt::encrypt($clickup_token); |
|
| 98 | 98 | } |
| 99 | 99 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function delete($path): array |
| 61 | 61 | { |
| 62 | - return $this->request($path, [], 'DELETE'); |
|
| 62 | + return $this->request($path, [ ], 'DELETE'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @throws GuzzleException |
| 118 | 118 | * @throws TokenException |
| 119 | 119 | */ |
| 120 | - public function request($path, $data = [], $method = 'GET'): ?array |
|
| 120 | + public function request($path, $data = [ ], $method = 'GET'): ?array |
|
| 121 | 121 | { |
| 122 | 122 | if (!$this->token) { |
| 123 | 123 | throw new TokenException('Must set token before making a request'); |
@@ -187,6 +187,6 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function uri($path = null): string |
| 189 | 189 | { |
| 190 | - return rtrim($this->configs['url'], '/') . '/' . ltrim($path, '/'); |
|
| 190 | + return rtrim($this->configs[ 'url' ], '/') . '/' . ltrim($path, '/'); |
|
| 191 | 191 | } |
| 192 | 192 | } |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | */ |
| 131 | 131 | public function tasks(): HasMany |
| 132 | 132 | { |
| 133 | - if (in_array($this->type, ['conversation', 'doc', 'embed'])) { |
|
| 133 | + if (in_array($this->type, [ 'conversation', 'doc', 'embed' ])) { |
|
| 134 | 134 | throw new InvalidRelationshipException( |
| 135 | 135 | sprintf('The view is of type [%s], but must be of on of the task types to have tasks.', $this->type) |
| 136 | 136 | ); |
@@ -63,14 +63,14 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $this->app->bind( |
| 65 | 65 | Builder::class, |
| 66 | - function (Application $app) { |
|
| 66 | + function(Application $app) { |
|
| 67 | 67 | return new Builder($app->make(ClickUp::class)); |
| 68 | 68 | } |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | $this->app->bind( |
| 72 | 72 | ClickUp::class, |
| 73 | - function (Application $app) { |
|
| 73 | + function(Application $app) { |
|
| 74 | 74 | return new ClickUp(Config::get('clickup'), $app->make(Guzzle::class)); |
| 75 | 75 | } |
| 76 | 76 | ); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @var array |
| 101 | 101 | */ |
| 102 | - protected $relations = []; |
|
| 102 | + protected $relations = [ ]; |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Some of the responses have the collections under a property |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param array|null $attributes |
| 136 | 136 | * @param Model|null $parentModel |
| 137 | 137 | */ |
| 138 | - public function __construct(array $attributes = [], Model $parentModel = null) |
|
| 138 | + public function __construct(array $attributes = [ ], Model $parentModel = null) |
|
| 139 | 139 | { |
| 140 | 140 | // All dates from API comes as epoch |
| 141 | 141 | $this->dateFormat = 'U'; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * |
| 301 | 301 | * @return $this |
| 302 | 302 | */ |
| 303 | - public function fill(array $attributes = []): self |
|
| 303 | + public function fill(array $attributes = [ ]): self |
|
| 304 | 304 | { |
| 305 | 305 | foreach ($attributes as $attribute => $value) { |
| 306 | 306 | $this->setAttribute($attribute, $value); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * |
| 360 | 360 | * @return string |
| 361 | 361 | */ |
| 362 | - public function getPath($extra = null, array $query = []): ?string |
|
| 362 | + public function getPath($extra = null, array $query = [ ]): ?string |
|
| 363 | 363 | { |
| 364 | 364 | // Start with path to resource without "/" on end |
| 365 | 365 | $path = rtrim($this->path, '/'); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | return tap( |
| 424 | 424 | $relation->getResults(), |
| 425 | - function ($results) use ($method) { |
|
| 425 | + function($results) use ($method) { |
|
| 426 | 426 | $this->setRelation($method, $results); |
| 427 | 427 | } |
| 428 | 428 | ); |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | public function givenMany($related, $given, $reset = false): Collection |
| 466 | 466 | { |
| 467 | 467 | /** @var Model $model */ |
| 468 | - $model = (new $related([], $this->parentModel))->setClient($this->getClient()); |
|
| 468 | + $model = (new $related([ ], $this->parentModel))->setClient($this->getClient()); |
|
| 469 | 469 | |
| 470 | 470 | return (new Collection($given))->map( |
| 471 | - function ($attributes) use ($model, $reset) { |
|
| 471 | + function($attributes) use ($model, $reset) { |
|
| 472 | 472 | return $model->newFromBuilder($reset ? reset($attributes) : $attributes); |
| 473 | 473 | } |
| 474 | 474 | ); |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | public function givenOne($related, $attributes, $reset = false): Model |
| 488 | 488 | { |
| 489 | - return (new $related([], $this->parentModel))->setClient($this->getClient()) |
|
| 489 | + return (new $related([ ], $this->parentModel))->setClient($this->getClient()) |
|
| 490 | 490 | ->newFromBuilder($reset ? reset($attributes) : $attributes); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -536,9 +536,9 @@ discard block |
||
| 536 | 536 | * |
| 537 | 537 | * @return static |
| 538 | 538 | */ |
| 539 | - public function newFromBuilder($attributes = []): self |
|
| 539 | + public function newFromBuilder($attributes = [ ]): self |
|
| 540 | 540 | { |
| 541 | - $model = $this->newInstance([], true); |
|
| 541 | + $model = $this->newInstance([ ], true); |
|
| 542 | 542 | |
| 543 | 543 | $model->setRawAttributes((array)$attributes, true); |
| 544 | 544 | |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | * |
| 557 | 557 | * @return static |
| 558 | 558 | */ |
| 559 | - public function newInstance(array $attributes = [], $exists = false): self |
|
| 559 | + public function newInstance(array $attributes = [ ], $exists = false): self |
|
| 560 | 560 | { |
| 561 | 561 | $model = (new static($attributes, $this->parentModel))->setClient($this->client); |
| 562 | 562 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | */ |
| 617 | 617 | public function offsetUnset($offset): void |
| 618 | 618 | { |
| 619 | - unset($this->attributes[$offset], $this->relations[$offset]); |
|
| 619 | + unset($this->attributes[ $offset ], $this->relations[ $offset ]); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | public function setRelation($relation, $value): self |
| 724 | 724 | { |
| 725 | - $this->relations[$relation] = $value; |
|
| 725 | + $this->relations[ $relation ] = $value; |
|
| 726 | 726 | |
| 727 | 727 | return $this; |
| 728 | 728 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @var array |
| 74 | 74 | */ |
| 75 | - protected $wheres = []; |
|
| 75 | + protected $wheres = [ ]; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Magic method to make builders for root models |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function __call($name, $arguments) |
| 89 | 89 | { |
| 90 | 90 | if (!$this->parentModel && array_key_exists($name, $this->rootModels)) { |
| 91 | - return $this->newInstanceForModel($this->rootModels[$name]); |
|
| 91 | + return $this->newInstanceForModel($this->rootModels[ $name ]); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | throw new BadMethodCallException(sprintf("Call to undefined method [%s]", $name)); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | return tap( |
| 126 | 126 | $this->make($attributes), |
| 127 | - function (Model $model) { |
|
| 127 | + function(Model $model) { |
|
| 128 | 128 | $model->save(); |
| 129 | 129 | } |
| 130 | 130 | ); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @throws NoClientException |
| 142 | 142 | * @throws TokenException |
| 143 | 143 | */ |
| 144 | - public function get($properties = ['*']) |
|
| 144 | + public function get($properties = [ '*' ]) |
|
| 145 | 145 | { |
| 146 | 146 | $properties = Arr::wrap($properties); |
| 147 | 147 | |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | $response = $this->peelWrapperPropertyIfNeeded($response); |
| 154 | 154 | |
| 155 | 155 | // Convert to a collection of filtered objects casted to the class |
| 156 | - return (new Collection((array_values($response) === $response) ? $response : [$response]))->map( |
|
| 157 | - function ($items) use ($properties) { |
|
| 156 | + return (new Collection((array_values($response) === $response) ? $response : [ $response ]))->map( |
|
| 157 | + function($items) use ($properties) { |
|
| 158 | 158 | // Cast to class with only the requested, properties |
| 159 | 159 | return $this->getModel() |
| 160 | 160 | ->newFromBuilder( |
| 161 | - $properties === ['*'] |
|
| 161 | + $properties === [ '*' ] |
|
| 162 | 162 | ? (array)$items |
| 163 | 163 | : collect($items) |
| 164 | 164 | ->only($properties) |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (!$this->model) { |
| 185 | - $this->model = (new $this->class([], $this->parentModel))->setClient($this->client); |
|
| 185 | + $this->model = (new $this->class([ ], $this->parentModel))->setClient($this->client); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $this->model; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @throws NoClientException |
| 216 | 216 | * @throws TokenException |
| 217 | 217 | */ |
| 218 | - public function find($id, $properties = ['*']): Model |
|
| 218 | + public function find($id, $properties = [ '*' ]): Model |
|
| 219 | 219 | { |
| 220 | 220 | return $this->where($this->getModel()->getKeyName(), $id) |
| 221 | 221 | ->get($properties) |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @return Model |
| 231 | 231 | * @throws InvalidRelationshipException |
| 232 | 232 | */ |
| 233 | - public function make(array $attributes = []): Model |
|
| 233 | + public function make(array $attributes = [ ]): Model |
|
| 234 | 234 | { |
| 235 | 235 | // TODO: Make sure that the model supports "creating" |
| 236 | 236 | return $this->getModel() |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | ->getResponseKey(), |
| 283 | 283 | $properties |
| 284 | 284 | )) { |
| 285 | - return $properties[$this->getModel() |
|
| 286 | - ->getResponseKey()]; |
|
| 285 | + return $properties[ $this->getModel() |
|
| 286 | + ->getResponseKey() ]; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Check for collection of responses |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | ->getResponseCollectionKey(), |
| 293 | 293 | $properties |
| 294 | 294 | )) { |
| 295 | - return $properties[$this->getModel() |
|
| 296 | - ->getResponseCollectionKey()]; |
|
| 295 | + return $properties[ $this->getModel() |
|
| 296 | + ->getResponseCollectionKey() ]; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | return $properties; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | return $this; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - $this->wheres[$property] = $value; |
|
| 355 | + $this->wheres[ $property ] = $value; |
|
| 356 | 356 | |
| 357 | 357 | return $this; |
| 358 | 358 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | Schema::table( |
| 17 | 17 | 'users', |
| 18 | - function (Blueprint $table) { |
|
| 18 | + function(Blueprint $table) { |
|
| 19 | 19 | $table->string('clickup_token') |
| 20 | 20 | ->after('password') |
| 21 | 21 | ->nullable(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | Schema::table( |
| 34 | 34 | 'users', |
| 35 | - function (Blueprint $table) { |
|
| 35 | + function(Blueprint $table) { |
|
| 36 | 36 | $table->dropColumn('clickup_token'); |
| 37 | 37 | } |
| 38 | 38 | ); |