@@ 34-48 (lines=15) @@ | ||
31 | foreach ($input as $inputItem) { |
|
32 | $itemResult = []; |
|
33 | ||
34 | foreach ($this->getChildren() as $field => $config) { |
|
35 | if (!array_key_exists($field, $inputItem)) { |
|
36 | if ($config->isRequired()) { |
|
37 | throw new RequiredFieldException($field); |
|
38 | } |
|
39 | ||
40 | if (!$config->hasDefault()) { |
|
41 | continue; |
|
42 | } |
|
43 | ||
44 | $inputItem[$field] = $config->getDefault(); |
|
45 | } |
|
46 | ||
47 | $itemResult[$field] = $config->getValue($field, $config->walk($inputItem[$field])); |
|
48 | } |
|
49 | ||
50 | $result[] = $itemResult; |
|
51 | } |
@@ 190-204 (lines=15) @@ | ||
187 | return $input; |
|
188 | } |
|
189 | ||
190 | foreach ($this->getChildren() as $field => $config) { |
|
191 | if (!array_key_exists($field, $input)) { |
|
192 | if ($config->isRequired()) { |
|
193 | throw new RequiredFieldException($field); |
|
194 | } |
|
195 | ||
196 | if (!$config->hasDefault()) { |
|
197 | continue; |
|
198 | } |
|
199 | ||
200 | $input[$field] = $config->getDefault(); |
|
201 | } |
|
202 | ||
203 | $result[$field] = $config->getValue($field, $config->walk($input[$field])); |
|
204 | } |
|
205 | ||
206 | return $result; |
|
207 | } |