Completed
Pull Request — master (#564)
by
unknown
03:07
created

DataFilter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transform() 0 8 2
A compileData() 0 10 2
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Menu\Filters;
4
5
use JeroenNoten\LaravelAdminLte\Menu\Builder;
6
7
class DataFilter implements FilterInterface
8
{
9
    public function transform($item, Builder $builder)
10
    {
11
        if (isset($item['data'])) {
12
            $item['data-compiled'] = $this->compileData($item['data']);
13
        }
14
15
        return $item;
16
    }
17
18
    protected function compileData($dataArray, $topNav = false)
0 ignored issues
show
Unused Code introduced by
The parameter $topNav is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
    {
20
        $compiled = '';
21
22
        foreach($dataArray as $key => $value) {
23
            $compiled .= 'data-'.$key.'="'.$value.'" ';
24
        }
25
26
        return $compiled;
27
    }
28
}
29