Passed
Push — master ( 01e728...d6a5af )
by Iman
08:33 queued 03:15
created

ViewHelpers   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 7

1 Method

Rating   Name   Duplication   Size   Complexity  
B urlFilterColumn() 0 21 7
1
<?php
2
3
namespace crocodicstudio\crudbooster\CBCoreModule\Index;
4
5
class ViewHelpers
6
{
7
    public static function urlFilterColumn($key, $type, $value = '', $singleSorting = true)
8
    {
9
        $params = request()->all();
10
        $mainpath = trim(self::mainpath(), '/');
0 ignored issues
show
Bug introduced by
The method mainpath() does not exist on crocodicstudio\crudboost...odule\Index\ViewHelpers. ( Ignorable by Annotation )

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

10
        $mainpath = trim(self::/** @scrutinizer ignore-call */ mainpath(), '/');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
11
12
        if ($params['filter_column'] && $singleSorting) {
13
            foreach ($params['filter_column'] as $k => $filter) {
14
                foreach ($filter as $t => $val) {
15
                    if ($t == 'sorting') {
16
                        unset($params['filter_column'][$k]['sorting']);
17
                    }
18
                }
19
            }
20
        }
21
22
        $params['filter_column'][$key][$type] = $value;
23
24
        if (isset($params)) {
25
            return $mainpath.'?'.http_build_query($params);
26
        }
27
        return $mainpath.'?filter_column['.$key.']['.$type.']='.$value;
28
29
    }
30
}