1 | <?php |
||
14 | abstract class Rule implements RuleContract |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Properties |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | * The message that should be used when validation fails. |
||
23 | * |
||
24 | * @var string|array |
||
25 | */ |
||
26 | protected $message; |
||
27 | |||
28 | /* ----------------------------------------------------------------- |
||
29 | | Getters & Setters |
||
30 | | ----------------------------------------------------------------- |
||
31 | */ |
||
32 | |||
33 | /** |
||
34 | * Set the message that should be used when the rule fails. |
||
35 | * |
||
36 | * @param string|array $message |
||
37 | * |
||
38 | * @return $this |
||
39 | */ |
||
40 | public function withMessage($message) |
||
46 | |||
47 | /** |
||
48 | * Get the validation error message. |
||
49 | * |
||
50 | * @return string|array |
||
51 | */ |
||
52 | public function message() |
||
56 | |||
57 | /* ----------------------------------------------------------------- |
||
58 | | Other Methods |
||
59 | | ----------------------------------------------------------------- |
||
60 | */ |
||
61 | |||
62 | /** |
||
63 | * Fail if the validation rule. |
||
64 | * |
||
65 | * @param string|array $message |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | protected function fail($message): bool |
||
75 | } |
||
76 |