Skip to content

Commit b894077

Browse files
lrljoegithub-actions[bot]
authored andcommitted
Fix styling
1 parent 24113be commit b894077

File tree

6 files changed

+41
-56
lines changed

6 files changed

+41
-56
lines changed

src/DataTransferObjects/Filters/FilterPillData.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
class FilterPillData
88
{
99
public function __construct(
10-
protected string $filterPillTitle,
11-
protected string $filterSelectName,
12-
protected string|array|null $filterPillValue,
13-
protected string $separator,
14-
public bool $isAnExternalLivewireFilter,
15-
public bool $hasCustomPillBlade,
16-
protected ?string $customPillBlade,
17-
protected array $filterPillsItemAttributes,
18-
protected ?string $separatedValues,
10+
protected string $filterPillTitle,
11+
protected string $filterSelectName,
12+
protected string|array|null $filterPillValue,
13+
protected string $separator,
14+
public bool $isAnExternalLivewireFilter,
15+
public bool $hasCustomPillBlade,
16+
protected ?string $customPillBlade,
17+
protected array $filterPillsItemAttributes,
18+
protected ?string $separatedValues,
1919
protected bool $renderPillsAsHtml,
2020
protected bool $watchForEvents,
21-
protected array $customResetButtonAttributes,) {}
21+
protected array $customResetButtonAttributes, ) {}
2222

2323
public static function make(string $filterPillTitle, string $filterSelectName, string|array|null $filterPillValue, string $separator = ', ', bool $isAnExternalLivewireFilter = false, bool $hasCustomPillBlade = false, ?string $customPillBlade = null, array $filterPillsItemAttributes = [], ?string $separatedValues = null, bool $renderPillsAsHtml = false, bool $watchForEvents = false, array $customResetButtonAttributes = []): FilterPillData
2424
{
25-
if ($isAnExternalLivewireFilter)
26-
{
25+
if ($isAnExternalLivewireFilter) {
2726
$watchForEvents = true;
2827
}
28+
2929
return new self($filterPillTitle, $filterSelectName, $filterPillValue, $separator, $isAnExternalLivewireFilter, $hasCustomPillBlade, $customPillBlade, $filterPillsItemAttributes, $separatedValues, $renderPillsAsHtml, $watchForEvents, $customResetButtonAttributes);
3030
}
3131

@@ -109,15 +109,13 @@ public function shouldWatchForEvents(): int
109109

110110
public function getFilterPillDisplayData(): ComponentAttributeBag
111111
{
112-
if ($this->getIsAnExternalLivewireFilter())
113-
{
112+
if ($this->getIsAnExternalLivewireFilter()) {
114113
return $this->getExternalFilterPillDisplayData();
115114
}
116115

117116
return $this->getInternalFilterPillDisplayData();
118117
}
119118

120-
121119
public function getInternalFilterPillDisplayData(): ComponentAttributeBag
122120
{
123121
return new ComponentAttributeBag([
@@ -134,10 +132,10 @@ public function getExternalFilterPillDisplayData(): ComponentAttributeBag
134132
]);
135133
}
136134

137-
138135
public function getPillSetupData(string $filterKey = '', bool $shouldWatch = false): array
139136
{
140137
$array = array_merge(['filterKey' => $filterKey, 'watchForEvents' => $shouldWatch], $this->toArray());
138+
141139
return $array;
142140
}
143141

@@ -148,18 +146,18 @@ public function getCustomResetButtonAttributes(): array
148146

149147
public function getCalculatedCustomResetButtonAttributes(string $filterKey, array $filterPillsResetFilterButtonAttributes): array
150148
{
151-
return (array_merge(
149+
return array_merge(
152150
[
153151
'x-on:click.prevent' => "resetSpecificFilter('".$filterKey."')",
154-
'type' => "button",
155-
'default' => true,
152+
'type' => 'button',
153+
'default' => true,
156154
'default-colors' => true,
157-
'default-styling' => true,
155+
'default-styling' => true,
158156
'default-text' => true,
159157
],
160158
$filterPillsResetFilterButtonAttributes,
161159
$this->getCustomResetButtonAttributes()
162-
));
160+
);
163161
}
164162

165163
public function toArray(): array

src/Traits/Filters/Configuration/FilterConfiguration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ public function applyFilters(): Builder
7777
if ($filter->getKey() === $key && $filter->hasFilterCallback()) {
7878
// Let the filter class validate the value
7979
$value = $filter->validate($value);
80-
if (!($filter instanceof BooleanFilter) && ($value === false)) {
80+
if (! ($filter instanceof BooleanFilter) && ($value === false)) {
8181
continue;
8282
}
8383

84-
8584
$this->callHook('filterApplying', ['filter' => $filter->getKey(), 'value' => $value]);
8685
$this->callTraitHook('filterApplying', ['filter' => $filter->getKey(), 'value' => $value]);
8786

src/Traits/Filters/HandlesPillsData.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,34 @@ public function getPillDataForFilter(): array
2222

2323
// dd($value);
2424

25-
26-
if($hasCustomPillBlade = $filter->hasCustomPillBlade())
27-
{
25+
if ($hasCustomPillBlade = $filter->hasCustomPillBlade()) {
2826
$customPillBlade = $filter->getCustomPillBlade();
2927
}
30-
31-
if(is_array($value) && !empty($value))
32-
{
28+
29+
if (is_array($value) && ! empty($value)) {
3330
$separatedValues = implode($separator, $filter->getFilterPillValue($value));
3431
}
35-
32+
3633
$filters[$filter->getKey()] = FilterPillData::make(
37-
customPillBlade: $customPillBlade,
34+
customPillBlade: $customPillBlade,
3835
filterPillsItemAttributes: array_merge($this->getFilterPillsItemAttributes(), ($filter->hasPillAttributes() ? $filter->getPillAttributes() : [])),
3936

40-
filterPillTitle: $filter->getFilterPillTitle(),
41-
filterPillValue: $filter->getFilterPillValue($value),
37+
filterPillTitle: $filter->getFilterPillTitle(),
38+
filterPillValue: $filter->getFilterPillValue($value),
4239

43-
filterSelectName: $filterSelectName,
40+
filterSelectName: $filterSelectName,
4441

45-
hasCustomPillBlade: $hasCustomPillBlade,
46-
isAnExternalLivewireFilter: $isAnExternalLivewireFilter,
42+
hasCustomPillBlade: $hasCustomPillBlade,
43+
isAnExternalLivewireFilter: $isAnExternalLivewireFilter,
4744
separatedValues: $separatedValues,
48-
separator: method_exists($filter, 'getPillsSeparator') ? $filter->getPillsSeparator() : ', ',
45+
separator: method_exists($filter, 'getPillsSeparator') ? $filter->getPillsSeparator() : ', ',
4946
renderPillsAsHtml: $filter->getPillsAreHtml() ?? false,
5047
customResetButtonAttributes: $filter->getPillResetButtonAttributes(),
5148

5249
);
5350
}
5451
}
52+
5553
return $filters;
5654
}
5755
}

src/Traits/Filters/Helpers/FilterPillsHelpers.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,16 @@ public function getAppliedFiltersWithValuesForPills(): array
4949
}
5050

5151
$validatedValue = $filter->validate($item);
52-
if($filter instanceof BooleanFilter)
53-
{
54-
return !($filter->isEmpty($validatedValue));
55-
}
56-
elseif($validatedValue === null || $validatedValue === 'null')
57-
{
52+
if ($filter instanceof BooleanFilter) {
53+
return ! ($filter->isEmpty($validatedValue));
54+
} elseif ($validatedValue === null || $validatedValue === 'null') {
5855
return false;
59-
}
60-
elseif(is_array($validatedValue))
61-
{
56+
} elseif (is_array($validatedValue)) {
6257
if (array_key_exists(0, $validatedValue) && (is_null($validatedValue[0]) || $validatedValue[0] == 'null')) {
6358
return false;
6459
}
6560
}
61+
6662
return is_array($validatedValue) ? count($validatedValue) : $validatedValue !== null;
6763
}, ARRAY_FILTER_USE_BOTH);
6864
}

