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 | * DelegatedValidator constructor. |
||
27 | * @param \Illuminate\Validation\Validator $validator |
||
28 | */ |
||
29 | 16 | public function __construct(BaseValidator $validator) |
|
34 | |||
35 | 5 | private function callValidator($method, $args = []) |
|
39 | |||
40 | /** |
||
41 | * Get current \Illuminate\Validation\Validator instance. |
||
42 | * |
||
43 | * @return \Illuminate\Validation\Validator |
||
44 | */ |
||
45 | 1 | public function getValidator() |
|
49 | |||
50 | /** |
||
51 | * Get the data under validation. |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | 1 | public function getData() |
|
59 | |||
60 | /** |
||
61 | * Set the data under validation. |
||
62 | * |
||
63 | * @param array |
||
64 | */ |
||
65 | 1 | public function setData($data) |
|
69 | |||
70 | /** |
||
71 | * Get the validation rules. |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | 1 | public function getRules() |
|
79 | |||
80 | /** |
||
81 | * Get the files under validation. |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | 1 | public function getFiles() |
|
89 | |||
90 | /** |
||
91 | * Set the files under validation. |
||
92 | * |
||
93 | * @param array $files |
||
94 | * |
||
95 | * @return BaseValidator |
||
96 | */ |
||
97 | 1 | public function setFiles(array $files) |
|
101 | |||
102 | /** |
||
103 | * Determine if a given rule implies the attribute is required. |
||
104 | * |
||
105 | * @param string $rule |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | 1 | public function isImplicit($rule) |
|
113 | |||
114 | /** |
||
115 | * Replace all error message place-holders with actual values. |
||
116 | * |
||
117 | * @param string $message |
||
118 | * @param string $attribute |
||
119 | * @param string $rule |
||
120 | * @param array $parameters |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | 1 | public function doReplacements($message, $attribute, $rule, $parameters) |
|
128 | |||
129 | /** |
||
130 | * Determine if the given attribute has a rule in the given set. |
||
131 | * |
||
132 | * @param string $attribute |
||
133 | * @param string|array $rules |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | 1 | public function hasRule($attribute, $rules) |
|
141 | |||
142 | /** |
||
143 | * Get the validation message for an attribute and rule. |
||
144 | * |
||
145 | * @param string $attribute |
||
146 | * @param string $rule |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 1 | public function getMessage($attribute, $rule) |
|
154 | |||
155 | /** |
||
156 | * Extract the rule name and parameters from a rule. |
||
157 | * |
||
158 | * @param array|string $rules |
||
159 | * |
||
160 | * @return array |
||
161 | */ |
||
162 | 1 | public function parseRule($rules) |
|
166 | |||
167 | /** |
||
168 | * Delegate method calls to validator instance. |
||
169 | * |
||
170 | * @param $method |
||
171 | * @param $params |
||
172 | * |
||
173 | * @return mixed |
||
174 | */ |
||
175 | 1 | public function __call($method, $params) |
|
181 | } |
||
182 |