Skip to content

Commit 7e84656

Browse files
committed
Fix styling
1 parent 698ecca commit 7e84656

File tree

12 files changed

+96
-121
lines changed

12 files changed

+96
-121
lines changed

src/Adapters/DefaultKanbanAdapter.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@
66

77
use Illuminate\Database\Eloquent\Builder;
88
use Livewire\Wireable;
9-
use Relaticle\Flowforge\Config\KanbanConfig;
10-
use Relaticle\Flowforge\Contracts\KanbanAdapterInterface;
119
use Relaticle\Flowforge\Concerns\CardFormattingTrait;
1210
use Relaticle\Flowforge\Concerns\CrudOperationsTrait;
1311
use Relaticle\Flowforge\Concerns\FormHandlingTrait;
1412
use Relaticle\Flowforge\Concerns\QueryHandlingTrait;
13+
use Relaticle\Flowforge\Config\KanbanConfig;
14+
use Relaticle\Flowforge\Contracts\KanbanAdapterInterface;
1515

1616
class DefaultKanbanAdapter implements KanbanAdapterInterface, Wireable
1717
{
18-
use QueryHandlingTrait;
1918
use CardFormattingTrait;
2019
use CrudOperationsTrait;
2120
use FormHandlingTrait;
21+
use QueryHandlingTrait;
2222

2323
/**
2424
* The base Eloquent query builder.
25-
*
26-
* @var Builder
2725
*/
2826
public Builder $baseQuery;
2927

@@ -45,9 +43,6 @@ public function getConfig(): KanbanConfig
4543
return $this->config;
4644
}
4745

48-
/**
49-
* @return array
50-
*/
5146
public function toLivewire(): array
5247
{
5348
return [
@@ -56,10 +51,6 @@ public function toLivewire(): array
5651
];
5752
}
5853

