DatatableGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepareAdd() 0 13 2
1
<?php
2
3
namespace Distilleries\DatatableBuilder\Console\Lib\Generators;
4
5
use Kris\LaravelFormBuilder\Console\FormGenerator;
6
7
class DatatableGenerator extends FormGenerator
8
{
9
10
    /**
11
     * Prepare template for single add field.
12
     *
13
     * @param string $field
14
     * @param bool $isLast
15
     * @return string
16
     */
17 4
    protected function prepareAdd($field, $isLast = false)
18
    {
19 4
        $field = trim($field);
20
        $textArr = [
21 4
            "            ->add('",
22 4
            $field,
23 4
            "', null",
24 4
            ", trans('datatable." . strtolower($field) . "')",
25 4
            ")",
26 4
            ($isLast) ? "" : "\n"
27
        ];
28
29 4
        return join('', $textArr);
30
    }
31
}
32