Code Duplication    Length = 12-17 lines in 3 locations

src/Form/EmbeddedForm.php 1 location

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

src/Widgets/Form.php 1 location

@@ 269-280 (lines=12) @@
266
     *
267
     * @return Field|null
268
     */
269
    public function __call($method, $arguments)
270
    {
271
        if ($className = static::findFieldClass($method)) {
272
            $name = array_get($arguments, 0, '');
273
274
            $element = new $className($name, array_slice($arguments, 1));
275
276
            $this->pushField($element);
277
278
            return $element;
279
        }
280
    }
281
282
    /**
283
     * Render the form.

src/Form.php 1 location

@@ 1379-1390 (lines=12) @@
1376
     *
1377
     * @return Field|void
1378
     */
1379
    public function __call($method, $arguments)
1380
    {
1381
        if ($className = static::findFieldClass($method)) {
1382
            $column = array_get($arguments, 0, ''); //[0];
1383
1384
            $element = new $className($column, array_slice($arguments, 1));
1385
1386
            $this->pushField($element);
1387
1388
            return $element;
1389
        }
1390
    }
1391
1392
    /**
1393
     * Render the contents of the form when casting to string.