Code Duplication    Length = 17-19 lines in 2 locations

src/Form/EmbeddedForm.php 1 location

@@ 266-282 (lines=17) @@
263
     *
264
     * @return Field|$this
265
     */
266
    public function __call($method, $arguments)
267
    {
268
        if ($className = Form::findFieldClass($method)) {
269
            $column = Arr::get($arguments, 0, '');
270
271
            /** @var Field $field */
272
            $field = new $className($column, array_slice($arguments, 1));
273
274
            $field->setForm($this->parent);
275
276
            $this->pushField($field);
277
278
            return $field;
279
        }
280
281
        return $this;
282
    }
283
}
284

src/Form/NestedForm.php 1 location

@@ 426-444 (lines=19) @@
423
     *
424
     * @return mixed
425
     */
426
    public function __call($method, $arguments)
427
    {
428
        if ($className = Form::findFieldClass($method)) {
429
            $column = Arr::get($arguments, 0, '');
430
431
            /* @var Field $field */
432
            $field = new $className($column, array_slice($arguments, 1));
433
434
            $field->setForm($this->form);
435
436
            $field = $this->formatField($field);
437
438
            $this->pushField($field);
439
440
            return $field;
441
        }
442
443
        return $this;
444
    }
445
}
446