1 | <?php |
||
10 | class Validator |
||
11 | { |
||
12 | /** |
||
13 | * @var \Illuminate\Validation\Validator |
||
14 | */ |
||
15 | protected $validator; |
||
16 | |||
17 | protected $validationMessages = [ |
||
18 | /* |
||
19 | |-------------------------------------------------------------------------- |
||
20 | | Validation Language Lines |
||
21 | |-------------------------------------------------------------------------- |
||
22 | | |
||
23 | | The following language lines contain the default error messages used by |
||
24 | | the validator class. Some of these rules have multiple versions such |
||
25 | | as the size rules. Feel free to tweak each of these messages here. |
||
26 | | |
||
27 | */ |
||
28 | "accepted" => "The :attribute must be accepted.", |
||
29 | "active_url" => "The :attribute is not a valid URL.", |
||
30 | "after" => "The :attribute must be a date after :date.", |
||
31 | "alpha" => "The :attribute may only contain letters.", |
||
32 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", |
||
33 | "alpha_num" => "The :attribute may only contain letters and numbers.", |
||
34 | "array" => "The :attribute must be an array.", |
||
35 | "before" => "The :attribute must be a date before :date.", |
||
36 | "between" => [ |
||
37 | "numeric" => "The :attribute must be between :min and :max.", |
||
38 | "file" => "The :attribute must be between :min and :max kilobytes.", |
||
39 | "string" => "The :attribute must be between :min and :max characters.", |
||
40 | "array" => "The :attribute must have between :min and :max items.", |
||
41 | ], |
||
42 | "confirmed" => "The :attribute confirmation does not match.", |
||
43 | "date" => "The :attribute is not a valid date.", |
||
44 | "date_format" => "The :attribute does not match the format :format.", |
||
45 | "different" => "The :attribute and :other must be different.", |
||
46 | "digits" => "The :attribute must be :digits digits.", |
||
47 | "digits_between" => "The :attribute must be between :min and :max digits.", |
||
48 | "email" => "The :attribute format is invalid.", |
||
49 | "exists" => "The selected :attribute is invalid.", |
||
50 | "image" => "The :attribute must be an image.", |
||
51 | "in" => "The selected :attribute is invalid.", |
||
52 | "integer" => "The :attribute must be an integer.", |
||
53 | "ip" => "The :attribute must be a valid IP address.", |
||
54 | "max" => [ |
||
55 | "numeric" => "The :attribute may not be greater than :max.", |
||
56 | "file" => "The :attribute may not be greater than :max kilobytes.", |
||
57 | "string" => "The :attribute may not be greater than :max characters.", |
||
58 | "array" => "The :attribute may not have more than :max items.", |
||
59 | ], |
||
60 | "mimes" => "The :attribute must be a file of type: :values.", |
||
61 | "min" => [ |
||
62 | "numeric" => "The :attribute must be at least :min.", |
||
63 | "file" => "The :attribute must be at least :min kilobytes.", |
||
64 | "string" => "The :attribute must be at least :min characters.", |
||
65 | "array" => "The :attribute must have at least :min items.", |
||
66 | ], |
||
67 | "not_in" => "The selected :attribute is invalid.", |
||
68 | "numeric" => "The :attribute must be a number.", |
||
69 | "regex" => "The :attribute format is invalid.", |
||
70 | "required" => "The :attribute field is required.", |
||
71 | "required_if" => "The :attribute field is required when :other is :value.", |
||
72 | "required_with" => "The :attribute field is required when :values is present.", |
||
73 | "required_without" => "The :attribute field is required when :values is not present.", |
||
74 | "required_without_all" => "The :attribute field is required when :values are not present.", |
||
75 | "same" => "The :attribute and :other must match.", |
||
76 | "size" => [ |
||
77 | "numeric" => "The :attribute must be :size.", |
||
78 | "file" => "The :attribute must be :size kilobytes.", |
||
79 | "string" => "The :attribute must be :size characters.", |
||
80 | "array" => "The :attribute must contain :size items.", |
||
81 | ], |
||
82 | "unique" => "The :attribute has already been taken.", |
||
83 | "url" => "The :attribute format is invalid.", |
||
84 | 'custom' => [], |
||
85 | 'attributes' => [], |
||
86 | ]; |
||
87 | |||
88 | protected $validationMessagesCustom = [ |
||
89 | "is_valid" => "The :attribute must be a validable object.", |
||
90 | "is_model" => "The :attribute must be a model of type :model.", |
||
91 | ]; |
||
92 | |||
93 | protected $context; |
||
94 | |||
95 | /** |
||
96 | * Validator constructor. |
||
97 | * |
||
98 | * @param array $parameters |
||
99 | * @param array $rules |
||
100 | * @param mixed $context |
||
101 | */ |
||
102 | 27 | public function __construct($parameters, $rules, $context = null) |
|
107 | |||
108 | /** |
||
109 | * @param array $parameters |
||
110 | * @param array $rules |
||
111 | * @param mixed $context |
||
112 | * @return static|\Illuminate\Validation\Validator |
||
113 | */ |
||
114 | 27 | public static function make($parameters, $rules, $context = null) |
|
118 | |||
119 | /** |
||
120 | * @param array $parameters |
||
121 | * @param array $rules |
||
122 | * @return \Illuminate\Validation\Validator |
||
123 | */ |
||
124 | 27 | public function getValidator($parameters, $rules) |
|
141 | |||
142 | /** |
||
143 | * @param \Illuminate\Validation\Validator $validator |
||
144 | * @param array $names |
||
145 | */ |
||
146 | 27 | public function bootValidatorExtensions(&$validator, $names) |
|
167 | |||
168 | /** |
||
169 | * @param string $attribute |
||
170 | * @param mixed $value |
||
171 | * @param array $parameters |
||
172 | * @param \Illuminate\Validation\Validator $validator |
||
173 | * @return bool |
||
174 | */ |
||
175 | 18 | protected static function validateIsValid($attribute, $value, $parameters, $validator) |
|
190 | |||
191 | /** |
||
192 | * @param string $attribute |
||
193 | * @param mixed $value |
||
194 | * @param array $parameters |
||
195 | * @param \Illuminate\Validation\Validator $validator |
||
196 | * @return bool |
||
197 | */ |
||
198 | 18 | protected static function validateIsModel($attribute, $value, $parameters, $validator) |
|
219 | |||
220 | /** |
||
221 | * @param string $message |
||
222 | * @param string $attribute |
||
223 | * @param string $rule |
||
224 | * @param array $parameters |
||
225 | * @return bool |
||
226 | */ |
||
227 | 6 | protected static function replaceIsModel($message, $attribute, $rule, $parameters) |
|
235 | |||
236 | /** |
||
237 | * @param string $name |
||
238 | * @param array $arguments |
||
239 | * @return mixed |
||
240 | */ |
||
241 | 27 | public function __call($name, $arguments) |
|
245 | |||
246 | |||
247 | } |
||
248 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.