getInstanceFilter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
if (! function_exists('getInstanceFilter')) {
4
    /**
5
     * Get the available filter instance.
6
     *
7
     * @param null $class
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $class is correct as it would always require null to be passed?
Loading history...
8
     * @return mixed
9
     */
10
    function getInstanceFilter($class = null)
11
    {
12
        $filters = config('filter.filters');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

12
        $filters = /** @scrutinizer ignore-call */ config('filter.filters');
Loading history...
13
14
        if (class_exists($filters[$class])) {
15
            return new $filters[$class];
16
        }
17
    }
18
}
19
20
if (! function_exists('filter')) {
21
    /**
22
     * Make the filter querty string.
23
     *
24
     * @param $field
25
     * @param $value
26
     * @return String
27
     */
28
    function filter($field, $value)
29
    {
30
        return "?{$field}:{$value}";
31
    }
32
}
33