59-
/**
60-
* @param $value
61-
* @return static
62-
*/
6354
public static function fromLivewire($value): static
6455
{
6556
$query = \EloquentSerialize::unserialize($value['query']);

src/Concerns/CardFormattingTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait CardFormattingTrait
1515
/**
1616
* Format a model as a card for display.
1717
*
18-
* @param Model $model The model to format
18+
* @param Model $model The model to format
1919
* @return array<string, mixed> The formatted card
2020
*/
2121
protected function formatCardForDisplay(Model $model): array
@@ -49,7 +49,7 @@ protected function formatCardForDisplay(Model $model): array
4949
/**
5050
* Format a collection of models as cards for display.
5151
*
52-
* @param Collection $models The models to format
52+
* @param Collection $models The models to format
5353
* @return Collection The formatted cards
5454
*/
5555
protected function formatCardsForDisplay(Collection $models): Collection

src/Concerns/CrudOperationsTrait.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait CrudOperationsTrait
1414
/**
1515
* Create a new card with the given attributes.
1616
*
17-
* @param array<string, mixed> $attributes The card attributes
17+
* @param array<string, mixed> $attributes The card attributes
1818
*/
1919
public function createRecord(array $attributes): ?Model
2020
{
@@ -44,8 +44,8 @@ public function createRecord(array $attributes): ?Model
4444
/**
4545
* Update an existing card with the given attributes.
4646
*
47-
* @param Model $record The card to update
48-
* @param array<string, mixed> $attributes The card attributes to update
47+
* @param Model $record The card to update
48+
* @param array<string, mixed> $attributes The card attributes to update
4949
*/
5050
public function updateRecord(Model $record, array $attributes): bool
5151
{
@@ -57,7 +57,7 @@ public function updateRecord(Model $record, array $attributes): bool
5757
/**
5858
* Delete an existing card.
5959
*
60-
* @param Model $card The card to delete
60+
* @param Model $card The card to delete
6161
*/
6262
public function deleteRecord(Model $card): bool
6363
{
@@ -67,11 +67,11 @@ public function deleteRecord(Model $card): bool
6767
/**
6868
* Update the order of cards in a column.
6969
*
70-
* @param string|int $columnId The column ID
71-
* @param array<int, mixed> $cardIds The card IDs in their new order
70+
* @param string|int $columnId The column ID
71+
* @param array<int, mixed> $cardIds The card IDs in their new order
7272
* @return bool Whether the operation was successful
7373
*/
74-
public function updateRecordsOrderAndColumn(string|int $columnId, array $cardIds): bool
74+
public function updateRecordsOrderAndColumn(string | int $columnId, array $cardIds): bool
7575
{
7676
$orderField = $this->config->getOrderField();
7777
$columnField = $this->config->getColumnField();
@@ -82,6 +82,7 @@ public function updateRecordsOrderAndColumn(string|int $columnId, array $cardIds
8282

8383
if ($model === null) {
8484
$success = false;
85+
8586
continue;
8687
}
8788

@@ -90,7 +91,7 @@ public function updateRecordsOrderAndColumn(string|int $columnId, array $cardIds
9091
}
9192
$model->{$columnField} = $columnId;
9293

93-
if (!$model->save()) {
94+
if (! $model->save()) {
9495
$success = false;
9596
}
9697
}

src/Concerns/FormHandlingTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ trait FormHandlingTrait
1515
/**
1616
* Get the form for creating cards.
1717
*
18-
* @param Form $form The form instance
19-
* @param mixed $currentColumn The current column
18+
* @param Form $form The form instance
19+
* @param mixed $currentColumn The current column
2020
*/
2121
public function getCreateForm(Form $form, mixed $currentColumn): Form
2222
{
@@ -38,7 +38,7 @@ public function getCreateForm(Form $form, mixed $currentColumn): Form
3838
/**
3939
* Get the form for editing cards.
4040
*
41-
* @param Form $form The form instance
41+
* @param Form $form The form instance
4242
*/
4343
public function getEditForm(Form $form): Form
4444
{

src/Concerns/QueryHandlingTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function newQuery(): Builder
2424
/**
2525
* Find a model by its ID.
2626
*
27-
* @param mixed $id The model ID
27+
* @param mixed $id The model ID
2828
*/
2929
public function getModelById(mixed $id): ?Model
3030
{
@@ -53,10 +53,10 @@ public function getItems(): Collection
5353
/**
5454
* Get items for a specific column with pagination.
5555
*
56-
* @param string|int $columnId The column ID
57-
* @param int $limit The number of items to return
56+
* @param string|int $columnId The column ID
57+
* @param int $limit The number of items to return
5858
*/
59-
public function getItemsForColumn(string|int $columnId, int $limit = 10): Collection
59+
public function getItemsForColumn(string | int $columnId, int $limit = 10): Collection
6060
{
6161
$columnField = $this->config->getColumnField();
6262
$orderField = $this->config->getOrderField();
@@ -75,9 +75,9 @@ public function getItemsForColumn(string|int $columnId, int $limit = 10): Collec
7575
/**
7676
* Get the total count of items for a specific column.
7777
*
78-
* @param string|int $columnId The column ID
78+
* @param string|int $columnId The column ID
7979
*/
80-
public function getColumnItemsCount(string|int $columnId): int
80+
public function getColumnItemsCount(string | int $columnId): int
8181
{
8282
$columnField = $this->config->getColumnField();
8383

src/Config/KanbanConfig.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@
2828
final readonly class KanbanConfig
2929
{
3030
public function __construct(
31-
private string $columnField = 'status',
32-
private array $columnValues = [],
33-
private ?array $columnColors = null,
34-
private string $titleField = 'title',
31+
private string $columnField = 'status',
32+
private array $columnValues = [],
33+
private ?array $columnColors = null,
34+
private string $titleField = 'title',
3535
private ?string $descriptionField = null,
36-
private array $cardAttributes = [],
36+
private array $cardAttributes = [],
3737
private ?string $orderField = null,
3838
private ?string $cardLabel = null,
3939
private ?string $pluralCardLabel = null,
40-
) {
41-
}
40+
) {}
4241

4342
/**
4443
* Get the field that stores the column value.
@@ -133,8 +132,8 @@ public function getPluralCardLabel(): ?string
133132
/**
134133
* Get the default form schema for creating cards.
135134
*
136-
* @param string $titleField The field name used for card titles
137-
* @param string|null $descriptionField Optional field name for card descriptions
135+
* @param string $titleField The field name used for card titles
136+
* @param string|null $descriptionField Optional field name for card descriptions
138137
* @return array<\Filament\Forms\Components\Component> The default form schema
139138
*/
140139
public static function getDefaultCreateFormSchema(string $titleField, ?string $descriptionField): array
@@ -155,10 +154,10 @@ public static function getDefaultCreateFormSchema(string $titleField, ?string $d
155154
/**
156155
* Get the default form schema for editing cards.
157156
*
158-
* @param string $titleField The field name used for card titles
159-
* @param string|null $descriptionField Optional field name for card descriptions
160-
* @param string $columnField The field name that determines which column a card belongs to
161-
* @param array<string, string> $columnValues Available column values with their labels
157+
* @param string $titleField The field name used for card titles
158+
* @param string|null $descriptionField Optional field name for card descriptions
159+
* @param string $columnField The field name that determines which column a card belongs to
160+
* @param array<string, string> $columnValues Available column values with their labels
162161
* @return array<\Filament\Forms\Components\Component> The default form schema
163162
*/
164163
public static function getDefaultEditFormSchema(
@@ -192,20 +191,21 @@ public static function getDefaultEditFormSchema(
192191
* For example, `withColumnField('status')` will create a new configuration
193192
* with the columnField property set to 'status'.
194193
*
195-
* @param string $method The method name
196-
* @param array $arguments The method arguments
194+
* @param string $method The method name
195+
* @param array $arguments The method arguments
197196
* @return self A new instance with the updated property
197+
*
198198
* @throws \BadMethodCallException If the method is not a valid with* method or targets a non-existent property
199199
*/
200200
public function __call(string $method, array $arguments): self
201201
{
202-
if (!Str::startsWith($method, 'with')) {
202+
if (! Str::startsWith($method, 'with')) {
203203
throw new \BadMethodCallException("Method {$method} not found");
204204
}
205205

206206
$property = lcfirst(Str::after($method, 'with'));
207207

208-
if (!property_exists($this, $property)) {
208+
if (! property_exists($this, $property)) {
209209
throw new \BadMethodCallException("Property {$property} not found");
210210
}
211211

@@ -215,7 +215,7 @@ public function __call(string $method, array $arguments): self
215215
/**
216216
* Create a new configuration with the specified properties updated.
217217
*
218-
* @param array<string, mixed> $properties The properties to update
218+
* @param array<string, mixed> $properties The properties to update
219219
* @return self A new instance with the updated properties
220220
*/
221221
public function with(array $properties): self

src/Contracts/KanbanAdapterInterface.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function getConfig(): KanbanConfig;
2525
/**
2626
* Find a model by its ID.
2727
*
28-
* @param mixed $id The model ID
28+
* @param mixed $id The model ID
2929
*/
3030
public function getModelById(mixed $id): ?Model;
3131

@@ -37,60 +37,60 @@ public function getItems(): Collection;
3737
/**
3838
* Get items for a specific column with pagination.
3939
*
40-
* @param string|int $columnId The column ID
41-
* @param int $limit The number of items to return
40+
* @param string|int $columnId The column ID
41+
* @param int $limit The number of items to return
4242
*/
43-
public function getItemsForColumn(string|int $columnId, int $limit = 10): Collection;
43+
public function getItemsForColumn(string | int $columnId, int $limit = 10): Collection;
4444

4545
/**
4646
* Get the total count of items for a specific column.
4747
*
48-
* @param string|int $columnId The column ID
48+
* @param string|int $columnId The column ID
4949
*/
50-
public function getColumnItemsCount(string|int $columnId): int;
50+
public function getColumnItemsCount(string | int $columnId): int;
5151

5252
/**
5353
* Get the form for creating cards.
5454
*
55-
* @param Form $form The form instance
56-
* @param mixed $currentColumn The current column
55+
* @param Form $form The form instance
56+
* @param mixed $currentColumn The current column
5757
*/
5858
public function getCreateForm(Form $form, mixed $currentColumn): Form;
5959

6060
/**
6161
* Get the form for editing cards.
6262
*
63-
* @param Form $form The form instance
63+
* @param Form $form The form instance
6464
*/
6565
public function getEditForm(Form $form): Form;
6666

6767
/**
6868
* Create a new card with the given attributes.
6969
*
70-
* @param array<string, mixed> $attributes The card attributes
70+
* @param array<string, mixed> $attributes The card attributes
7171
*/
7272
public function createRecord(array $attributes): ?Model;
7373

7474
/**
7575
* Update an existing card with the given attributes.
7676
*
77-
* @param Model $card The card to update
78-
* @param array<string, mixed> $attributes The card attributes to update
77+
* @param Model $card The card to update
78+
* @param array<string, mixed> $attributes The card attributes to update
7979
*/
8080
public function updateRecord(Model $card, array $attributes): bool;
8181

8282
/**
8383
* Delete an existing card.
8484
*
85-
* @param Model $card The card to delete
85+
* @param Model $card The card to delete
8686
*/
8787
public function deleteRecord(Model $card): bool;
8888

8989
/**
9090
* Update the order of cards in a column.
9191
*
92-
* @param string|int $columnId The column ID
93-
* @param array<int, mixed> $cardIds The card IDs in their new order
92+
* @param string|int $columnId The column ID
93+
* @param array<int, mixed> $cardIds The card IDs in their new order
9494
*/
95-
public function updateRecordsOrderAndColumn(string|int $columnId, array $cardIds): bool;
95+
public function updateRecordsOrderAndColumn(string | int $columnId, array $cardIds): bool;
9696
}

0 commit comments

Comments
 (0)