src/Views/Filters/Traits/HasFilterPills.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getPillsAreHtml(): bool
9191
{
9292
return $this->pillsAsHtml ?? false;
9393
}
94-
94+
9595
public function setPillsAsHtml(bool $status = true): self
9696
{
9797
$this->pillsAsHtml = $status;

src/Views/Filters/Traits/Styling/HandlesFilterPillsAttributes.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public function hasPillAttributes(): bool
3434
* [Description for getPillAttributes]
3535
*
3636
* @return array<mixed>
37-
*
3837
*/
3938
public function getPillAttributes(): array
4039
{
@@ -53,7 +52,7 @@ public function setPillAttributes(array $pillAttributes): self
5352

5453
return $this;
5554
}
56-
55+
5756
public function setPillResetButtonAttributes(array $attributes = []): self
5857
{
5958
$this->pillResetButtonAttributes = [...$this->getPillResetButtonAttributes(), ...$attributes];
@@ -69,23 +68,18 @@ public function getPillResetButtonAttributes(): array
6968
/**
7069
* [Description for getFilterPillResetButtonAttributesMerged]
7170
*
72-
* @param array<mixed> $resetFilterButtonAttributes
73-
*
71+
* @param array<mixed> $resetFilterButtonAttributes
7472
* @return array<mixed>
75-
*
7673
*/
7774
public function getFilterPillResetButtonAttributesMerged(array $resetFilterButtonAttributes): array
7875
{
7976
return array_merge(
8077
[
8178
'x-on:click.prevent' => "resetSpecificFilter('".$this->getKey()."')",
82-
'type' => "button",
79+
'type' => 'button',
8380
],
8481
$resetFilterButtonAttributes,
8582
$this->getPillResetButtonAttributes()
8683
);
8784
}
88-
89-
90-
9185
}

0 commit comments

Comments
 (0)