1 | <?php |
||
8 | class DelegatedValidator |
||
9 | { |
||
10 | use AccessProtectedTrait; |
||
11 | /** |
||
12 | * The Validator resolved instance. |
||
13 | * |
||
14 | * @var \Illuminate\Validation\Validator |
||
15 | */ |
||
16 | protected $validator; |
||
17 | |||
18 | /** |
||
19 | * Closure to invoke non accessible Validator methods. |
||
20 | * |
||
21 | * @var Closure |
||
22 | */ |
||
23 | protected $validatorMethod; |
||
24 | |||
25 | |||
26 | /** |
||
27 | * DelegatedValidator constructor. |
||
28 | * @param \Illuminate\Validation\Validator $validator |
||
29 | */ |
||
30 | public function __construct(BaseValidator $validator ) |
||
36 | |||
37 | private function callValidator($method, $args = []) |
||
41 | |||
42 | /** |
||
43 | * Get current \Illuminate\Validation\Validator instance. |
||
44 | * |
||
45 | * @return \Illuminate\Validation\Validator |
||
46 | */ |
||
47 | public function getValidator() |
||
51 | |||
52 | /** |
||
53 | * Get the data under validation. |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public function getData() |
||
61 | |||
62 | /** |
||
63 | * Set the data under validation. |
||
64 | * |
||
65 | * @param array |
||
66 | */ |
||
67 | public function setData($data) |
||
71 | |||
72 | /** |
||
73 | * Get the validation rules. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | public function getRules() |
||
81 | |||
82 | /** |
||
83 | * Get the files under validation. |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | public function getFiles() |
||
91 | |||
92 | /** |
||
93 | * Set the files under validation. |
||
94 | * |
||
95 | * @param array $files |
||
96 | * |
||
97 | * @return BaseValidator |
||
98 | */ |
||
99 | public function setFiles(array $files) |
||
103 | |||
104 | |||
105 | /** |
||
106 | * Determine if a given rule implies the attribute is required. |
||
107 | * |
||
108 | * @param string $rule |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function isImplicit($rule) |
||
116 | |||
117 | /** |
||
118 | * Replace all error message place-holders with actual values. |
||
119 | * |
||
120 | * @param string $message |
||
121 | * @param string $attribute |
||
122 | * @param string $rule |
||
123 | * @param array $parameters |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function doReplacements($message, $attribute, $rule, $parameters) |
||
131 | |||
132 | /** |
||
133 | * Determine if the given attribute has a rule in the given set. |
||
134 | * |
||
135 | * @param string $attribute |
||
136 | * @param string|array $rules |
||
137 | * |
||
138 | * @return bool |
||
139 | */ |
||
140 | public function hasRule($attribute, $rules) |
||
144 | |||
145 | /** |
||
146 | * Get the validation message for an attribute and rule. |
||
147 | * |
||
148 | * @param string $attribute |
||
149 | * @param string $rule |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | public function getMessage($attribute, $rule) |
||
157 | |||
158 | /** |
||
159 | * Extract the rule name and parameters from a rule. |
||
160 | * |
||
161 | * @param array|string $rules |
||
162 | * |
||
163 | * @return array |
||
164 | */ |
||
165 | public function parseRule($rules) |
||
169 | |||
170 | |||
171 | /** |
||
172 | * Delegate method calls to validator instance. |
||
173 | * |
||
174 | * @param $method |
||
175 | * @param $params |
||
176 | * |
||
177 | * @return mixed |
||
178 | */ |
||
179 | public function __call($method, $params) |
||
185 | } |
||
186 |