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/Form.php 1 location

@@ 1398-1409 (lines=12) @@
1395
     *
1396
     * @return Field|void
1397
     */
1398
    public function __call($method, $arguments)
1399
    {
1400
        if ($className = static::findFieldClass($method)) {
1401
            $column = array_get($arguments, 0, ''); //[0];
1402
1403
            $element = new $className($column, array_slice($arguments, 1));
1404
1405
            $this->pushField($element);
1406
1407
            return $element;
1408
        }
1409
    }
1410
1411
    /**
1412
     * Render the contents of the form when casting to string.

src/Widgets/Form.php 1 location

@@ 276-287 (lines=12) @@
273
     *
274
     * @return Field|null
275
     */
276
    public function __call($method, $arguments)
277
    {
278
        if ($className = static::findFieldClass($method)) {
279
            $name = array_get($arguments, 0, '');
280
281
            $element = new $className($name, array_slice($arguments, 1));
282
283
            $this->pushField($element);
284
285
            return $element;
286
        }
287
    }
288
289
    /**
290
     * Render the form.