| @@ 195-209 (lines=15) @@ | ||
| 192 | }, array_keys($rules))); |
|
| 193 | ||
| 194 | $newInput = $array_key_clean_undot($newInput); |
|
| 195 | $newRules = array_map(function ($idx) use ($availInput, $rules) { |
|
| 196 | list($rel, $col) = explode('.', $idx); |
|
| 197 | //Fix ResetInput Function! A Headache Implementation! |
|
| 198 | $col1 = explode(':', $col)[0]; |
|
| 199 | if (!array_key_exists($col1, $availInput[$rel])) { |
|
| 200 | return [null => null]; |
|
| 201 | } |
|
| 202 | if (is_array($availInput[$rel][$col1])) { |
|
| 203 | return call_user_func_array('array_merge', array_map(function ($x) use ($idx, $rules) { |
|
| 204 | return ["{$idx}{$x}" => $rules[$idx]]; |
|
| 205 | }, array_keys($availInput[$rel][$col1]))); |
|
| 206 | } |
|
| 207 | ||
| 208 | return ["{$idx}" => $rules[$idx]]; |
|
| 209 | }, array_keys($rules)); |
|
| 210 | $newRules = array_filter(call_user_func_array('array_merge', $newRules), 'strlen', ARRAY_FILTER_USE_KEY); |
|
| 211 | $newRules = $array_key_clean($newRules); |
|
| 212 | ||
| @@ 168-183 (lines=16) @@ | ||
| 165 | }, $keys)); |
|
| 166 | ||
| 167 | $fieldRules = is_array($fieldRules) ? implode('|', $fieldRules) : $fieldRules; |
|
| 168 | $newRules = array_map(function ($v) use ($fieldRules, $availInput) { |
|
| 169 | list($r, $k, $c) = explode('.', $v); |
|
| 170 | //Fix ResetInput Function! A Headache Implementation! |
|
| 171 | $col = explode(':', $c)[0]; |
|
| 172 | if (!array_key_exists($col, $availInput[$k])) { |
|
| 173 | return [null => null]; |
|
| 174 | } |
|
| 175 | ||
| 176 | if (is_array($availInput[$k][$col])) { |
|
| 177 | return call_user_func_array('array_merge', array_map(function ($u) use ($v, $fieldRules) { |
|
| 178 | return ["{$v}{$u}" => $fieldRules]; |
|
| 179 | }, array_keys($availInput[$k][$col]))); |
|
| 180 | } |
|
| 181 | ||
| 182 | return [$v => $fieldRules]; |
|
| 183 | }, $newColumn); |
|
| 184 | $rules = array_merge( |
|
| 185 | $rules, |
|
| 186 | call_user_func_array( |
|