Skip to content

Commit 64bd76e

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent af6030e commit 64bd76e

11 files changed

Lines changed: 64 additions & 68 deletions

src/Fields/Converters/MediaPickerConverter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ public function toDisplayValue(mixed $sourceValue, ?string $locale, ?string $fal
2828
->filter(fn ($c) => in_array($c->getKey(), $formattedSourceValue))
2929
->sortBy(fn ($c) => array_search($c->getKey(), $formattedSourceValue))
3030
->values()
31-
->map(function ($item) use ($locale, $fallbackLocale) {
31+
->map(function ($item) use ($locale) {
3232
if ($item instanceof MediaAsset) {
3333
return $item->toDto($locale);
34-
}
35-
else if ($item instanceof BaseDto) {
34+
} elseif ($item instanceof BaseDto) {
3635
return $item;
3736
}
3837

src/Helpers/ContentHelper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public static function getAccessibleContentIds($user = null)
8686
->all();
8787
}
8888

89-
9089
public static function getDtoRequiredRelations(): array
9190
{
9291
return [

src/Helpers/FieldTypeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static function getFieldConfigFormSchemaForFieldType($typeName)
128128

129129
public static function getFieldTypeConfig(string $typeName, array $config = []): ?FieldTypeConfig
130130
{
131-
try{
131+
try {
132132
return FilamentFieldGroup::getFieldTypeConfig($typeName, $config);
133133
} catch (\Exception $e) {
134134
return null;

src/Models/Concerns/HasContentVersions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ public function getLatestPublishedPropertyData()
115115

116116
if (is_array($propData)) {
117117
return $propData;
118-
} else if (is_string($propData)) {
118+
} elseif (is_string($propData)) {
119119
return json_decode($propData, true);
120120
}
121-
121+
122122
} catch (\Throwable $th) {
123123
// Fallback to load via publishedVersions
124124
}
@@ -147,10 +147,10 @@ public function getLatestVersionPropertyData()
147147

148148
if (is_array($propData)) {
149149
return $propData;
150-
} else if (is_string($propData)) {
150+
} elseif (is_string($propData)) {
151151
return json_decode($propData, true);
152152
}
153-
153+
154154
} catch (\Throwable $th) {
155155
// Fallback to load via latestContentVersion
156156
}

src/Models/DocumentType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function scopeWhereCanBeContent($query, bool $condition = true)
120120
static::getCategoryEnumClass()::Web->value,
121121
static::getCategoryEnumClass()::Data->value,
122122
];
123-
123+
124124
if ($condition) {
125125
return $query->whereIn('category', $canBeContentCats);
126126
}

src/Models/Scopes/ContentVersionDetailScope.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public function apply($builder, Model $model)
3636
[
3737
'id' => $related->getKeyName(),
3838
'dt' => $recordCreationColumn,
39-
'status' => "publish_state",
40-
],
41-
null,
42-
) . " as __version_details"
39+
'status' => 'publish_state',
40+
],
41+
null,
42+
) . ' as __version_details'
4343
)
4444
->selectRaw(
4545
$this->buildJsonGroupConcatExpression(
46-
"to_data",
46+
'to_data',
4747
$related->getKeyName(),
48-
) . " as __version_data"
48+
) . ' as __version_data'
4949
)
5050
->selectRaw("MAX($recordCreationColumn) as __latest_version_dt")
5151
->selectRaw("MIN($recordCreationColumn) as __earliest_version_dt")
@@ -71,25 +71,25 @@ public function apply($builder, Model $model)
7171
}
7272
}
7373

