44
55class FilterPillData
66{
7+ public function __construct (protected string $ filterPillTitle , protected string $ filterSelectName , protected string |array |null $ filterPillValue , protected string $ separator , public bool $ isAnExternalLivewireFilter , public bool $ hasCustomPillBlade , protected ?string $ customPillBlade , protected array $ filterPillsItemAttributes ) {}
78
8- public function __construct (protected string $ filterPillTitle , protected string $ filterSelectName , protected string |array |null $ filterPillValue , protected string $ separator , public bool $ isAnExternalLivewireFilter , public bool $ hasCustomPillBlade , protected ?string $ customPillBlade , protected array $ filterPillsItemAttributes )
9- {
10- }
11-
12- 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 = []): FilterPillData
9+ 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 = []): FilterPillData
1310 {
1411 return new self ($ filterPillTitle , $ filterSelectName , $ filterPillValue , $ separator , $ isAnExternalLivewireFilter , $ hasCustomPillBlade , $ customPillBlade , $ filterPillsItemAttributes );
1512 }
@@ -28,43 +25,36 @@ public function getPillValue(): array|string|null
2825 {
2926 return $ this ->filterPillValue ;
3027 }
31-
28+
3229 public function isPillValueAnArray (): bool
3330 {
34- return (! is_null ($ this ->filterPillValue ) && is_array ($ this ->filterPillValue ) );
31+ return ! is_null ($ this ->filterPillValue ) && is_array ($ this ->filterPillValue );
3532 }
3633
3734 public function getSeparatedPillValue (): array |string |null
3835 {
39- if ($ this ->isPillValueAnArray ())
40- {
36+ if ($ this ->isPillValueAnArray ()) {
4137 return implode ($ this ->getSeparator (), $ this ->getPillValue ());
42- }
43- else
44- {
38+ } else {
4539 return $ this ->getPillValue ();
4640 }
4741 }
4842
4943 public function getValueFromPillData (): array |string |null
5044 {
51- if ($ this ->isPillValueAnArray ())
52- {
45+ if ($ this ->isPillValueAnArray ()) {
5346 return implode ($ this ->getSeparator (), $ this ->getPillValue ());
54- }
55- else
56- {
47+ } else {
5748 return $ this ->getPillValue ();
5849 }
5950 }
6051
61-
6252 public function getHasCustomPillBlade (): bool
6353 {
6454 return $ this ->hasCustomPillBlade ?? false ;
6555 }
6656
67- public function getCustomPillBlade (): string | null
57+ public function getCustomPillBlade (): ? string
6858 {
6959 return $ this ->customPillBlade ;
7060 }
@@ -76,12 +66,12 @@ public function getIsAnExternalLivewireFilter(): bool
7666
7767 public function getSeparator (): string
7868 {
79- return $ this ->separator ?? " , " ;
69+ return $ this ->separator ?? ' , ' ;
8070 }
8171
8272 public function getFilterPillsItemAttributes (): array
8373 {
84- return array_merge (['default ' => true , 'default-colors ' => true , 'default-styling ' => true ], $ this ->filterPillsItemAttributes );
74+ return array_merge (['default ' => true , 'default-colors ' => true , 'default-styling ' => true ], $ this ->filterPillsItemAttributes );
8575 }
8676
8777 public function toArray (): array
0 commit comments