Code Duplication    Length = 14-14 lines in 3 locations

src/Form/Field/Embeds.php 1 location

@@ 162-175 (lines=14) @@
159
            }, $newColumn);
160
            $rules = $array_clean_merge($rules, $newRules);
161
162
            $newInput = array_map(function ($v) use ($availInput, $array_key_attach_str) {
163
                list($k, $c) = explode('.', $v);
164
                //Fix ResetInput Function! A Headache Implementation!
165
                $col = explode(':', $c)[0];
166
                if (!array_key_exists($col, $availInput[$k])) {
167
                    return [null => null];
168
                }
169
170
                if (is_array($availInput[$k][$col])) {
171
                    return $array_key_attach_str($availInput[$k][$col], $v, ':');
172
                }
173
174
                return [$v => $availInput[$k][$col]];
175
            }, $newColumn);
176
            $newInputs = $array_clean_merge($newInputs, $newInput);
177
178
            $newAttributes = array_map(function ($v) use ($field, $availInput) {

src/Form/Field/HasMany.php 2 locations

@@ 177-190 (lines=14) @@
174
            }, $keys));
175
176
            $fieldRules = is_array($fieldRules) ? implode('|', $fieldRules) : $fieldRules;
177
            $newRules = array_map(function ($v) use ($fieldRules, $availInput, $array_key_attach_str) {
178
                list($r, $k, $c) = explode('.', $v);
179
                //Fix ResetInput Function! A Headache Implementation!
180
                $col = explode(':', $c)[0];
181
                if (!array_key_exists($col, $availInput[$k])) {
182
                    return [null => null];
183
                }
184
185
                if (is_array($availInput[$k][$col])) {
186
                    return $array_key_attach_str(preg_replace('/./', $fieldRules, $availInput[$k][$col]), $v, ':');
187
                }
188
189
                return [$v => $fieldRules];
190
            }, $newColumn);
191
            $rules = $array_clean_merge($rules, $newRules);
192
193
            $newInput = array_map(function ($v) use ($availInput, $array_key_attach_str) {
@@ 193-206 (lines=14) @@
190
            }, $newColumn);
191
            $rules = $array_clean_merge($rules, $newRules);
192
193
            $newInput = array_map(function ($v) use ($availInput, $array_key_attach_str) {
194
                list($r, $k, $c) = explode('.', $v);
195
                //Fix ResetInput Function! A Headache Implementation!
196
                $col = explode(':', $c)[0];
197
                if (!array_key_exists($col, $availInput[$k])) {
198
                    return [null => null];
199
                }
200
201
                if (is_array($availInput[$k][$col])) {
202
                    return $array_key_attach_str($availInput[$k][$col], $v, ':');
203
                }
204
205
                return [$v => $availInput[$k][$col]];
206
            }, $newColumn);
207
            $newInputs = $array_clean_merge($newInputs, $newInput);
208
209
            $newAttributes = array_map(function ($v) use ($field, $availInput) {