Skip to content

Commit a127d71

Browse files
committed
fix: add missing methods in ValidationInterface
1 parent 51429cd commit a127d71

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

system/Validation/ValidationInterface.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,54 @@ public function check($value, string $rule, array $errors = []): bool;
4646
*/
4747
public function withRequest(RequestInterface $request): ValidationInterface;
4848

49+
/**
50+
* Sets an individual rule and custom error messages for a single field.
51+
*
52+
* The custom error message should be just the messages that apply to
53+
* this field, like so:
54+
*
55+
* [
56+
* 'rule' => 'message',
57+
* 'rule' => 'message',
58+
* ]
59+
*
60+
* @param array|string $rules
61+
*
62+
* @return $this
63+
*/
64+
public function setRule(string $field, ?string $label, $rules, array $errors = []);
65+
4966
/**
5067
* Stores the rules that should be used to validate the items.
5168
*/
5269
public function setRules(array $rules, array $messages = []): ValidationInterface;
5370

71+
/**
72+
* Returns all of the rules currently defined.
73+
*/
74+
public function getRules(): array;
75+
5476
/**
5577
* Checks to see if the rule for key $field has been set or not.
5678
*/
5779
public function hasRule(string $field): bool;
5880

81+
/**
82+
* Get rule group.
83+
*
84+
* @param string $group Group.
85+
*
86+
* @return string[] Rule group.
87+
*/
88+
public function getRuleGroup(string $group): array;
89+
90+
/**
91+
* Set rule group.
92+
*
93+
* @param string $group Group.
94+
*/
95+
public function setRuleGroup(string $group);
96+
5997
/**
6098
* Returns the error for a specified $field (or empty string if not set).
6199
*/

0 commit comments

Comments
 (0)