LanguageDatatable   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 11
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 8 1
A setClassRow() 0 11 5
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
}