1212use Shergela \Validations \Rules \SeparateIntegersByComma as IntegerByComma ;
1313use Shergela \Validations \Rules \SeparateStringsByComma as StringByComma ;
1414use Shergela \Validations \Rules \SeparateStringsByUnderscore as StringByUnderscore ;
15+ use Shergela \Validations \Enums \ValidationArrayEnum as ArrayEnum ;
1516use Shergela \Validations \Rules \TimezoneRegionValidation ;
1617use Shergela \Validations \Rules \TimezoneValidation ;
1718use Shergela \Validations \Rules \UppercaseFirstLetter ;
@@ -37,7 +38,7 @@ class BuildValidationRule
3738 * @var string|null
3839 * Set custom message
3940 */
40- protected static ?string $ customMessage = null ;
41+ protected static ?string $ validationMessage = null ;
4142
4243 /**
4344 * @var int|null
@@ -317,6 +318,26 @@ class BuildValidationRule
317318 */
318319 protected static ?string $ notIn = null ;
319320
321+ /**
322+ * @var bool
323+ */
324+ protected bool $ array = false ;
325+
326+ /**
327+ * @var bool
328+ */
329+ protected bool $ arrayDistinct = false ;
330+
331+ /**
332+ * @var bool
333+ */
334+ protected ?bool $ distinctStinct = false ;
335+
336+ /**
337+ * @var bool
338+ */
339+ protected bool $ distinctIgnoreCase = false ;
340+
320341 /**
321342 * @return array<string>
322343 */
@@ -384,13 +405,13 @@ protected function buildValidationRules(): array
384405
385406 ...(
386407 $ this ->uppercaseFirstLetter === true
387- ? [new UppercaseFirstLetter (message: static ::$ customMessage )]
408+ ? [new UppercaseFirstLetter (message: static ::$ validationMessage )]
388409 : []
389410 ),
390411
391412 ...(
392413 $ this ->lowercaseFirstLetter === true
393- ? [new LowercaseFirstLetter (message: static ::$ customMessage )]
414+ ? [new LowercaseFirstLetter (message: static ::$ validationMessage )]
394415 : []
395416 ),
396417
@@ -407,7 +428,7 @@ protected function buildValidationRules(): array
407428
408429 ...(
409430 $ this ->timezones !== null
410- ? [new TimezoneValidation (timezones: $ this ->timezones , message: static ::$ customMessage )]
431+ ? [new TimezoneValidation (timezones: $ this ->timezones , message: static ::$ validationMessage )]
411432 : []
412433 ),
413434
@@ -418,7 +439,7 @@ protected function buildValidationRules(): array
418439 cities: $ this ->timezoneIdentifierCities ,
419440 timezoneGroupNumber: $ this ->dateTimezoneGroupNumber ,
420441 timezoneGroup: $ this ->dateTimezoneGroupName ,
421- customMessage: static ::$ customMessage ,
442+ customMessage: static ::$ validationMessage ,
422443 )
423444 ]
424445 : []
@@ -439,14 +460,22 @@ protected function buildValidationRules(): array
439460 * Regex validations
440461 */
441462 ...($ this ->regexPattern !== null ? [RegexRule::RULE . $ this ->regexPattern ] : []),
442- ...($ this ->separateIntegersByComma === true ? [new IntegerByComma (message: static ::$ customMessage )] : []),
443- ...($ this ->separateStringsByComma === true ? [new StringByComma (message: static ::$ customMessage )] : []),
463+ ...($ this ->separateIntegersByComma === true ? [new IntegerByComma (message: static ::$ validationMessage )] : []),
464+ ...($ this ->separateStringsByComma === true ? [new StringByComma (message: static ::$ validationMessage )] : []),
444465
445466 ...(
446467 $ this ->separateStringsByUnderscore === true
447- ? [new StringByUnderscore (message: static ::$ customMessage )]
468+ ? [new StringByUnderscore (message: static ::$ validationMessage )]
448469 : []
449470 ),
471+
472+ /**
473+ * Array validations
474+ */
475+ ...($ this ->array === true ? [ArrayEnum::ARRAY ] : []),
476+ ...($ this ->arrayDistinct === true ? [ArrayEnum::DISTINCT ] : []),
477+ ...($ this ->distinctStinct === true ? [ArrayEnum::DISTINCT_STRICT ] : []),
478+ ...($ this ->distinctIgnoreCase === true ? [ArrayEnum::DISTINCT_IGNORE_CASE ] : []),
450479 ];
451480
452481 return $ rules ;
0 commit comments