74-
private function buildJsonGroupConcatExpression(array|string $columns, ?string $jsonKeyColumn): string
74+
private function buildJsonGroupConcatExpression(array | string $columns, ?string $jsonKeyColumn): string
7575
{
7676
$isJsonColumn = filled($jsonKeyColumn);
7777

7878
// Check db driver
7979
$dbDriver = DB::connection()->getDriverName();
8080

8181
if (is_string($columns)) {
82-
82+
8383
$gpConcatString = $columns;
8484

8585
} else {
8686

8787
$gpConcatStrings = collect($columns)
8888
->map(function ($columnName, $jsonKey) use ($dbDriver) {
89-
89+
9090
$columnTemplate = match ($dbDriver) {
9191
// Haven't 'concat' function in sqlite
92-
'sqlite' => "( '\"?\":\"' || ? || '\"' )",
92+
'sqlite' => "( '\"?\":\"' || ? || '\"' )",
9393
default => "CONCAT('\"?\":\"', ?, '\"')",
9494
};
9595

@@ -100,19 +100,19 @@ private function buildJsonGroupConcatExpression(array|string $columns, ?string $
100100
})
101101
->implode(match ($dbDriver) {
102102
'sqlite' => " || ', ' || ",
103-
default => ", ', ', ",
103+
default => ", ', ', ",
104104
});
105105

106106
// Json format '{key1': 'value1', 'key2': 'value2'}'
107107
$gpConcatString = match ($dbDriver) {
108-
'sqlite' => "( '{' || $gpConcatStrings || '}' )",
108+
'sqlite' => "( '{' || $gpConcatStrings || '}' )",
109109
default => "CONCAT('{', $gpConcatStrings, '}')",
110110
};
111111
}
112112

113113
if ($jsonKeyColumn) {
114114

115-
$gpConcatString = str(
115+
$gpConcatString = str(
116116
match ($dbDriver) {
117117
'sqlite' => "( '\"' || ? ||'\":' || ? )",
118118
default => "CONCAT('\"', ?, '\":', ?, '')",
@@ -122,7 +122,6 @@ private function buildJsonGroupConcatExpression(array|string $columns, ?string $
122122
->toString();
123123
}
124124

125-
126125
// Not concat function
127126
if ($dbDriver === 'sqlite') {
128127
return $isJsonColumn

src/Models/Scopes/DocumentTypeScope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class DocumentTypeScope implements Scope
1212
public function apply($builder, Model $model)
1313
{
1414
if ($model instanceof Content) {
15-
15+
1616
$query = $builder->getQuery();
1717

1818
$related = $model->documentType()->getRelated();
1919
$foreignKey = $model->documentType()->getForeignKeyName();
2020

2121
$query
2222
->leftJoin(
23-
$related->getTable() . ' as _dt',
23+
$related->getTable() . ' as _dt',
2424
$model->qualifyColumn($foreignKey),
2525
'=',
2626
'_dt.' . $related->getKeyName()

src/Resolvers/PublishedContentResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function getContentAndLocaleByRoute($route)
7777
$locale = $this->segmentProvider->getLocaleFromDefaultRoute($route);
7878
}
7979
} else {
80-
80+
8181
[$content, $landId] = $this->contentService->findByRoutePatternWithLangId(
8282
uri: $routePatternToCheck,
8383
isDefaultRoutePattern: false,

src/Services/ContentService.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ public function findByIds($ids, $isWebPage = null, $isPublished = null, $withRel
3535
public function findByRoutePatternWithLangId($uri, $isDefaultRoutePattern, $isWebPage = null, $withRelations = [], $sorting = [], $limit = 10)
3636
{
3737
$query = $this
38-
->buildFindWithRouteQuery(fn ($q) => $q
39-
->where('uri', $uri)
40-
->when($isDefaultRoutePattern != null, fn ($q) => $q->whereIsDefaultPattern())
38+
->buildFindWithRouteQuery(
39+
fn ($q) => $q
40+
->where('uri', $uri)
41+
->when($isDefaultRoutePattern != null, fn ($q) => $q->whereIsDefaultPattern())
4142
)
4243
->with($withRelations);
4344

4445
$query = $this->applyScopeFilters($query, [
4546
'whereIsWebPage' => $isWebPage,
4647
]);
4748
$query = $this->applySortingAndLimit($query, $sorting, $limit);
48-
49+
4950
$records = $query->get();
5051

5152
return collect($records)
@@ -59,7 +60,7 @@ public function findByRoutePatternWithLangId($uri, $isDefaultRoutePattern, $isWe
5960
public function findByRealPath($path, $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = [], $limit = 10)
6061
{
6162
$query = $this->buildFindByRealPathQuery($path, $isWebPage, $isPublished, $withRelations, $sorting, $limit);
62-
63+
6364
// Key the result by the path
6465
return $query
6566
->get()
@@ -152,7 +153,7 @@ protected function buildBaseQuery()
152153
}
153154

154155
/**
155-
* @param \Closure(\Illuminate\Database\Eloquent\Builder) $routeQueryCallback
156+
* @param \Closure(\Illuminate\Database\Eloquent\Builder) $routeQueryCallback
156157
* @return \Illuminate\Database\Eloquent\Builder
157158
*/
158159
protected function buildFindWithRouteQuery(\Closure $routeQueryCallback)
@@ -197,9 +198,8 @@ protected function buildFindByPathQuery(string | array $path)
197198
}
198199

199200
/**
200-
* @param \Illuminate\Database\Eloquent\Builder $query
201+
* @param \Illuminate\Database\Eloquent\Builder $query
201202
* @param array<string, string> $sorting
202-
* @param int|null $limit
203203
* @return \Illuminate\Database\Eloquent\Builder
204204
*/
205205
protected function applySortingAndLimit($query, array $sorting, ?int $limit = null)
@@ -229,7 +229,7 @@ protected function applySortingAndLimit($query, array $sorting, ?int $limit = nu
229229
}
230230

231231
/**
232-
* @param \Illuminate\Database\Eloquent\Builder $query
232+
* @param \Illuminate\Database\Eloquent\Builder $query
233233
* @param array<string,mixed> $where
234234
* @return \Illuminate\Database\Eloquent\Builder
235235
*/
@@ -251,6 +251,7 @@ protected function applyScopeFilters($query, $where)
251251
}
252252
}
253253
}
254+
254255
return $query;
255256
}
256257

@@ -268,7 +269,7 @@ private function buildFindByIdsQuery($ids, $isWebPage = null, $isPublished = nul
268269
$ids = is_string($ids) ? $ids : Arr::flatten($ids);
269270

270271
$query = $this->buildBaseQuery()->with($withRelations);
271-
272+
272273
$query = $this->applyScopeFilters($query, [
273274
'whereIsWebPage' => $isWebPage,
274275
'whereIsPublished' => $isPublished,
@@ -289,15 +290,14 @@ private function buildFindByRealPathQuery($path, $isWebPage = null, $isPublished
289290
'whereIsPublished' => $isPublished,
290291
]);
291292
$query = $this->applySortingAndLimit($query, $sorting, $limit);
292-
293+
293294
return $query;
294295
}
295296

296-
297297
private function buildGetUnderRealPathQuery($path, $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = [], $limit = null)
298298
{
299299
$query = $this->buildUnderPathQuery($path)->with($withRelations);
300-
300+
301301
$query = $this->applyScopeFilters($query, [
302302
'whereIsWebPage' => $isWebPage,
303303
'whereIsPublished' => $isPublished,
@@ -310,7 +310,7 @@ private function buildGetUnderRealPathQuery($path, $isWebPage = null, $isPublish
310310
private function initializePaginatorCollection($paginator)
311311
{
312312
if ($paginator instanceof \Illuminate\Contracts\Pagination\Paginator) {
313-
313+
314314
$items = $paginator->getCollection();
315315

316316
// for "toDto" method

src/Services/ContentServiceInterface.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ interface ContentServiceInterface
1818
* @param bool|null $isWebPage Whether to filter by web page status.
1919
* @param bool|null $isPublished Whether to filter by published status.
2020
* @param array $withRelations The relations to load with the content.
21-
* @param array<string,string>|null $sorting The sorting options for the query.
22-
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
21+
* @param array<string,string>|null $sorting The sorting options for the query.
22+
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
2323
* @return ContentCollection<TResult>
2424
*/
2525
public function findByIds($ids, $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = [], $limit = 10);
26-
26+
2727
/**
2828
* Find content item(s) by their route pattern and language ID.
2929
*
3030
* @param string $uri The URI of the content item to find.
3131
* @param bool $isDefaultRoutePattern Whether to filter by default route pattern.
3232
* @param bool|null $isWebPage Whether to filter by web page status.
3333
* @param array $withRelations The relations to load with the content.
34-
* @param array<string,string>|null $sorting The sorting options for the query.
35-
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
34+
* @param array<string,string>|null $sorting The sorting options for the query.
35+
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
3636
* @return Collection<array{content:TResult,language_id:int}>
3737
*/
3838
public function findByRoutePatternWithLangId($uri, $isDefaultRoutePattern, $isWebPage = null, $withRelations = [], $sorting = [], $limit = 10);
@@ -44,8 +44,8 @@ public function findByRoutePatternWithLangId($uri, $isDefaultRoutePattern, $isWe
4444
* @param bool|null $isWebPage Whether to filter by web page status.
4545
* @param bool|null $isPublished Whether to filter by published status.
4646
* @param array $withRelations The relations to load with the content.
47-
* @param array<string,string>|null $sorting The sorting options for the query.
48-
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
47+
* @param array<string,string>|null $sorting The sorting options for the query.
48+
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
4949
* @return Collection<string,TResult> Keyed by the path.
5050
*/
5151
public function findByRealPath($path, $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = [], $limit = 10);
@@ -57,8 +57,8 @@ public function findByRealPath($path, $isWebPage = null, $isPublished = null, $w
5757
* @param bool|null $isWebPage Whether to filter by web page status.
5858
* @param bool|null $isPublished Whether to filter by published status.
5959
* @param array $withRelations The relations to load with the content.
60-
* @param array<string,string>|null $sorting The sorting options for the query.
61-
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
60+
* @param array<string,string>|null $sorting The sorting options for the query.
61+
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
6262
* @return ContentCollection<TResult>
6363
*/
6464
public function getUnderRealPath($path, $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = [], $limit = 10);
@@ -73,39 +73,38 @@ public function getUnderRealPath($path, $isWebPage = null, $isPublished = null,
7373
* @param bool|null $isWebPage Whether to filter by web page status.
7474
* @param bool|null $isPublished Whether to filter by published status.
7575
* @param array $withRelations The relations to load with the content.
76-
* @param array<string,string>|null $sorting The sorting options for the query.
76+
* @param array<string,string>|null $sorting The sorting options for the query.
7777
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator<TResult>
7878
*/
7979
public function getPaginatedByIds($ids, $page = 1, $perPage = 10, $pageName = 'page', $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = []);
8080

8181
/**
8282
* Get content items by their real path with pagination.
8383
*
84-
* @param string $path The real path to filter content items by
85-
* @param int $page The current page number
86-
* @param int|null $perPage The number of items per page.
87-
* @param string $pageName Name of the page query parameter
88-
* @param bool|null $isWebPage Filter by web page status (true/false/null for all)
89-
* @param bool|null $isPublished Filter by published status (true/false/null for all)
90-
* @param array $withRelations Relationships to eager load with the query
91-
* @param array $sorting Sorting options for the results
92-
*
84+
* @param string $path The real path to filter content items by
85+
* @param int $page The current page number
86+
* @param int|null $perPage The number of items per page.
87+
* @param string $pageName Name of the page query parameter
88+
* @param bool|null $isWebPage Filter by web page status (true/false/null for all)
89+
* @param bool|null $isPublished Filter by published status (true/false/null for all)
90+
* @param array $withRelations Relationships to eager load with the query
91+
* @param array $sorting Sorting options for the results
9392
* @return \Illuminate\Pagination\LengthAwarePaginator<TResult>
9493
*/
9594
public function getPaginatedByRealPath($path, $page = 1, $perPage = 10, $pageName = 'page', $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = []);
96-
95+
9796
/**
9897
* Get content items under the given real path with pagination.
9998
*
10099
* @param string|string[] $path The real path under which to find content items.
101-
* @param int $page The current page number
102-
* @param int|null $perPage The number of items per page.
103-
* @param string $pageName Name of the page query parameter
100+
* @param int $page The current page number
101+
* @param int|null $perPage The number of items per page.
102+
* @param string $pageName Name of the page query parameter
104103
* @param bool|null $isWebPage Whether to filter by web page status.
105104
* @param bool|null $isPublished Whether to filter by published status.
106105
* @param array $withRelations The relations to load with the content.
107-
* @param array<string,string>|null $sorting The sorting options for the query.
108-
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
106+
* @param array<string,string>|null $sorting The sorting options for the query.
107+
* @param int|null $limit The maximum number of content items to retrieve, or null for unlimited.
109108
* @return ContentCollection<TResult>
110109
*/
111110
public function getPaginatedUnderRealPath($path, $page = 1, $perPage = 10, $pageName = 'page', $isWebPage = null, $isPublished = null, $withRelations = [], $sorting = []);

0 commit comments

Comments
 (0)