LanguageDatatable::build()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php namespace Distilleries\Expendable\Http\Datatables\Language;
2
3
use Distilleries\Expendable\Http\Datatables\BaseDatatable;
4
5
class LanguageDatatable extends BaseDatatable {
6
7 4
    public function build()
8
    {
9
        $this
10 4
            ->add('id', null, trans('expendable::datatable.id'))
0 ignored issues
show
Bug introduced by
It seems like trans('expendable::datatable.id') can also be of type array; however, parameter $translation of Distilleries\DatatableBu...loquentDatatable::add() does only seem to accept Symfony\Component\Transl...nslatorInterface|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

10
            ->add('id', null, /** @scrutinizer ignore-type */ trans('expendable::datatable.id'))
Loading history...
11 4
            ->add('libelle', null, trans('expendable::datatable.libelle'))
12 4
            ->add('iso', null, trans('expendable::datatable.iso'));
13
14 4
        $this->addDefaultAction();
15
16
    }
17
18
19 2
    public function setClassRow($datatable)
20
    {
21
        $datatable->setRowClass(function($row)
22
        {
23 2
            $class = (isset($row->status) && empty($row->status)) ? 'danger' : '';
24 2
            $class = (empty($class) && !empty($row->not_visible)) ? 'warning' : $class;
25
26 2
            return $class;
27 2
        });
28
29 2
        return $datatable;
30
    }
31
}