13
13
14
14
namespace Storyblok \Api \Request ;
15
15
16
- use OskarStark \Value \TrimmedNonEmptyString ;
17
16
use Storyblok \Api \Domain \Value \Dto \Pagination ;
18
17
use Storyblok \Api \Domain \Value \Dto \SortBy ;
19
18
use Storyblok \Api \Domain \Value \Dto \Version ;
@@ -36,11 +35,11 @@ public function __construct(
36
35
public string $ language = 'default ' ,
37
36
public Pagination $ pagination = new Pagination (perPage: self ::PER_PAGE ),
38
37
public ?SortBy $ sortBy = null ,
39
- public ? FilterCollection $ filters = null ,
40
- public ? FieldCollection $ excludeFields = null ,
41
- public ? TagCollection $ withTags = null ,
42
- public ? IdCollection $ excludeIds = null ,
43
- public ? RelationCollection $ withRelations = null ,
38
+ public FilterCollection $ filters = new FilterCollection () ,
39
+ public FieldCollection $ excludeFields = new FieldCollection () ,
40
+ public TagCollection $ withTags = new TagCollection () ,
41
+ public IdCollection $ excludeIds = new IdCollection () ,
42
+ public RelationCollection $ withRelations = new RelationCollection () ,
44
43
public ?Version $ version = null ,
45
44
public ?string $ searchTerm = null ,
46
45
) {
@@ -74,23 +73,23 @@ public function toArray(): array
74
73
$ array ['sort_by ' ] = $ this ->sortBy ->toString ();
75
74
}
76
75
77
- if (null !== $ this -> filters && $ this ->filters ->count () > 0 ) {
76
+ if ($ this ->filters ->count () > 0 ) {
78
77
$ array ['filter_query ' ] = $ this ->filters ->toArray ();
79
78
}
80
79
81
- if (null !== $ this -> withTags && $ this ->withTags ->count () > 0 ) {
80
+ if ($ this ->withTags ->count () > 0 ) {
82
81
$ array ['with_tag ' ] = $ this ->withTags ->toString ();
83
82
}
84
83
85
- if (null !== $ this -> excludeFields && $ this ->excludeFields ->count () > 0 ) {
84
+ if ($ this ->excludeFields ->count () > 0 ) {
86
85
$ array ['excluding_fields ' ] = $ this ->excludeFields ->toString ();
87
86
}
88
87
89
- if (null !== $ this -> excludeIds && $ this ->excludeIds ->count () > 0 ) {
88
+ if ($ this ->excludeIds ->count () > 0 ) {
90
89
$ array ['excluding_ids ' ] = $ this ->excludeIds ->toString ();
91
90
}
92
91
93
- if (null !== $ this -> withRelations && $ this ->withRelations ->count () > 0 ) {
92
+ if ($ this ->withRelations ->count () > 0 ) {
94
93
$ array ['resolve_relations ' ] = $ this ->withRelations ->toString ();
95
94
}
96
95
0 commit comments