@@ -31,61 +31,131 @@ public static function make(string $filterKey, string $filterPillTitle, string|a
3131 return new self ($ filterKey , $ filterPillTitle , $ filterPillValue , $ separator , $ isAnExternalLivewireFilter , $ hasCustomPillBlade , $ customPillBlade , $ filterPillsItemAttributes , $ renderPillsAsHtml , $ watchForEvents , $ customResetButtonAttributes , $ renderPillsTitleAsHtml );
3232 }
3333
34+ /**
35+ * Get the Filter Key
36+ *
37+ * @return string
38+ */
39+ public function getFilterKey (): string
40+ {
41+ return $ this ->filterKey ;
42+ }
43+
44+ /**
45+ * Get the title for the Filter Pill
46+ *
47+ * @return string
48+ */
3449 public function getTitle (): string
3550 {
3651 return $ this ->filterPillTitle ;
3752 }
38-
53+
54+ /**
55+ * Get The Filter Pill Value
56+ *
57+ * @return array<mixed>|string|null
58+ */
3959 public function getPillValue (): array |string |null
4060 {
4161 return $ this ->filterPillValue ;
4262 }
4363
64+ /**
65+ * Determing if there is a Custom Pill blade set
66+ *
67+ * @return boolean
68+ */
4469 public function getHasCustomPillBlade (): bool
4570 {
4671 return $ this ->hasCustomPillBlade ;
4772 }
4873
74+ /**
75+ * Get The Custom Pill Blade (if set)
76+ *
77+ * @return string|null
78+ */
4979 public function getCustomPillBlade (): ?string
5080 {
5181 return $ this ->customPillBlade ;
5282 }
5383
84+ /**
85+ * Get Custom Reset Button Attributes
86+ *
87+ * @return array<mixed>
88+ */
5489 public function getCustomResetButtonAttributes (): array
5590 {
5691 return $ this ->customResetButtonAttributes ;
5792 }
5893
94+ /**
95+ * Determine of this is an External Livewire Filter
96+ *
97+ * @return integer
98+ */
5999 public function getIsAnExternalLivewireFilter (): int
60100 {
61101 return intval ($ this ->isAnExternalLivewireFilter );
62102 }
63103
104+ /**
105+ * Get the Separator for Pill Values
106+ *
107+ * @return string
108+ */
64109 public function getSeparator (): string
65110 {
66111 return $ this ->separator ;
67112 }
68113
114+ /**
115+ * Determine if Pills should render as HTML
116+ *
117+ * @return integer
118+ */
69119 public function shouldUsePillsAsHtml (): int
70120 {
71121 return intval ($ this ->renderPillsAsHtml );
72122 }
73123
124+ /**
125+ * Determine if Pill Title should render as HTML
126+ *
127+ * @return integer
128+ */
74129 public function shouldUsePillsTitleAsHtml (): int
75130 {
76131 return intval ($ this ->renderPillsTitleAsHtml );
77132 }
78133
134+ /**
135+ * Determine if Should watch for Events (i.e. is an External Filter)
136+ *
137+ * @return integer
138+ */
79139 public function shouldWatchForEvents (): int
80140 {
81141 return intval ($ this ->watchForEvents );
82142 }
83143
144+ /**
145+ * Determine if Pill Value is an Array
146+ *
147+ * @return boolean
148+ */
84149 public function isPillValueAnArray (): bool
85150 {
86151 return ! is_null ($ this ->filterPillValue ) && is_array ($ this ->filterPillValue );
87152 }
88153
154+ /**
155+ * Return the separator separated value for the pill
156+ *
157+ * @return string|null
158+ */
89159 public function getSeparatedPillValue (): ?string
90160 {
91161 if ($ this ->isPillValueAnArray ()) {
@@ -95,6 +165,11 @@ public function getSeparatedPillValue(): ?string
95165 }
96166 }
97167
168+ /**
169+ * Return the safe, separator separated value for the pill
170+ *
171+ * @return string|null
172+ */
98173 public function getSafeSeparatedPillValue (): ?string
99174 {
100175 $ string = $ this ->getSeparatedPillValue ();
@@ -103,11 +178,21 @@ public function getSafeSeparatedPillValue(): ?string
103178
104179 }
105180
181+ /**
182+ * Get the attributes for the Filter Pills Item
183+ *
184+ * @return array<mixed>
185+ */
106186 public function getFilterPillsItemAttributes (): array
107187 {
108188 return array_merge (['default ' => true , 'default-colors ' => true , 'default-styling ' => true , 'default-text ' => true ], $ this ->filterPillsItemAttributes );
109189 }
110190
191+ /**
192+ * Get the Display Data for the Filter Pills
193+ *
194+ * @return array<mixed>
195+ */
111196 public function getFilterPillDisplayDataArray (): array
112197 {
113198 $ array = [];
@@ -118,13 +203,26 @@ public function getFilterPillDisplayDataArray(): array
118203 return $ this ->getInternalFilterPillDisplayDataArray ($ array );
119204 }
120205
206+
207+ /**
208+ * Get the Display Data for the Filter Pills
209+ *
210+ * @param array<mixed> $array
211+ * @return array<mixed>
212+ */
121213 public function getExternalFilterPillDisplayDataArray (array $ array = []): array
122214 {
123215 $ array [$ this ->shouldUsePillsAsHtml () ? 'x-html ' : 'x-text ' ] = 'displayString ' ;
124216
125217 return $ array ;
126218 }
127219
220+ /**
221+ * Get the Display Data for the Filter Pills
222+ *
223+ * @param array<mixed> $array
224+ * @return array<mixed>
225+ */
128226 public function getInternalFilterPillDisplayDataArray (array $ array = []): array
129227 {
130228
@@ -135,20 +233,40 @@ public function getInternalFilterPillDisplayDataArray(array $array = []): array
135233 return $ array ;
136234 }
137235
236+ /**
237+ * Get the Display Data for the Filter Pills Title
238+ *
239+ * @param array<mixed> $array
240+ * @return array<mixed>
241+ */
138242 public function getFilterTitleDisplayDataArray (array $ array = []): array
139243 {
140244 $ array [$ this ->shouldUsePillsTitleAsHtml () ? 'x-html ' : 'x-text ' ] = 'localFilterTitle ' ;
141245
142246 return $ array ;
143247 }
144248
249+ /**
250+ * Get the initial setup data
251+ *
252+ * @param string $filterKey
253+ * @param boolean $shouldWatch
254+ * @return array<mixed>
255+ */
145256 public function getPillSetupData (string $ filterKey = '' , bool $ shouldWatch = false ): array
146257 {
147258 $ array = array_merge (['filterKey ' => $ filterKey , 'watchForEvents ' => $ shouldWatch ], $ this ->toArray ());
148259
149260 return $ array ;
150261 }
151262
263+ /**
264+ * Calculate Any Reset Button Attributes
265+ *
266+ * @param string $filterKey
267+ * @param array<mixed> $filterPillsResetFilterButtonAttributes
268+ * @return array<mixed>
269+ */
152270 public function getCalculatedCustomResetButtonAttributes (string $ filterKey , array $ filterPillsResetFilterButtonAttributes ): array
153271 {
154272 return array_merge (
@@ -165,10 +283,15 @@ public function getCalculatedCustomResetButtonAttributes(string $filterKey, arra
165283 );
166284 }
167285
286+ /**
287+ * Returns the data to an array
288+ *
289+ * @return array<mixed>
290+ */
168291 public function toArray (): array
169292 {
170293 return [
171- 'filterKey ' => $ this ->filterKey ,
294+ 'filterKey ' => $ this ->getFilterKey () ,
172295 'filterPillTitle ' => $ this ->getTitle (),
173296 'filterPillValue ' => $ this ->getPillValue (),
174297 'isAnExternalLivewireFilter ' => $ this ->getIsAnExternalLivewireFilter (),
0 commit comments