Passed
Push — master ( 38c211...38c211 )
by Hossein
01:26
created

filter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 3
b 0
f 0
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